Skip to content

feat: Add trace when evaluating feature flags#755

Open
kylejuliandev wants to merge 7 commits into
open-feature:mainfrom
kylejuliandev:kylej/improve-tracing
Open

feat: Add trace when evaluating feature flags#755
kylejuliandev wants to merge 7 commits into
open-feature:mainfrom
kylejuliandev:kylej/improve-tracing

Conversation

@kylejuliandev
Copy link
Copy Markdown
Contributor

@kylejuliandev kylejuliandev commented May 7, 2026

This PR

Add trace when evaluating feature flags. This is different from the TraceEnricherHook which enriches the current span or trace with an event, instead this more closely follows the semantic conventions: https://opentelemetry.io/docs/specs/semconv/feature-flags/feature-flags-events/. Also add OpenTelemetry logging to the sample application and ensure traces are always sampled.

Success tracwe

image

Error trace

image

Related Issues

Fixes #595
Fixes #541

Notes

Follow-up Tasks

How to test

Signed-off-by: Kyle Julian <38759683+kylejuliandev@users.noreply.github.com>
Signed-off-by: Kyle Julian <38759683+kylejuliandev@users.noreply.github.com>
Signed-off-by: Kyle Julian <38759683+kylejuliandev@users.noreply.github.com>
@kylejuliandev kylejuliandev requested a review from a team as a code owner May 7, 2026 18:49
@codecov
Copy link
Copy Markdown

codecov Bot commented May 7, 2026

Codecov Report

❌ Patch coverage is 97.95918% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 93.59%. Comparing base (ec94acf) to head (7e99375).
⚠️ Report is 10 commits behind head on main.

Files with missing lines Patch % Lines
src/OpenFeature/OpenFeatureActivitySource.cs 96.55% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #755      +/-   ##
==========================================
+ Coverage   93.47%   93.59%   +0.12%     
==========================================
  Files          68       70       +2     
  Lines        2956     3030      +74     
  Branches      351      374      +23     
==========================================
+ Hits         2763     2836      +73     
  Misses        135      135              
- Partials       58       59       +1     

☔ 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.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request implements OpenTelemetry tracing for feature flag evaluations in the OpenFeature client, including the addition of an activity source and corresponding unit tests. The review feedback highlights several discrepancies with OpenTelemetry Semantic Conventions, suggesting the use of standard attribute names (e.g., 'feature_flag.provider_name', 'feature_flag.evaluation_reason', 'feature_flag.evaluation_value', 'feature_flag.variant') and recommending that span statuses be explicitly set to 'Error' when failures occur to improve telemetry accuracy.

Comment thread src/OpenFeature/OpenFeatureClient.cs
Comment thread src/OpenFeature/OpenFeatureClient.cs
Comment thread src/OpenFeature/OpenFeatureClient.cs
Comment thread src/OpenFeature/OpenFeatureClient.cs
Comment thread src/OpenFeature/OpenFeatureClient.cs
Comment thread src/OpenFeature/OpenFeatureClient.cs
Signed-off-by: Kyle Julian <38759683+kylejuliandev@users.noreply.github.com>
Signed-off-by: Kyle Julian <38759683+kylejuliandev@users.noreply.github.com>
Signed-off-by: Kyle Julian <38759683+kylejuliandev@users.noreply.github.com>
Signed-off-by: Kyle Julian <38759683+kylejuliandev@users.noreply.github.com>
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.

[FEATURE] Add support for spans instead of span events Update the trace support

1 participant