Open progxaker opened 9 months ago
hi @progxaker! the error you mention is only logged and shouldn't cause any other issues. can you provide the full applicationinsights.log
, and also include what exception your application startup is failing with? thx
Hi @trask. My bad, the error confused me and it's not related to the main problem.
shouldn't cause any other issues
That's what I thought too, but the main code doesn't execute.
can you provide the full
applicationinsights.log
what exception your application startup is failing with?
No exceptions at all :/ Latest logs:
2024-01-30 12:33:23.463Z INFO c.m.applicationinsights.agent - Java version: 17.0.10, vendor: Red Hat, Inc., home: /usr/lib/jvm/java-17-openjdk-17.0.10.0.7-2.el8.x86_64
/usr/lib/jvm/java-17/bin/java -cp /tmp/spark/conf/:/tmp/spark/jars/* -Xmx1g -XX:+IgnoreUnrecognizedVMOptions --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.nio=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.base/sun.nio.ch=ALL-UNNAMED --add-opens=java.base/sun.nio.cs=ALL-UNNAMED --add-opens=java.base/sun.security.action=ALL-UNNAMED --add-opens=java.base/sun.util.calendar=ALL-UNNAMED --add-opens=java.security.jgss/sun.security.krb5=ALL-UNNAMED -Djdk.reflect.useDirectMethodHandle=false org.apache.spark.deploy.SparkSubmit --master local[4] --conf spark.jars.ivy=/tmp/.ivy --class SimpleApp target/simple-project-1.0.jar
2024-01-30 12:33:23.513Z DEBUG i.o.s.m.export.PeriodicMetricReader - No metric data to export - skipping export.
I've prepared a Dockerfile to reproduce the problem more easily:
docker build -t reproduce-trace-issues:v1 .
docker run --env APPLICATIONINSIGHTS_CONNECTION_STRING="<real-connection-string>" --env APPLICATIONINSIGHTS_SELF_DIAGNOSTICS_LEVEL="DEBUG" reproduce-trace-issues:v1
(there will be a Lines:
line).docker run --env APPLICATIONINSIGHTS_CONNECTION_STRING="<real-connection-string>" --env APPLICATIONINSIGHTS_SELF_DIAGNOSTICS_LEVEL="TRACE" reproduce-trace-issues:v1
(no logs after No metric data to export
).While I'm trying to solve a higher priority problem via the CET, I tried to print the OpenTelemetry logs bypassing your configuration:
https://github.com/microsoft/ApplicationInsights-Java/blob/80f6eafba12454c9b59cc6f9e474e15d3c33c4fd/agent/agent-tooling/src/main/java/com/microsoft/applicationinsights/agent/internal/init/LoggingLevelConfigurator.java#L72-L76
and found that if the loggerLevel
value is changed to Level.TRACE
the problem is reproduced, if I set Level.INFO
the problem is solved. I hope this may be helpful.
- loggerLevel = getAtLeastInfoLevel(level);
+ loggerLevel = Level.TRACE;
- loggerLevel = getAtLeastInfoLevel(level);
+ loggerLevel = Level.INFO;
UPD: If add -Dotel.sdk.disabled=true
, the problem also went away.
Keep digging deeper into it.
TL;DR The problem occurs when the logger name starts with io.opentelemetry.sdk.metrics
but no deeper then io.opentelemetry.sdk.metrics.internal
.
I get a list of configured loggers
and started experimenting with io.opentelemetry.sdk.autoconfigure
, io.opentelemetry.sdk.metrics
and io.opentelemetry.sdk.resources
. As a result, I can set Level.All
for the autoconfigure
and resources
loggers, but if I set it for the metrics one, the problem is reproduced.
hi @progxaker, can you provide a runnable repro? (as a github repository would be easiest for us to consume and try it out)
Hi @trask. I've consolidated the shared files (LoggingLevelConfigurator.java
and the application's ones) in the progxaker/reproduce-trace-issues repository.
P.S. I tested the workaround for v3.4.19, but it doesn't work for v3.5.0.
As for v3.5.0, the problem occurs not only with the TRACE log level, but also with DEBUG.
hi @progxaker, I tried to run your repro locally but got error b/c I'm running on Windows. is there any chance you could simplify the repro, maybe along the lines of https://github.com/trask/apache-spark-extension-test? that would also make it easier for us to run in Intellij under a debugger (instead of having to remote debug inside of a docker image). thanks!
Hi @trask. I hope you're doing well.
Sorry for the long delay, been busy implementing OpenTelemetry (Python) into a project.
TL;DR:
The problem is reproduced when setting the JAVA_TOOL_OPTIONS
variable with the value -javaagent:<absolute-path-to-the-agent>
.
JAVA_TOOL_OPTIONS
variable
and used the spark.driver.extraJavaOptions
parameter instead.
Actually both of them gave the following error, but I got the final
when using spark.driver.extraJavaOptions
(I removed the tmpdir
parameter
and ran from the folder with the JVM agent).JAVA_TOOL_OPTIONS
on the Linux VM...
I did - the problem was reproduced.JAVA_TOOL_OPTIONS
, for some reason (and only on Windows) I get the following error:
# SET JAVA_TOOL_OPTIONS=-javaagent:applicationinsights-agent-3.5.1.jar
# spark-submit --class SimpleApp --master local[4] C:\Users\progxaker\Downloads\simple-project-1.0.jar
Picked up JAVA_TOOL_OPTIONS: "-javaagent:applicationinsights-agent-3.5.1.jar"
'2024-04-01' is not recognized as an internal or external command,
operable program or batch file.
As a result, the problem is reproducible on
I'll prepare a Windows version by the end of the day (~5 p.m. UTC).
Hello @trask. Have you had time to look at this?
Hello @trask. Are there any updates?
Hello team. Could you please tell if there are any updates?
Expected behavior
Don't fail a main application. Probably use
WARN
log level.Actual behavior
The enabled JVM agent with
TRACE
log level causes a Java application to fail.To Reproduce
-javagent:/path/to/application-insights-3.4.17.jar
).APPLICATIONINSIGHTS_SELF_DIAGNOSTICS_LEVEL
toTRACE
.System information
Please provide the following information:
Logs