OpenLiberty / open-liberty

Open Liberty is a highly composable, fast to start, dynamic application server runtime environment
https://openliberty.io
Eclipse Public License 2.0
1.13k stars 576 forks source link

OpenTelemetry Metrics Investigation #25482

Open fmhwong opened 1 year ago

fmhwong commented 1 year ago
fmhwong commented 9 months ago

Presented metrics comparison in a MicroProfile Telemetry call on 8/30/2023

donbourne commented 4 months ago

@fmhwong / @Channyboy, please provide your thoughts on the following question...

Goals

  1. applications must be able to use the OTel metrics API directly to create/update metrics
  2. Liberty runtime must be able to send runtime and application metrics to OTLP receivers
  3. (???) Liberty runtime must be able to provide a Prometheus "/metrics" endpoint for runtime and application metrics. The "/metric" output names/labels must match what you would see if you looked at metrics from Prometheus received from OTel Collector (Liberty -> OTel Collector -> Prometheus)
  4. application / runtime metrics must be able to share OTel Context with OTel traces and logs
  5. metric names/labels must follow OTel semantic conventions that are "stable" (http / jvm)
  6. metric names/labels should follow OTel semantic conventions that currently exist but that aren't stable unless there's a good reason not to (which we would probably want to raise with OTel community).

Questions Q1. There are multiple ways that we could get our Liberty runtime and applications to use OTel metrics. What are the pros/cons of each of the following options? Which option seems best?:

  1. Send metrics to MP Metrics and use the OTLP meter registry with Micrometer to be able to forward to an OTLP receiver. Let applications use OTel API or MP Metrics API to create/update metrics.
  2. Send Liberty runtime metrics to OTel API using the "MappingTable" approach for metrics (and directly using OTel Timer API for Timer metrics). Let applications use OTel API to create/update metrics.
  3. Update metrics instrumentation points in Liberty to use Observations. Provide Observation handlers to route metrics to MP Metrics or OTel (or potentially others in the future). Let applications use OTel API to create/update metrics. Possibly let applications add Observation handlers.

@Emily-Jiang, FYI

fmhwong commented 4 months ago

I tested out the OpenTelemetry JVM Runtime Metrics for Java 8 on multiple versions of Java and recorded the results at https://github.com/eclipse-openj9/openj9/issues/18952

Channyboy commented 4 months ago
  1. Pro:
    • Quick?

Con:

Other:

Con:

Con: Other: