open-telemetry / opentelemetry-collector

OpenTelemetry Collector
https://opentelemetry.io
Apache License 2.0
4.45k stars 1.47k forks source link

Metrics get exposed to opentelemetry-collector with zero values via otlp grpc #3622

Closed goto1134 closed 3 years ago

goto1134 commented 3 years ago

This issue continues the discussion in https://github.com/open-telemetry/opentelemetry-java-instrumentation/issues/3568 Describe the bug Opentelemetry metrics are exposed to opentelemetry-collector from java-instrumentation with zero values.

Steps to reproduce Instrument a java-project with metrics otlp exporter Setup opentelemetry-collector with the following config:

receivers:
  otlp:
    protocols:
      grpc:

exporters:
  prometheus:
    endpoint: "0.0.0.0:8889"
  logging:
    logLevel: debug

processors:
  batch:

service:
  pipelines:
    metrics:
      receivers: [otlp]
      processors: [batch]
      exporters: [logging, prometheus]

What did you expect to see? all metrics get exposed to the prometheus endpoint with non-zero values What did you see instead? all metcics get exposed to prometheus, but all of them are zeros

# HELP runtime_jvm_gc_count The number of collections that have occurred for a given JVM garbage collector.
# TYPE runtime_jvm_gc_count counter
runtime_jvm_gc_count 0
# HELP runtime_jvm_gc_time Time spent in a given JVM garbage collector in milliseconds.
# TYPE runtime_jvm_gc_time counter
runtime_jvm_gc_time 0
# HELP runtime_jvm_memory_area Bytes of a given JVM memory area.
# TYPE runtime_jvm_memory_area gauge
runtime_jvm_memory_area 0
# HELP runtime_jvm_memory_pool Bytes of a given JVM memory pool.
# TYPE runtime_jvm_memory_pool gauge
runtime_jvm_memory_pool 0

What version are you using? opentelemetry-java-instrumentation: 1.3.1 opentelemetry-collector: 0.29.0

Environment Compiler: "AdoptOpenJDK 15.0.0" OS: "Mac OS Big Sur"

Additional context When I setup metrics exporter to logging via -Dotel.metrics.exporter=logging java property, I see non-zero values in my program logs.

As I see in logs, all the metrics are received by the collector as zeros:

2021-07-14T10:37:23.678Z    DEBUG   loggingexporter/logging_exporter.go:63  ResourceMetrics #0
Resource labels:
     -> host.arch: STRING(x86_64)
     -> host.name: STRING(macbook-a.efanov)
     -> os.description: STRING(Mac OS X 10.16)
     -> os.type: STRING(darwin)
     -> process.command_line: STRING(/Users/RenameMe/.sdkman/candidates/java/15.0.0.hs-adpt:bin:java -javaagent:engine-server/agents/opt/opentelemetry/opentelemetry-javaagent-all.jar -Dopentelemetry-agent-path=/Users/RenameMe/Projects/tinkoff/helicopter-engine/engine-server/agents/opt/opentelemetry/opentelemetry-javaagent-all.jar -XX:TieredStopAtLevel=1 -Xverify:none -Dspring.output.ansi.enabled=always -javaagent:/Users/RenameMe/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/211.7628.21/IntelliJ IDEA.app/Contents/lib/idea_rt.jar=52677:/Users/RenameMe/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/211.7628.21/IntelliJ IDEA.app/Contents/bin -Dcom.sun.management.jmxremote -Dspring.jmx.enabled=true -Dspring.liveBeansView.mbeanDomain -Dspring.application.admin.enabled=true -Dfile.encoding=UTF-8)
     -> process.executable.path: STRING(/Users/RenameMe/.sdkman/candidates/java/15.0.0.hs-adpt:bin:java)
     -> process.pid: INT(21370)
     -> process.runtime.description: STRING(AdoptOpenJDK OpenJDK 64-Bit Server VM 15+36)
     -> process.runtime.name: STRING(OpenJDK Runtime Environment)
     -> process.runtime.version: STRING(15+36)
     -> service.name: STRING(helicopter-engine)
     -> telemetry.auto.version: STRING(1.3.1)
     -> telemetry.sdk.language: STRING(java)
     -> telemetry.sdk.name: STRING(opentelemetry)
     -> telemetry.sdk.version: STRING(1.3.0)
InstrumentationLibraryMetrics #0
InstrumentationLibrary io.opentelemetry.javaagent.shaded.instrumentation.runtimemetrics.MemoryPools 
Metric #0
Descriptor:
     -> Name: runtime.jvm.memory.pool
     -> Description: Bytes of a given JVM memory pool.
     -> Unit: By
     -> DataType: DoubleSum
     -> IsMonotonic: false
     -> AggregationTemporality: AGGREGATION_TEMPORALITY_CUMULATIVE
