Skip to content

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.

3 participants