8000 feat(sc-52274): add status label to request_* http metrics by dmytrorezn · Pull Request #249 · trustwallet/go-libs · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat(sc-52274): add status label to request_* http metrics #249

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 25, 2025

Conversation

dmytrorezn
Copy link
Contributor
@dmytrorezn dmytrorezn commented Mar 25, 2025

This pull request includes changes to the middleware/metrics.go and middleware/metrics_test.go files to enhance the metrics middleware by adding status code tracking and updating the corresponding tests. The most important changes include adding status code labels, updating the metrics middleware to record status codes, and modifying the tests to validate the new status code metrics.

Enhancements to metrics middleware:

  • middleware/metrics.go: Added a new label labelStatus to track HTTP status codes and updated the MetricsMiddleware function to include this label in the metrics.
  • middleware/metrics.go: Modified the MetricsMiddleware function to record the status code of each request and include it in the label values.

Updates to tests:

  • middleware/metrics_test.go: Added a new route /404 to simulate a 404 error and updated the test cases to include this new route.
  • middleware/metrics_test.go: Updated the expected metrics to include new keys for client and server errors, and modified the assertions to check for the new status code label.

@dmytrorezn dmytrorezn merged commit f277fdb into master Mar 25, 2025
2 checks passed
@dmytrorezn dmytrorezn deleted the feature/dmytroreznichenko/sc-52274 branch March 25, 2025 15:12
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.

2 participants
0