Closed binaryseed closed 4 years ago
This is absolutely beautiful. I have added just one comment, which is about either using [Next | StartTime]
or a tuple. The cons
is the smallest and fastest implementation of a pair in Erlang, but a tuple would be just fine. Other than that, I think we can totally move this to a separate package, as it probably has other uses outside Plug itself. Maybe a package inside beam-telemetry?
❤️ thanks! Updated to use cons
, and also to exclude normal exits from the exception case...
I think a new package would be a good home for this - how should we go about getting that started?
You have been invited to beam-telemetry so you can create the repo there. :)
I think responding based on Commands
is better, but the new code is slightly less elegant :(
There's a nested case
since I need to gather data from two of the commands in the list if they exist. The handlers in cowboy itself reduce over the list and accumulate some state, but I thought this was straightforward enough. Open to thoughts there
Commands that start with error_response
have a few different shapes:
The upside of this is that the exception
event now includes the actual response sent which none of the previous versions of this were able to do!
Nice! We should probably get someone who actually understands Cowboy to review this too. :)
OK! I got this ported into it's own repo!
https://github.com/beam-telemetry/cowboy_telemetry
I just setup a basic Github Action for test, but nothing relating to publishing this as a package on Hex yet. I'm sure there's more to do getting it setup for release, but I'm closing this issue in favor of moving discussion to it's own repo & Issues
Once it gets published we can re-work this to reference the new package
WIP. This PR demonstrates how we might leverage a cowboy
stream_handler
to provide instrumentation that isn't susceptible to the problems thatplug_adapter
instrumentation encounteredThis needs more work and an evaluation before consideration for merging