Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ProcessMetrics seems not worked in javaagent default behave, manually instrument works well. #5276

Closed
domyway opened this issue Jan 29, 2022 · 0 comments · Fixed by #5281
Closed

Comments

@domyway
Copy link

domyway commented Jan 29, 2022

my app start with

-javaagent:"/path/to/opentelemetry-javaagent-1.10.1.jar"
-Dotel.javaagent.debug=true
-Dserver.port=8180
-Dotel.metrics.exporter=otlp
-Dotel.exporter.otlp.endpoint="http://127.0.0.1:4317"
-Dotel.experimental.sdk.metrics.debug=true

my pom.xml

<parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.6.2</version>
        <relativePath/> <!-- lookup parent from repository -->
 </parent>

<dependency>
      <groupId>io.opentelemetry.instrumentation</groupId>
      <artifactId>opentelemetry-oshi</artifactId>
      <version>1.10.1-alpha</version>
  </dependency>
  <dependency>
      <groupId>com.github.oshi</groupId>
      <artifactId>oshi-core</artifactId>
      <version>5.3.1</version>
  </dependency>

my collector receive all the metrics like this

# HELP promexample_runtime_jvm_gc_count The number of collections that have occurred for a given JVM garbage collector.
# TYPE promexample_runtime_jvm_gc_count counter

# HELP promexample_runtime_jvm_gc_time Time spent in a given JVM garbage collector in milliseconds.
# TYPE promexample_runtime_jvm_gc_time counter

# HELP promexample_runtime_jvm_memory_area Bytes of a given JVM memory area.
# TYPE promexample_runtime_jvm_memory_area gauge
blabla
# HELP promexample_runtime_jvm_memory_pool Bytes of a given JVM memory pool.
# TYPE promexample_runtime_jvm_memory_pool gauge
blabla
# HELP promexample_system_disk_io System disk IO
# TYPE promexample_system_disk_io counter
blabla
# HELP promexample_system_disk_operations System disk operations
# TYPE promexample_system_disk_operations counter
blabla
# HELP promexample_system_memory_usage System memory usage
# TYPE promexample_system_memory_usage gauge
blabla
# HELP promexample_system_memory_utilization System memory utilization
# TYPE promexample_system_memory_utilization gauge
blabla
# HELP promexample_system_network_errors System network errors
# TYPE promexample_system_network_errors counter
blabla
# HELP promexample_system_network_io System network IO
# TYPE promexample_system_network_io counter
blabla
# HELP promexample_system_network_packets System network packets
# TYPE promexample_system_network_packets counter

ProcessMetrics is missing.

But When I disable the javaagent oshi, manually code like this :

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import io.opentelemetry.instrumentation.oshi.ProcessMetrics;
import io.opentelemetry.instrumentation.oshi.SystemMetrics;
@SpringBootApplication
public class DemoApplication {
    static {
        ProcessMetrics.registerObservers();
        SystemMetrics.registerObservers();
    }

    public static void main(String[] args) {
        SpringApplication.run(DemoApplication.class, args);
    }

}

and the add -Dotel.instrumentation.oshi.enabled=false

my collector receive the ProcessMetrics:

# HELP promexample_runtime_java_cpu_time Runtime Java CPU time
# TYPE promexample_runtime_java_cpu_time gauge
blabla
# HELP promexample_runtime_java_memory Runtime Java memory
# TYPE promexample_runtime_java_memory gauge
blabla
# HELP promexample_runtime_jvm_gc_count The number of collections that have occurred for a given JVM garbage collector.
# TYPE promexample_runtime_jvm_gc_count counter
blabla
# HELP promexample_runtime_jvm_gc_time Time spent in a given JVM garbage collector in milliseconds.
# TYPE promexample_runtime_jvm_gc_time counter
blabla
# HELP promexample_runtime_jvm_memory_area Bytes of a given JVM memory area.
# TYPE promexample_runtime_jvm_memory_area gauge
blabla
# HELP promexample_runtime_jvm_memory_pool Bytes of a given JVM memory pool.
# TYPE promexample_runtime_jvm_memory_pool gauge
blabla
# HELP promexample_system_disk_io System disk IO
# TYPE promexample_system_disk_io counter
blabla
# HELP promexample_system_disk_operations System disk operations
# TYPE promexample_system_disk_operations counter
blabla
# HELP promexample_system_memory_usage System memory usage
# TYPE promexample_system_memory_usage gauge
blabla
# HELP promexample_system_memory_utilization System memory utilization
# TYPE promexample_system_memory_utilization gauge
blabla
# HELP promexample_system_network_errors System network errors
# TYPE promexample_system_network_errors counter
blabla
# HELP promexample_system_network_io System network IO
# TYPE promexample_system_network_io counter
blabla
# HELP promexample_system_network_packets System network packets
# TYPE promexample_system_network_packets counter

and I do somethine wrong ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant