Report QualifiedCapture correctly in prometheus metrics#1919
Report QualifiedCapture correctly in prometheus metrics#1919akshaymankar merged 1 commit intodevelopfrom
Conversation
For prometheus metrics middleware to be able to replace /users/4f7cbd8c-5fe3-4818-94c0-8ae68460ba13 with /users/:uid, it needs to know the paths in servant that exist. This is generated statically using the class `RoutesToPaths`. This class had an overlappable instance for everything, this caused to not notice when we created the QualifiedCapture type. In order to ensure that we instantiate this class correctly, this commit removes this catch-all instance and instantiate the class for every type that needs it explicitly.
e37eb60 to
681c9c5
Compare
|
Personally, I'd prefer to keep the overlappable instances around, and maybe have some more tests that check that the captures are collected correctly. Also, I think it's better to test against the actual galley/brig API, instead of an artificial one. The way it currently is will fail if we say accidentally delete the instance for |
I removed the overlappable instances exactly because I want compiler to tell us about the missing instance when we introduce a new capturing combinator. Even if we delete the instance for |
I understand that, but my point was that perhaps we can achieve the same effect with a test, instead of having all these trivial instances around, which need to be extended every time we add a new combinator, even if it has no connection to metrics.
Why? Couldn't we call In any case, this is a minor point. If you disagree that having all these trivial instances is annoying, feel free to merge anyway. |
How would this ensure that a new capture type has a correct instance? I guess it would tell us if we replace our current type, but if we use it in a new endpoint, we will still not know.
I don't disagree, the trivial instances are annoying. But I don't know how to not write a good enough test which ensures that all the endpoints are correctly reported in metrics. |
Such a test might have caught the problem solved by this PR though, because we created a new combinator and used in existing routes. But you're right, it won't catch cases where we create a new combinator and only use it in new routes.
Feel free to merge, it's really not a big deal. |
For prometheus metrics middleware to be able to replace
/users/4f7cbd8c-5fe3-4818-94c0-8ae68460ba13 with /users/:uid, it needs to know
the paths in servant that exist. This is generated statically using the class
RoutesToPaths. This class had an overlappable instance for everything, thiscaused to not notice when we created the QualifiedCapture type. In order to
ensure that we instantiate this class correctly, this commit removes this
catch-all instance and instantiate the class for every type that needs it
explicitly.
https://wearezeta.atlassian.net/browse/FS-224
Checklist
changelog.d.