dotnet-sdk icon indicating copy to clipboard operation
dotnet-sdk copied to clipboard

feat: Move OTEL hooks to the SDK

Open askpt opened this issue 11 months ago • 3 comments

Move OTEL hooks to the SDK

This pull request moves the OTEL hooks to the SDK, as discussed in the linked issue (#175). I also changed the unit tests to clean up some code. Finally, I moved the documentation.

Related Issues

Fixes #175

Notes

Implementation of Tracing and Metrics Hooks:

  • src/OpenFeature/Hooks/MetricsConstants.cs: Introduced constants for metric names, descriptions, and attributes used in metrics collection.
  • src/OpenFeature/Hooks/MetricsHook.cs: Implemented the MetricsHook class to capture metrics related to flag evaluations, including active counts, requests, successes, and errors.
  • src/OpenFeature/Hooks/TracingConstants.cs: Added constants for tracing attributes and event names.
  • src/OpenFeature/Hooks/TracingHook.cs: Implemented the TracingHook class to capture tracing information for flag evaluations, including key, variant, provider name, and exceptions.

Follow-up Tasks

  • As mentioned in the Tracing Hook, we should use the new API method when we upgrade this repository is upgraded to dotnet 9. [1]
  • We should remove any reference in the other repository and mark the Nuget package as deprecated.

askpt avatar Dec 31 '24 11:12 askpt

Codecov Report

Attention: Patch coverage is 95.00000% with 3 lines in your changes missing coverage. Please review.

Project coverage is 87.23%. Comparing base (39f884d) to head (2b4306a). Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/OpenFeature/Hooks/MetricsHook.cs 94.00% 0 Missing and 3 partials :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #338      +/-   ##
==========================================
+ Coverage   87.02%   87.23%   +0.21%     
==========================================
  Files          45       47       +2     
  Lines        1757     1794      +37     
  Branches      184      182       -2     
==========================================
+ Hits         1529     1565      +36     
- Misses        188      190       +2     
+ Partials       40       39       -1     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

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

codecov[bot] avatar Dec 31 '24 11:12 codecov[bot]

Thanks for starting this PR but I think we should wait until this spec PR is merged before moving this hook to the SDK.

beeme1mr avatar Jan 06 '25 20:01 beeme1mr

@toddbaert, @beeme1mr, @kinyoklion, @kylejuliandev, @arttonoyan and @austindrenski

I merged the OTEL semcov from #397 and replaced the similar attributes. Please have a look and let me know what you think.

askpt avatar May 19 '25 16:05 askpt

This seems good to me, but I want to make sure we're not putting anything into the SDK that we'll need to change soon. I know there's been some thrash with the sem-conv recently... @beeme1mr is there anything here you worry that we might need to change?

We might want to consider annotating this as experimental either way.

@toddbaert and @beeme1mr, I am waiting for feedback on how to proceed. If there are potential convention changes, we should mark them as experimental.

askpt avatar Jun 17 '25 07:06 askpt

I am waiting for feedback on how to proceed. If there are potential convention changes, we should mark them as experimental.

I'd really like to trace hook to match the latest spec. It's now marked as a release candidate and unlikely to change in a breaking way. Please also consider using the finally stage.

beeme1mr avatar Jun 17 '25 20:06 beeme1mr

@beeme1mr, @toddbaert, @kinyoklion, and @kylejuliandev, I made a couple of changes since your last review. Please look to see if they make sense.

askpt avatar Jun 25 '25 18:06 askpt