Remove framework-specific route detection from collector middleware #251
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
Sadly, with the benefit of hindsight, this wasn't a good idea.
There are two reasons we're dropping this:
It doesn't play nicely with libraries like
Rack::Builder, whichdispatches requests to different Rack apps based on a path prefix in
a way that isn't visible to middleware.
For example, when using
Rack::Builder,sinatra.routeonlycontains the parts of the path after the prefix that
Rack::Builderused to dispatch to the specific app, and doesn't leave any
information in the request environment to indicate which prefix it
dispatched to.
It turns out framework-specific route info isn't always formatted in
a way that looks good in a Prometheus label.
For example, when using regex-based route-matching in Sinatra, you
can end up with labels that look like
\\/vapes\\/([0-9]+)\\/?.For a really detailed dive into those two issues, see this GitHub
comment:
#249 (comment)
Fixes #249