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
Inconsistent instrumentation semantics #1496
Comments
It looks like a bug, would appreciate a spec that reproduces this to start. |
@dblock this will fail: https://github.com/jondot/vitals/blob/b0b3e38ab02e0ce575916d910fca72a6868bf625/spec/vitals/integrations/notifications/grape_spec.rb#L64 while this will not: And this is the entirety of "instrumentation" code: https://github.com/jondot/vitals/blob/master/lib/vitals/integrations/notifications/grape.rb#L12 |
Turn it into a spec, try to fix it. |
I spent some time trying that, but I don't see any existing specs for AS::N that I can learn from in order to build a test in the existing Grape infra, however, tests in vitals would fail. |
@jondot Are you talking about deprecating grape support in vitals? I can't speak to that. In Grape the error handler sets status, it lives "outside" of the endpoint itself. So the answer I guess is "it depends on how an exception is being handled"? |
I would like to resurrect this issue. @dblock I understand the reasoning, but shouldn't we then have and additional instrumentation middleware which sits outside of https://github.com/ruby-grape/grape/blob/3959a01f/lib/grape/endpoint.rb#L281. At the moment, there is absolutely no way to monitor the actual status returned by the server |
I suppose the answer to having a way to monitor the actual status returned by the server is yes. So I would take a PR for that. |
Hi,
I'd like to point out, and ask, what's the expected behavior when an exception is thrown in a Grape endpoint, towards instrumentation (via AS:N).
When I want to instrument Grape, I subscribe to this notification:
https://github.com/ruby-grape/grape/blob/master/lib/grape/endpoint.rb#L238
What I'm experiencing right now is that
endpoint.status
is always200
(as opposed to500
ordefault_error
), even when an exception was raised in that endpoint.When an exception is raised, I guess this blows up:
https://github.com/ruby-grape/grape/blob/master/lib/grape/endpoint.rb#L264
But then what happens with the instrumentation block?
When explicitly stating an error inside an endpoint, it works (status code is
500
).In a
rescue_all
block, or while an endpoint throws it doesn't work (status code is either stale, wasn't set, and is just200
)The text was updated successfully, but these errors were encountered: