operator-framework / java-operator-sdk

Java SDK for building Kubernetes Operators
https://javaoperatorsdk.io/
Apache License 2.0
791 stars 213 forks source link

Metrics - Micrometer Integration #64

Closed csviri closed 3 years ago

csviri commented 4 years ago

Integrate micrometer to generate metrics about usage / execution. The goal is that there are now not only logs but meaningful metrics exposed about the execution.

csviri commented 4 years ago

https://micrometer.io/

csviri commented 3 years ago

Would be great to gather here the metrics we are interested in. Some which came to my mind:

Feel free to add yours.

jmrodri commented 3 years ago

@csviri How would something like this integrate with prometheus on kubernetes? Most operators output their metrics to be scraped by a prometheus service to expose their items to the console.

csviri commented 3 years ago

@jmrodri The idea is that we would make it very easy to integrate with a metrics endpoint, thus to expose the metrics to http. Prometheus is supported by micrometer so I guess that would not be a hassle.

But ideally we would not be dependent on any framework (spring / quarkus / micronaut) but would make it very easy to integrate with them. So the controller is what exposes the metrics will be native to the desired framework.

csviri commented 3 years ago

An important part of this would be extensibility. So anybody should be able to add own metrics. The simplest way to do that (the metrics about the Custom Resource processing ) is just expose the micrometer api to the controller. So the user can add custom metrics directly to the controller implementation. What we should provide out of the box is probably metrics that are not necessary available from the controllers. Like threading related metrics, maybe some event handling. But also some basic standard metrics mentioned above that is makes sense for everybody.

jmrodri commented 3 years ago

/assign @laxmikantbpandhare

metacosm commented 3 years ago

Another project to look into is https://opentelemetry.io/

jmrodri commented 3 years ago

Another resources mentioned during community meeting: https://quarkus.io/guides/micrometer

metacosm commented 3 years ago

Seems like Micrometer is indeed the framework of choice to deal with metrics in Quarkus. This shouldn't prevent us from looking at opentelemetry but it seems more focused on tracing than metrics.

laxmikantbpandhare commented 3 years ago

Yes @metacosm - Micrometer is better choice as compare to OpenTelemetry. There are few differences like OpentTelemetry does not support dedicated times type, distribution summery type and also it does not have any naming conventions. OpenTelemetry is more focused on tracing while micrometer is built specifically for getting the metrics/usage of an application. OpenTelemetry would be useful to measure across many Micro-services as they hand off requests and you need to trace behavior, while Micrometer would be more useful for tracking a single application's performance and health.

laxmikantbpandhare commented 3 years ago

I am still looking for actual API's and services that both OpenTelemetry and Micrometer offers. I will share those details shortly.

laxmikantbpandhare commented 3 years ago

Raised PR #486