elastic / elastic-agent

Elastic Agent - single, unified way to add monitoring for logs, metrics, and other types of data to a host.
Other
124 stars 133 forks source link

Add missing tracing sampling APM config section #5211

Open 1pkg opened 1 month ago

1pkg commented 1 month ago

Describe the enhancement:

APM tracing config should additionally include a section for trace sampling to enable APM Server monitoring be configured with custom sampling rate when managed by Elastic Agent.

Describe a specific use case for the enhancement or feature:

Allow to specify a custom trace sampling rate to control the ingestion rate when self monitoring running APM Server.

What is the definition of done?

The custom sampling APM config section is handled correctly and used to configure tracing in APM Server.

elasticmachine commented 1 month ago

Pinging @elastic/elastic-agent (Team:Elastic-Agent)

pchila commented 4 days ago

@1pkg Could you provide a sample configuration you would like elastic-agent to support?

There's also something else that is unclear: is tracing sampling a setting on the APM agent side or APM server side? I assume you already know that all the components running under elastic-agent will receive the same settings if those are added to APM tracing config

/cc @ycombinator

1pkg commented 4 days ago

@pchila sorry for the confusing sampling link in the description, what we really need is an additional config property in APM tracing config so we can control self-tracing head-based sampling rate.

A hypothetical configuration can look like this in yaml:

agent:
  monitoring:
    enabled: true
    traces: true
    apm:
      environment: test
      global_labels:
        k1: v1
        k2: v2
      sampling_rate: 0.2 # new property
pchila commented 3 days ago

@1pkg thanks for the clarification :) Is sampling rate an optional config or will it be always set along with the other properties ?

1pkg commented 3 days ago

@pchila, I'd say sampling_rate should be an optional field - yes, with a value in the range of [0.0, 1.0]. On our end if sampling rate is set, we'll then apply ratio sampler in the self-instrumentation tracer.