Combined mode
Combined mode allows for both HTTP mode and OpenTelemetry mode metrics collection methods.
Exposes metric using an HTTP endpoint.
- metrics are collected when the HTTP endpoint is accessed
- “pull” model
Pushes metrics to an OpenTelemetry endpoint.
- metrics are periodically collected and pushed OpenTelemetry endpoint
- “push” model
Notes
- Due to the indepenent collection methods, HTTP mode metrics most likely will not match OpenTelemetry mode metrics exactly
java -javaagent:jmx_prometheus_javaagent-<VERSION>.jar=[HOSTNAME:]<PORT>:<EXPORTER.YAML> -jar <YOUR_APPLICATION.JAR>
Notes
<PORT>
is required[HOSTNAME]
is optional- if provided, must be separated from
<PORT>
using a colon (:
) (e.g.,server:12345
)
- if provided, must be separated from
java -javaagent:jmx_prometheus_javaagent-1.1.0.jar=12345:exporter.yaml -jar <YOUR_APPLICATION.JAR>
exporter.yaml
openTelemetry:
endpoint: http://prometheus:9090/api/v1/otlp
protocol: http/protobuf
interval: 60
rules:
- pattern: ".*"
Reference HTTP mode Rules for various exporter.yaml
metrics configuration options.
- Run your application.
- Access HTTP mode metrics using a browser to view your metrics.
http://<APPLICATION_HOSTNAME_OR_IP>:<PORT>/metrics
# HELP my_count_total example counter
# TYPE my_count_total counter
my_count_total{status="error"} 1.0
my_count_total{status="ok"} 2.0
- Access your OpenTelemetry platform to view OpenTelemetry metrics.
Integration tests provide complex/concrete examples of application and YAML configuration files.