Skip to content

Conversation

@kylejuliandev
Copy link
Contributor

This PR

Adds TraceEnricherHookOptions, largely a copy of MetricHookOptions from #512, to enrich the feature_flag.evaluation span event.

Example usage:

var traceHookOptions = TraceEnricherHookOptions.CreateBuilder()
    .WithCustomDimension("key1", "value1")
    .WithFlagEvaluationMetadata("provider", s => s.GetString("provider"))
    .Build();

featureBuilder.AddHostedFeatureLifecycle()
    .AddHook(new TraceEnricherHook(traceHookOptions));

These adds tags to the event associated with the span. Below is an example with the above custom dimension and metadata callback:

image

Related Issues

Fixes #516

Notes

Follow-up Tasks

I kept the builder method names WithCustomDimension and WithFlagEvaluationMetadata, maybe this should be different for Traces? In the Java implementation the both hook options look very similar: TracesHookOptions.java and MetricHookOptions.java

How to test

* Add unit tests
* Update README
* Add XML comments

Signed-off-by: Kyle Julian <[email protected]>
@kylejuliandev kylejuliandev requested a review from a team as a code owner July 19, 2025 17:17
@codecov
Copy link

codecov bot commented Jul 19, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.16%. Comparing base (8c05d1d) to head (6ba5ea6).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #526      +/-   ##
==========================================
+ Coverage   87.88%   88.16%   +0.28%     
==========================================
  Files          48       49       +1     
  Lines        1972     2020      +48     
  Branches      222      228       +6     
==========================================
+ Hits         1733     1781      +48     
  Misses        191      191              
  Partials       48       48              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

Track and add custom attributes for Traces similar to Metric Hook

4 participants