DoubleDataPoints #0
StartTimestamp: 2021-07-14 10:32:23.065571 +0000 UTC
Timestamp: 2021-07-14 10:37:23.497083 +0000 UTC
Value: 0.000000
DoubleDataPoints #1
StartTimestamp: 2021-07-14 10:32:23.065571 +0000 UTC
Timestamp: 2021-07-14 10:37:23.497083 +0000 UTC
Value: 0.000000
DoubleDataPoints #2
StartTimestamp: 2021-07-14 10:32:23.065571 +0000 UTC
Timestamp: 2021-07-14 10:37:23.497083 +0000 UTC
Value: 0.000000
DoubleDataPoints #3
StartTimestamp: 2021-07-14 10:32:23.065571 +0000 UTC
Timestamp: 2021-07-14 10:37:23.497083 +0000 UTC
Value: 0.000000
DoubleDataPoints #4
StartTimestamp: 2021-07-14 10:32:23.065571 +0000 UTC
Timestamp: 2021-07-14 10:37:23.497083 +0000 UTC
Value: 0.000000
DoubleDataPoints #5
StartTimestamp: 2021-07-14 10:32:23.065571 +0000 UTC
Timestamp: 2021-07-14 10:37:23.497083 +0000 UTC
Value: 0.000000
DoubleDataPoints #6
StartTimestamp: 2021-07-14 10:32:23.065571 +0000 UTC
Timestamp: 2021-07-14 10:37:23.497083 +0000 UTC
Value: 0.000000
DoubleDataPoints #7
StartTimestamp: 2021-07-14 10:32:23.065571 +0000 UTC
Timestamp: 2021-07-14 10:37:23.497083 +0000 UTC
Value: 0.000000
DoubleDataPoints #8
StartTimestamp: 2021-07-14 10:32:23.065571 +0000 UTC
Timestamp: 2021-07-14 10:37:23.497083 +0000 UTC
Value: 0.000000
DoubleDataPoints #9
StartTimestamp: 2021-07-14 10:32:23.065571 +0000 UTC
Timestamp: 2021-07-14 10:37:23.497083 +0000 UTC
Value: 0.000000
DoubleDataPoints #10
StartTimestamp: 2021-07-14 10:32:23.065571 +0000 UTC
Timestamp: 2021-07-14 10:37:23.497083 +0000 UTC
Value: 0.000000
DoubleDataPoints #11
StartTimestamp: 2021-07-14 10:32:23.065571 +0000 UTC
Timestamp: 2021-07-14 10:37:23.497083 +0000 UTC
Value: 0.000000
DoubleDataPoints #12
StartTimestamp: 2021-07-14 10:32:23.065571 +0000 UTC
Timestamp: 2021-07-14 10:37:23.497083 +0000 UTC
Value: 0.000000
DoubleDataPoints #13
StartTimestamp: 2021-07-14 10:32:23.065571 +0000 UTC
Timestamp: 2021-07-14 10:37:23.497083 +0000 UTC
Value: 0.000000
DoubleDataPoints #14
StartTimestamp: 2021-07-14 10:32:23.065571 +0000 UTC
Timestamp: 2021-07-14 10:37:23.497083 +0000 UTC
Value: 0.000000
DoubleDataPoints #15
StartTimestamp: 2021-07-14 10:32:23.065571 +0000 UTC
Timestamp: 2021-07-14 10:37:23.497083 +0000 UTC
Value: 0.000000
DoubleDataPoints #16
StartTimestamp: 2021-07-14 10:32:23.065571 +0000 UTC
Timestamp: 2021-07-14 10:37:23.497083 +0000 UTC
Value: 0.000000
DoubleDataPoints #17
StartTimestamp: 2021-07-14 10:32:23.065571 +0000 UTC
Timestamp: 2021-07-14 10:37:23.497083 +0000 UTC
Value: 0.000000
Metric #1
Descriptor:
     -> Name: runtime.jvm.memory.area
     -> Description: Bytes of a given JVM memory area.
     -> Unit: By
     -> DataType: DoubleSum
     -> IsMonotonic: false
     -> AggregationTemporality: AGGREGATION_TEMPORALITY_CUMULATIVE
goto1134 commented 3 years ago

@jkwatson suspects that the otel grpc protocol version is outdated in opentelemetry-collector, so the data gets lost and the default zero values get received and exposed.

bogdandrutu commented 3 years ago

This is a duplicate of https://github.com/open-telemetry/opentelemetry-collector/issues/3602