python-sdk
python-sdk copied to clipboard
feat(OpenTelemetry): add per-HTTP request counter metric
Description
Added:
- Adds a per-HTTP request counter metric,
fga-client.request. It is disabled by default.
Changed:
- Method signature on
credentialsRequestnow uses1as the default parameter value. - Changed default unit type in
TelemetryCounter/TelemetryCounters. It mistakenly usedmillisecondsas the default unit type for counters previously. - Refactored
TelemetryHistogram/TelemetryHistogramsto use the shared defaultmillisecondsunit type; not necessary to define it each time.
Fixed:
- Moved
fromRequeststep above exception handling in the synchronous API Client to ensure those attributes were properly collected there. This was already the case in the asynchronous API client. - Moved
http.request.resend_countincrement to the top of the retry loop for the synchronous API client to ensure the proper value is collected when an API exception is raised.
References
Closes #130
Review Checklist
- [x] I have clicked on "allow edits by maintainers".
- [ ] I have added documentation for new/changed functionality in this PR or in a PR to openfga.dev [Provide a link to any relevant PRs in the references section above]
- [x] The correct base branch is being used, if not
main - [ ] I have added tests to validate that the change in functionality is working as expected
Codecov Report
Attention: Patch coverage is 76.66667% with 7 lines in your changes missing coverage. Please review.
Project coverage is 69.17%. Comparing base (
a00f039) to head (916442d). Report is 2 commits behind head on main.
| Files with missing lines | Patch % | Lines |
|---|---|---|
| openfga_sdk/telemetry/configuration.py | 55.55% | 4 Missing :warning: |
| openfga_sdk/telemetry/metrics.py | 57.14% | 3 Missing :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## main #135 +/- ##
==========================================
+ Coverage 69.15% 69.17% +0.01%
==========================================
Files 122 122
Lines 9746 9771 +25
==========================================
+ Hits 6740 6759 +19
- Misses 3006 3012 +6
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.