Remove ingestion from OTEL tracing (#2409)

This commit removes the current 1% sampling on ingestion to completely
ignore ingestion traces. We are not getting enough value from those, and
we'll keep dashboard, API and background jobs traces only.
pull/2410/head
Vinicius Brasil 4 years ago committed by GitHub
parent f9a2d00582
commit 11d7cf01c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -50,15 +50,12 @@ end
defmodule Plausible.OpenTelemetry.Sampler do
@moduledoc """
[Custom OpenTelemetry sampler](https://hexdocs.pm/opentelemetry/readme.html#samplers)
implementation that samples 1% of the `/api/event` traces, but records 100% of
other traces.
implementation that ignores `/api/event` traces, while recording 100% of other traces.
"""
@behaviour :otel_sampler
require OpenTelemetry.Tracer, as: Tracer
@ratio_sampler :otel_sampler_trace_id_ratio_based.setup(0.01)
@impl true
def setup(_sampler_opts), do: []
@ -66,17 +63,10 @@ defmodule Plausible.OpenTelemetry.Sampler do
def description(_sampler_config), do: inspect(__MODULE__)
@impl true
def should_sample(context, trace_id, links, name, kind, attributes, _config)
def should_sample(context, _trace_id, _links, _name, _kind, attributes, _config)
when attributes."http.target" == "/api/event" do
:otel_sampler_trace_id_ratio_based.should_sample(
context,
trace_id,
links,
name,
kind,
attributes,
@ratio_sampler
)
tracestate = context |> Tracer.current_span_ctx() |> OpenTelemetry.Span.tracestate()
{:drop, [], tracestate}
end
@impl true

Loading…
Cancel
Save