-
Notifications
You must be signed in to change notification settings - Fork 33
Refactor to support new Prometheus Client Java 1.0.0+ #63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
.namespace and .subsystem no longer exist
All timeable metrics implement TimerApi now
If metric is a distribution, call (.collect) and find the snapshot matching labels
7549e5b to
ef34338
Compare
Return a custom type on label-instance that contains the parent
You can't call (.register) on a registry and pass it, instead it needs (.register) to be called on itself
New default is protobuf
ef34338 to
cdbed8f
Compare
|
Work to add callbacks, in order to allow for functionality similar to what was usually achieved through use of Let me know if you believe it makes sense to merge with this refactor. |
There is no replacement for .metricFamilySamples on the raw registry
|
Moving to draft as Prometheus' client-java maintainers added public methods for sum and count of distribution metrics. This will significantly simplify the code. |
This is a refactor idea for iapetos to use the new Prometheus Client Java.
This new library introduces lots of breaking changes compared to the previous simpleclient, as announced by Grafana Labs, but this refactor aims to make iapetos as non-breaking as possible while also not relying on the compatibility layer.
Breaking changes
All registered metrics should have a explicit type.
It is no longer possible to register a Collector, only an instance of Counter, Gauge, Histogram or Summary.
In order to achieve similar functionality we need to have support for adding callbacks to metric instances.
New internal type for distribution metrics
valAtorinvokemethods on the IapetosRegistry will return a new type for metrics of distribution type (histogram and summary):iapetos.collector/LabeledDistributionCollector.This is because it's impossible to retrieve current values from what we call a "label-instance" in distribution metrics, so we need the "parent" or "non-labeled" instance of the metric to remain accessible.
I have an open issue in the Client Java repository to clarify intention.
Naming suffixes
It is no longer allowed to have the name of a metric that is not of type Counter suffixed by 'total'. I believe this is a push to align Prometheus with OpenMetrics standards. This also means that metrics of type Counter will be suffixed by 'total' automatically.
I have added an assertion to
iapetos.collector/instantiateto help users understand what is happening instead of getting a "invalid metric name" generic error from the Prometheus Client.Metrics with no labels have an initial value
If a metric is registered with no labels, it will be automatically initialized to a value of
0.0when scraping or obtaining the metric value.Changes to text format
The text format, exported using
iapetos.export/text-formatno longer includes name, type and help text for all registered metrics, only when they have a value or have no configured labels. The latter will have an initial value as described in the previous section.Changes to JVM metrics
JVM metrics (under
iapetos.collector.jvm) now need to be instantiated as a reified type as they need special handling on registry (call.register()on the metric and not on the registry) and cannot be instantiated using a Builder (as they already are).Some JVM metrics changed names:
jvm_memory_bytes_committedjvm_memory_committed_bytesjvm_memory_bytes_initjvm_memory_init_bytesjvm_memory_bytes_maxjvm_memory_max_bytesjvm_memory_pool_bytes_committedjvm_memory_pool_committed_bytesjvm_memory_pool_bytes_initjvm_memory_pool_init_bytesjvm_memory_pool_bytes_maxjvm_memory_pool_max_bytesjvm_memory_pool_bytes_usedjvm_memory_pool_used_bytesjvm_memory_pool_collection_bytes_committedjvm_memory_pool_collection_committed_bytesjvm_memory_pool_collection_bytes_initjvm_memory_pool_collection_init_bytesjvm_memory_pool_collection_bytes_maxjvm_memory_pool_collection_max_bytesjvm_memory_pool_collection_bytes_usedjvm_memory_pool_collection_used_bytesjvm_infojvm_runtime_info