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

Logs priority sampling behavior is incorrect #38468

Closed
jmacd opened this issue Mar 8, 2025 · 1 comment · Fixed by #38470
Closed

Logs priority sampling behavior is incorrect #38468

jmacd opened this issue Mar 8, 2025 · 1 comment · Fixed by #38470
Labels
bug Something isn't working processor/probabilisticsampler Probabilistic Sampler processor

Comments

@jmacd
Copy link
Contributor

jmacd commented Mar 8, 2025

Component(s)

processor/probabilisticsampler

What happened?

Description

When logs priority sampling is enabled by setting a sampling_priority configuration for a logs pipeline, the value has to be set or logs will not sample. This is counter-intuitive and not like the traces sampler.

Worse, a conditional in the related logic ensures that logs sampling priority logic can only raise priority, not lower priority. This is incorrect.

Steps to Reproduce

  probabilistic_sampler:
    sampling_percentage: 100
    sampling_priority: sampling_priority
    attribute_source: record
    from_attribute: sampling_uuid

In this configuration, log records without sampling_uuid will drop. Additionally, a transform stage like

  transform:
    log_statements:
    - context: log
      statements:
        - set(attributes["sampling_uuid"], UUID()) 
        - set(attributes["sampling_priority"], 10)
          where IsMatch(log.body, "noisy")

will not have the intended effect, because of the bug.

Expected Result

In the second example above, noisy logs should sample at 10% when followed by the probabilistic sampler configuration above it.

Actual Result

The logs do not pass. This is two related bugs.

Collector version

v0.120.0

Environment information

No response

OpenTelemetry Collector configuration

Log output

Additional context

No response

@jmacd jmacd added bug Something isn't working needs triage New item requiring triage labels Mar 8, 2025
@atoulme atoulme added the processor/probabilisticsampler Probabilistic Sampler processor label Mar 8, 2025
Copy link
Contributor

github-actions bot commented Mar 8, 2025

Pinging code owners for processor/probabilisticsampler: @jpkrohling @jmacd. See Adding Labels via Comments if you do not have permissions to add labels yourself. For example, comment '/label priority:p2 -needs-triaged' to set the priority and remove the needs-triaged label.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working processor/probabilisticsampler Probabilistic Sampler processor
Projects
None yet
3 participants