Inconsistent instrumentation semantics
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 10k
- Forks
- 1.2k
- Avg merge
- 14h 38m
- Merged PRs (30d)
- 92
Description
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 always 200 (as opposed to 500 or default_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 just 200)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in lib/grape/endpoint.rb at the instrumentation notification near line 238 and the exception path near line 264. Reproduce explicit errors, rescue_all handling, and uncaught endpoint exceptions, then compare the reported status values; done means the instrumentation semantics are confirmed and status reporting is consistent across these paths.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- api, observability
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100