Skip to content

Add BQ insertion traces#3293

Open
bblaszkow06 wants to merge 5 commits intoLogflare:mainfrom
bblaszkow06:bb/bq-insert-instrumentation
Open

Add BQ insertion traces#3293
bblaszkow06 wants to merge 5 commits intoLogflare:mainfrom
bblaszkow06:bb/bq-insert-instrumentation

Conversation

@bblaszkow06
Copy link
Contributor

@bblaszkow06 bblaszkow06 commented Mar 17, 2026

Closes O11Y-1580

@bblaszkow06 bblaszkow06 marked this pull request as ready for review March 17, 2026 14:29
value -> String.to_float(value)
end

bq_compare_sample_ratio =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think we don't need a separate env var for this, we can reuse the ingest_sample_ratio for sampling the insert mechanism

Comment on lines +383 to +388
defp compute_batch_attrs(messages, bq_api_tag) do
event_count = length(messages)
bytes = messages |> Enum.map(&:erlang.external_size(&1.data.body)) |> Enum.sum()

%{insert_method: bq_api_tag, batch_event_count: event_count, batch_bytes: bytes}
end
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm assuming that the thought process for adding this attr in is to compare whether payload size plays a role in the performance? might be better to compute this lower down in the request payload construction if so, this is before any manipulations are performed and wouldn't be as informative.

"/api/events" <> _ -> ingest_config()
"/endpoints/query" <> _ -> endpoint_config()
"/api/endpoints/query" <> _ -> endpoint_config()
case {span_name, Map.get(attributes, :"url.path")} do
Copy link
Contributor

@Ziinc Ziinc Mar 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we probably can check if the span name contains _pipeline_ or an ingest_ prefix that would clearly indicate that it is part of the ingestion pipeline.

end

defp bq_compare_config do
prob = Application.get_env(:logflare, :bq_compare_sample_ratio)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as above, should use ingest sample ratio

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants