Skip to content

metricReaders is not auto configured by java agent while passing property otel.metrics.exporter through configuration file #12735

@vijaybtech13

Description

@vijaybtech13

Describe the bug

metricReaders object was not auto configured when passing otel.metrics.exporter property through configuration file(otel.properties). Since metricReaders was not configured metrics generation and export did not happen.

However, while passing as environment variable (OTEL_METRICS_EXPORTER=otlp) solved this issue. Why was the config file approach not worked?

java-agent-auto-configuration-log.txt

Steps to reproduce

  1. Have otel java agent properties in configuration file. (otel.properties)
  2. Pass the configuration file to spring boot application using env variable OTEL_JAVAAGENT_CONFIGURATION_FILE through docker compose file.
  3. Bring up the spring boot application.
**otel.properties**
otel.service.name=test-service
otel.exporter.otlp.protocol=grpc
otel.exporter.otlp.endpoint=http://collector:4317
otel.traces.exporter=otlp
otel.metrics.exporter=otlp
otel.logs.exporter=none
**Docker-compose file: [ only environment section ]**
 "environment": {
"OTEL_JAVAAGENT_CONFIGURATION_FILE": "otel.properties-file-path",
"OTEL_JAVAAGENT_ENABLED": "true"
}

Expected behavior

metricReaders should be auto configured. Metrics should be generated and exported to configured collector.

Auto configured metricReaders [ expected ]
metricReaders=[PeriodicMetricReader{exporter=OtlpGrpcMetricExporter{exporterName=otlp, type=metric, endpoint=https://collector:4317, endpointPath=/opentelemetry.proto.collector.metrics.v1.MetricsService/Export, timeoutNanos=10000000000, connectTimeoutNanos=10000000000, compressorEncoding=null, headers=Headers{User-Agent=OBFUSCATED}

Actual behavior

metricReaders was not auto configured by java-agent. Metrics were not generated and exported to configured collector.

Auto configured metricReaders [ actual ]
metricReaders=[]

Javaagent or library instrumentation version

opentelemetry-java-instrumentation/releases/tag/v2.9.0

Environment

JDK: process.runtime.description="BellSoft OpenJDK 64-Bit Server VM 17.0.13+12-LTS", process.runtime.name="OpenJDK Runtime Environment", process.runtime.version="17.0.13+12-LTS",

OS: os.description="Linux 5.15.0-1066-aws", os.type="linux",

Spring boot: 3.3.2

Additional context

  1. Javaagent was added into application image using Paketo Buildpack for OpenTelemetry 2.5.0.
  2. Issue was observed only for metrics generation and export. Trace generation and export worked properly with the configured property - otel.metrics.exporter.
  3. Issue had been solved, after setting environment variable OTEL_METRICS_EXPORTER=otlp.

What is expected from this bug?

  1. Why environment variable OTEL_METRICS_EXPORTER is required to configure metricReaders by java agent, when property was passed through configuration file?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingneeds triageNew issue that requires triage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions