Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf: tweak schema sampling rate #2252

Merged
merged 1 commit into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/docs.logflare.com/docs/concepts/ingestion/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ metadata: {
:::note
On high ingestion volume, Logflare will sample incoming events instead of checking each event. The sample rate decreases as the ingestion rate increases. Ingestion rates are compared only on an individual local server that is performing the ingestion.

From 10-100 events per second, sample rate is 0.2. From 100-500 events per second, sample rate is 0.1. From 500-1000 events per second, sample rate is 0.05. Above 1000 events per second, sample rate is 0.01.
From 10-100 events per second, sample rate is 0.1. From 100-1,000 events per second, sample rate is 0.01. From 1,000-10,000 events per second, sample rate is 0.001. Above 10,000 events per second, sample rate is 0.0001.
:::

### Key Transformation
Expand Down
8 changes: 4 additions & 4 deletions lib/logflare/source/bigquery/pipeline.ex
Original file line number Diff line number Diff line change
Expand Up @@ -213,10 +213,10 @@ defmodule Logflare.Source.BigQuery.Pipeline do
# random sample if local ingest rate is above a certain level
probability =
case PubSubRates.Cache.get_local_rates(source.token) do
%{average_rate: avg} when avg > 1000 -> 0.01
%{average_rate: avg} when avg > 500 -> 0.05
%{average_rate: avg} when avg > 100 -> 0.1
%{average_rate: avg} when avg > 10 -> 0.2
%{average_rate: avg} when avg > 10000 -> 0.0001
%{average_rate: avg} when avg > 1000 -> 0.001
%{average_rate: avg} when avg > 100 -> 0.01
%{average_rate: avg} when avg > 10 -> 0.1
_ -> 1
end

Expand Down
Loading