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

Optionally record why a sample decision was made #503

Merged
merged 3 commits into from
Sep 7, 2022
Merged

Conversation

kentquirk
Copy link
Contributor

@kentquirk kentquirk commented Sep 6, 2022

Which problem is this PR solving?

Short description of the changes

  • Adds a config flag, AddRuleReasonToTrace that adds a new field to traces called meta.refinery.reason, which is a string field that contains information about the sampler(s) that made a trace decision. If it was a rule-based sampler, it includes the rule name.
  • Also removes unnecessary build flags that were causing tests not to run.
  • Updates README and config file

@MikeGoldsmith MikeGoldsmith added type: enhancement New feature or request version: bump minor A PR that adds behavior, but is backwards-compatible. labels Sep 6, 2022
@kentquirk kentquirk marked this pull request as ready for review September 6, 2022 20:01
@kentquirk kentquirk requested review from a team and JamieDanielson September 6, 2022 20:01
Copy link
Contributor

@MikeGoldsmith MikeGoldsmith left a comment

Choose a reason for hiding this comment

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

Overall, looks good. I've left some minor feedback 👍🏻

What do you think about a consistent template for reason strings?

eg
"deterministic/always"
"deterministic/chance"
"totalthroughput/{key}"
"dynamic/{key}"
"emadynamic/{key}"
"rules/span/{rule_name}"
"rules/trace/no_rule"
"rules/invalid_scope/{rule_name}

Comment on lines 116 to 117
# AddRuleReasonToTrace causes traces that are sent to Honeycomb to include a field `meta.refinery.reason`,
# which will contain text indicating which rule was evaluated that caused the trace to be included.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
# AddRuleReasonToTrace causes traces that are sent to Honeycomb to include a field `meta.refinery.reason`,
# which will contain text indicating which rule was evaluated that caused the trace to be included.
# AddRuleReasonToTrace causes traces that are sent to Honeycomb to include the field `meta.refinery.reason`,
# that contains text indicating which rule was evaluated that caused the trace to be included.

@@ -456,7 +456,7 @@ func (i *InMemCollector) send(trace *types.Trace) {
}

// make sampling decision and update the trace
rate, shouldSend := sampler.GetSampleRate(trace)
rate, shouldSend, why := sampler.GetSampleRate(trace)
Copy link
Contributor

@MikeGoldsmith MikeGoldsmith Sep 7, 2022

Choose a reason for hiding this comment

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

nit: for consistency, could we also call the result parameter reason? (This would incur a few changes throughout the PR)

@kentquirk
Copy link
Contributor Author

I like all of your suggestions. Thanks, will implement.

@kentquirk kentquirk merged commit 8420c48 into main Sep 7, 2022
@kentquirk kentquirk deleted the kent.add-rule-name branch September 7, 2022 13:52
ghost pushed a commit to opsramp/tracing-proxy that referenced this pull request Jul 5, 2024
## Which problem is this PR solving?

- Fixes honeycombio#473 

## Short description of the changes

- Adds a config flag, `AddRuleReasonToTrace` that adds a new field to traces called `meta.refinery.reason`, which is a string field that contains information about the sampler(s) that made a trace decision. If it was a rule-based sampler, it includes the rule name.
- Also removes unnecessary build flags that were causing tests not to run.
- Updates README and config file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement New feature or request version: bump minor A PR that adds behavior, but is backwards-compatible.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add option to rules to add rule name to span when matched
2 participants