0

I'm monitoring Java apps with Opentelemetry and exported data to Elastic APM. This integration works well, however we are missing some critical information about metrics.

We want to collect information about the host system and jvm metrics.

Openetelemetry collector is running as sidecar in k8s and its conf is below:

apiVersion: opentelemetry.io/v1alpha1
kind: OpenTelemetryCollector
metadata:
  name: app-sidecar
spec:
  mode: sidecar
  config: |
    receivers:
      otlp:
        protocols:
          http:
          grpc:
    exporters:
      logging:
      otlp:
        endpoint: http://endpoint:8200
        headers: 
          Authorization: Bearer token
        tls:
          insecure: true
    service:
      pipelines:
        traces:
          receivers: [otlp]
          exporters: [logging, otlp]
        metrics:
          receivers: [otlp]
          exporters: [logging, otlp]
        logs: 
          receivers: [otlp]
          exporters: [logging, otlp]

Raushan-cs
  • 39
  • 6

1 Answers1

1

Start your Java app with java agent opentelemetry-javaagent.jar (OTEL java autoinstrumentation). Configure it to export metrics (it provides by default JVM metrics), for example OTEL_METRICS_EXPORTER=otlp, OTEL_EXPORTER_OTLP_ENDPOINT=<your side car otel collector otlp grpc endpoint>" - check doc for right doc/syntax.

Jan Garaj
  • 25,598
  • 3
  • 38
  • 59
  • Jan Garaj: no luck , please find jvm params when server starts ```+ exec java -XX:MinRAMPercentage=70 -XX:MaxRAMPercentage=70 --add-opens java.base/java.math=ALL-UNNAMED -javaagent:/app/opentelemetry-javaagent-all.jar -Dotel.service.name=workspace-svc -Dotel.exporter.otlp.endpoint=http://localhost:4317 -jar workspace.jar Picked up JAVA_TOOL_OPTIONS: -javaagent:/otel-auto-instrumentation/javaagent.jar``` – Raushan-cs Nov 06 '22 at 17:20
  • seems to be limitation from Elastic https://www.elastic.co/guide/en/apm/guide/current/open-telemetry.html#open-telemetry-metrics-limitations – Raushan-cs Nov 06 '22 at 17:21
  • @Raushan-cs You didn't enable metric exporter `OTEL_METRICS_EXPORTER=otlp` so no metrics are exported. Standard advice: read the doc – Jan Garaj Nov 06 '22 at 20:26
  • Update: after enabling metric exporter, we can see heap memory details in Elastic. But CPU metrics and System memory usage is still have no data. So looks like ... JVM metrics that OTEL creates are not directly compatible with the fields in the Elastic APM App – Raushan-cs Nov 09 '22 at 18:32
  • looks like we need to use https://github.com/open-telemetry/opentelemetry-java-contrib/blob/main/jmx-metrics/docs/target-systems/jvm.md – Raushan-cs Nov 09 '22 at 18:32
  • any example for contrib package are available? – Raushan-cs Nov 09 '22 at 18:32