Skip to content
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

Fix metric middleware panic #133

Merged
merged 4 commits into from
Sep 19, 2024
Merged

Fix metric middleware panic #133

merged 4 commits into from
Sep 19, 2024

Conversation

samlaf
Copy link
Collaborator

@samlaf samlaf commented Sep 19, 2024

Recent metric changes were causing panics that weren't caught in tests because the tests never use the metrics and logs middlewares. Added testing for those, and fixed the panic.

Fixes Issue

Fixes #

Changes proposed

Screenshots (Optional)

Note to reviewers

@@ -99,7 +99,7 @@ func NewMetrics(subsystem string) *Metrics {
Buckets: prometheus.ExponentialBucketsRange(0.05, 1200, 20),
Help: "Histogram of HTTP server request durations",
}, []string{
"method", "commitment_mode", "DA_cert_version", // no status on histograms because those are very expensive
"method", // no status on histograms because those are very expensive
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hopeyen had to remove this because it was causing a revert in the metric middleware, since you weren't passing these labels (because we don't have access to them before the request when this is called):

panic: inconsistent label cardinality: expected 3 label values but got 1 in []string{"GET"}

There might be another way to keep these in, but I suggest merging this first and then figuring out that in your other PR which should also change the behavior of the handlers to use custom errors instead of relying on the values returned along with an err.

@samlaf samlaf force-pushed the fix-metric-middleware-panic branch from 5aaa5c3 to 5e8c5b4 Compare September 19, 2024 00:38
Copy link
Collaborator

@hopeyen hopeyen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm I see, I can take a look at adding them back in after this gets merged

@samlaf samlaf merged commit 0d37899 into main Sep 19, 2024
7 checks passed
@samlaf samlaf deleted the fix-metric-middleware-panic branch September 19, 2024 07:15
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