cohere-toolkit
cohere-toolkit copied to clipboard
metrics: env secret in auth header
Thank you for contributing to the Cohere Toolkit!
-
[ ] PR title: "area: description"
- Where "area" is whichever of interface, frontend, model, tools, backend, etc. is being modified. Use "docs: ..." for purely docs changes, "infra: ..." for CI changes.
- Example: "deployment: add Azure model option"
-
[ ] PR message: Delete this entire checklist and replace with
- Description: a description of the change
- Issue: the issue # it fixes, if applicable
- Dependencies: any dependencies required for this change
-
[ ] Add tests and docs: Please include testing and documentation for your changes
-
[ ] Lint and test: Run
make lintandmake run-tests
AI Description
This pull request updates the code responsible for reporting metrics by removing the attachment of secrets to the metrics data.
Summary
The changes in this PR primarily involve the removal of the _attach_secret method and related code, which was responsible for attaching the report secret to the metrics data. This method is no longer necessary as the secret is now included in the headers of the client.post request as "Authorization": "Bearer {REPORT_SECRET}".
Changes
- Remove the
secret: str = ""line from theMetricsDataBaseclass insrc/backend/schemas/metrics.py. - Remove the
_attach_secretmethod and its usage fromMetricsMiddlewareinsrc/backend/services/metrics.py. - Update the
report_metricsfunction insrc/backend/services/metrics.pyto include headers with theclient.postrequest, adding the"Authorization"and"Content-Type"headers. - Remove the addition of
"secret"to the signal data in thelog_signal_curlmethod ofMetricsHelperinsrc/backend/services/metrics.py.
Codecov Report
Attention: Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.
Project coverage is 83.76%. Comparing base (
4edacee) to head (2a5bb54). Report is 137 commits behind head on main.
| Files | Patch % | Lines |
|---|---|---|
| src/backend/services/metrics.py | 0.00% | 2 Missing :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## main #647 +/- ##
==========================================
+ Coverage 81.38% 83.76% +2.37%
==========================================
Files 199 239 +40
Lines 8354 10846 +2492
==========================================
+ Hits 6799 9085 +2286
- Misses 1555 1761 +206
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.