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

Handle unexpected status codes #95

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

snikch
Copy link
Contributor

@snikch snikch commented May 26, 2016

Currently if you respond with a status code that doesn't explicitly have a counter set, you'll get a panic.

@mihasya
Copy link
Collaborator

mihasya commented Jun 4, 2016

Hmm I'm not sure this is really what we want happening - the next person that comes along and has the same issue you had with 422 is just going to get a silent failure and no metrics. I'm inclined to think the panic is actually the right outcome here - lets you know the counter implementation doesn't know the code you're trying to return, and the fix seems straight-forward enough.

@snikch
Copy link
Contributor Author

snikch commented Jun 6, 2016

Very true. After realising that these are counters rather than meters we implemented our own version where we create a meter on demand for each status type. This reduces the amount of meters any one consumer will have, as I'd imagine not everyone is using all of the status codes, but also added a little bit more complexity with a mutex to prevent concurrency clobbering when initializing a meter.

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.

None yet

2 participants