refactor: improve OpenTelemetry configuration#127
Merged
Conversation
02c3177 to
44c8a47
Compare
Codecov ReportAttention: Patch coverage is
❌ Your project status has failed because the head coverage (69.15%) is below the target coverage (80.00%). You can increase the head coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #127 +/- ##
==========================================
+ Coverage 69.13% 69.15% +0.02%
==========================================
Files 121 122 +1
Lines 9992 9746 -246
==========================================
- Hits 6908 6740 -168
+ Misses 3084 3006 -78 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
44c8a47 to
07728f2
Compare
rhamzeh
reviewed
Sep 20, 2024
a865212 to
fb5af1e
Compare
rhamzeh
approved these changes
Sep 20, 2024
ca55d96 to
4861ecf
Compare
4861ecf to
5afb454
Compare
Merged
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This change fixes some inconsistencies in how the Python SDK handles the configuration API for its OpenTelemetry support. These changes should improve the developer experience and general usage of the feature.
dict-style configuration to be provided, similar to how we support JSON-style approaches in some of the other SDKs.Current behavior expects classes to be supplied:
After this change, a
dictconfiguration can be provided instead:fga_client_credentials_requestinstead ofhistogram_request_durationfor thefga-client.credentials.requesthistogram.This makes the configuration more self-expressive and offers a better experience, particularly for the
dictstyle configuration.attr_prefix from attribute names onTelemetryMetricConfiguration, which makes for a cleaner-looking API in real-world usage.is_enabledhelper method to theTelemetryMetricConfigurationclass, we will reduce the number of instances of redundant code that check whether a particular metric should be used when metrics are being written.is_validhelper method. This will verify the configuration is valid and (optionally) raise an exception if it is not.is_enabledleverages this without raising the exception to ensure the configuration is fully ready for use.This means if an application sets:
Internally,
configwill represent this state:These changes update the configuration to default to False, so in the case of:
It's state will be:
References
Review Checklist
main