0

I am using opentelemetry to send metrics to prometheus and I am using otlp exporter. But I am facing 2 issues there.

  1. Service name is coming as unknown_serive:java .

  2. jvm/auto-instrumented metrics are not coming.

If anyone can help here, it would be great. Thanks!

For fixing the service-name issue, I tried 3 solutions,

  1. I set OTEL_SERVICE_NAME variable in config map.
  2. I tried passing -Dotel.service.name but this is also not working.
  3. I tried passing service.name value in OTEL_RESOURCE_ATTRIBUTES, but that too doesn't work.

For jvm metrics, i set -Dotel.javaagent.enabled=true, but metrics still not coming.

My otel-config.yaml file is

exporters:
    otlp:
        endpoint: some-endpoint
        tls:
            insecure: true
    prometheusremotewrite:
        endpoint: some-endpoint
        resource_to_telemetry_conversion:
            enabled: true
  • It sounds like you're using the otel java agent, but also maybe adding your own custom instrumentation. How are you configuring the SDK? You should use the env vars / system properties [documented here](https://github.com/open-telemetry/opentelemetry-java/tree/main/sdk-extensions/autoconfigure). Minimally, you'll want to configure `OTEL_SERVICE_NAME` and set `OTEL_EXPORTER_OTLP_ENDPOINT` to collector's OTLP endpoint. You'll also want to ensure that your custom instrumentation uses the same `OpenTelemetry` instance as the otel agent by calling `GlobalOpenTelemetry.get()`. – JackB Apr 26 '23 at 19:09

0 Answers0