Custom Metrics #1872
goroutinegrind
started this conversation in
Ideas
Custom Metrics
#1872
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Feature:
A way to include metrics emitted from custom modules in the prometheus registry
Backstory:
I have a requirement for cosmo router to include my own custom metrics in the prometheus registry, as well as the out-of-the-box metrics - all to be hosted on the same port.
The custom metrics are to be used from the custom modules, so ideally it would be something we can instantiate a global registry and pass it where required.
This was already possible previously via replacing
Main()
with a custom implementation of the router startup and using thecore.WithMetrics()
option, to override thePrometheus.TestRegistry
with the Global registry. Albeit, it was not ideal to use something calledTestRegistry
, however on inspection, it was only called that due to being used for tests only. It works for the above stated purpose.Proposal:
I propose
TestRegistry
can be renamed toRegistry
(or something more suitable) since it is not only viable to be used for testsMain()
entrypoint - since some options are not capable of being configured via the config file, and creating these things inside the router, means they are not available to custom modules. Alternatively, if there was a way to expose such things to custom modules, that would a potential solution as well.Beta Was this translation helpful? Give feedback.
All reactions