open-telemetry / opentelemetry-java-instrumentation

OpenTelemetry auto-instrumentation and instrumentation libraries for Java
https://opentelemetry.io
Apache License 2.0
1.88k stars 823 forks source link

How to pass parameters to OpenTelemetry's Java agent in attach mode? #8877

Closed shenlvcheng closed 1 year ago

shenlvcheng commented 1 year ago

How to pass parameters to OpenTelemetry's Java agent in attach mode? I noticed that the first parameter agentArgs in the premain(String agentArgs, Instrumentation inst) method of the source code has been discarded. Why was it discarded, which is preventing me from passing parameters into the Java agent?

laurit commented 1 year ago

Opentelemetry java agent does not use arguments passed to premain or agentmain we instead use system properties and environment variables to pass configuration to the agent. If you are using runtime attach you can set the system properties via System.setProperty(...) before attaching the agent.

github-actions[bot] commented 1 year ago

This has been automatically marked as stale because it has been marked as needing author feedback and has not had any activity for 7 days. It will be closed if no further activity occurs within 7 days of this comment.