Skip to content

Conversation

@kaylareopelle
Copy link
Contributor

This is just a step toward implementing the trace ID ratio based sampler.

This PR creates a consistent pattern for the root sampler, as well as when the sampling decision is made in trace context, or using the newrelic header (in lib/new_relic/agent/transaction/distributed_tracing.rb).

It also removes old code that isn't being used, the enforce_fallback method. The configs that used this option no longer exist. The allowlist functionality is much more performant and is used here instead.

Case statements are evaluated in order, so I ordered the when statements by my best judgment of what is most and least likely to occur.

We have the allowlist functionality now that is faster.
default, adaptive, always_on, always_off are now available for use when
a trace is root, remote_parent_sampled or remote_parent_not_sampled.

default is first in the case list because it is the most common. I
predict adaptive will be far less common than always_on or always_off,
so I put it last for a slight performance benefit.
@github-actions
Copy link
Contributor

SimpleCov Report

Coverage Threshold
Line 93.66% 93%

Base automatically changed from new-cross-agent-tests to dev October 30, 2025 17:01
}
}
},
{
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This isn't part of the cross-agent tests right now, but I think I'll open a PR for it.

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