open-telemetry / opentelemetry-java

OpenTelemetry Java SDK
https://opentelemetry.io
Apache License 2.0
2.02k stars 840 forks source link

Metric collection in ear deployment #6210

Closed suikast42 closed 9 months ago

suikast42 commented 9 months ago

Otel settings

SET JAVA_OPTS=%JAVA_OPTS% -javaagent:opentelemetry-javaagent.jar

REM SET OTEL_TRACES_EXPORTER=zipkin
REM SET OTEL_EXPORTER_ZIPKIN_ENDPOINT=http://172.42.1.20:9411/api/v2/spans
SET OTEL_TRACES_EXPORTER=jaeger
SET OTEL_EXPORTER_JAEGER_ENDPOINT=http://172.42.1.20:14250
SET OTEL_LOGS_EXPORTER=none
SET OTEL_METRICS_EXPORTER=none

SET OTEL_SERVICE_NAME=my-service
SET OTEL_RESOURCE_ATTRIBUTES=deployment.environment=dev,service.namespace=wms,service.version=1.0.0-SNAPSHOT,org.name=acme
SET OTEL_TRACES_SAMPLER=traceidratio
SET OTEL_TRACES_SAMPLER_ARG=1.0

I can instrument with that settings everything what I want to instrument but there is little asnnoying error every minute in the spans with that stack trace

"java.net.ConnectException: Connection refused: connect
    at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
    at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:85)
    at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
    at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
    at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
    at java.net.Socket.connect(Socket.java:589)
    at sun.net.NetworkClient.doConnect(NetworkClient.java:175)
    at sun.net.www.http.HttpClient.openServer(HttpClient.java:463)
    at sun.net.www.http.HttpClient.openServer(HttpClient.java:558)
    at sun.net.www.http.HttpClient.<init>(HttpClient.java:242)
    at sun.net.www.http.HttpClient.New(HttpClient.java:339)
    at sun.net.www.http.HttpClient.New(HttpClient.java:357)
    at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1220)
    at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1156)
    at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1050)
    at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:984)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1564)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1492)
    at io.jaegertracing.internal.utils.Http.makeGetRequest(Http.java:37)
    at io.jaegertracing.internal.samplers.HttpSamplingManager.getSamplingStrategy(HttpSamplingManager.java:61)
    at io.jaegertracing.internal.samplers.RemoteControlledSampler.updateSampler(RemoteControlledSampler.java:88)
    at io.jaegertracing.internal.samplers.RemoteControlledSampler$1.run(RemoteControlledSampler.java:70)
    at java.util.TimerThread.mainLoop(Timer.java:555)
    at java.util.TimerThread.run(Timer.java:505)

Somehow there is a jeager sampler active that try to interact with

http://localhost:5778/?service=my.ear%2521service-jsf-1.0.0-SNAPSHOT.war

This request done for every war deployment in the ear. There is something somewhere that tries to collect mterics from every war deployment in ear. How can I disale that ?

Environment WF 16 Ear deployment Oracle JDK 8u251 OS Windows 11

Additional context Add any other context about the problem here.

jack-berg commented 9 months ago

Hmm.. Nothing stands out from the environment variables and stack trace. It looks like you're running the otel java agent. Can you enable debug logging with -Dotel.javaagent.debug=true and find the log line that starts with:

DEBUG io.opentelemetry.sdk.autoconfigure.AutoConfiguredOpenTelemetrySdkBuilder - Global OpenTelemetry set to OpenTelemetrySdk{

This prints a string representation of OpenTelemetrySdk, which is useful for diagnosing these types of things.

suikast42 commented 9 months ago

This prints a string representation of OpenTelemetrySdk, which is useful for diagnosing these types of things.

There are lot of logs generated but nothing with logger io.opentelemetry.sdk.autoconfigure.AutoConfiguredOpenTelemetrySdkBuilder

trask commented 9 months ago

hi @suikast42, io.jaegertracing.internal.samplers.RemoteControlledSampler doesn't come from OpenTelemetry, maybe you are pulling that in from somewhere else?

suikast42 commented 9 months ago

hi @suikast42, io.jaegertracing.internal.samplers.RemoteControlledSampler doesn't come from OpenTelemetry, maybe you are pulling that in from somewhere else?

Jep you are right. I miss the wildfly internal stuff.

The wildfly modules 😒.

image

I will close this issue. Thanks a lot for your effort.