chaitalicod commented on code in PR #630:
URL: https://github.com/apache/atlas/pull/630#discussion_r4677696191
##########
distro/src/bin/atlas_start.py:
##########
@@ -28,12 +28,55 @@
DEFAULT_JVM_HEAP_OPTS="-Xmx1024m"
DEFAULT_JVM_OPTS="-Dlogback.configurationFile=atlas-logback.xml
-Djava.net.preferIPv4Stack=true -server"
+OTEL_JAVAAGENT_WEBINF_LIB_NAME = "opentelemetry-javaagent.jar"
+DEFAULT_OTEL_PROMETHEUS_PORT = "9464"
+
+
+def _truthy_env(val):
+ if val is None:
+ return True
+ return str(val).strip().lower() in ("1", "true", "yes", "on")
+
+
+def otel_javaagent_jvm_opts(web_app_dir):
+ """
+ Optional OpenTelemetry javaagent from expanded WEB-INF/lib (packaged in
atlas.war).
+ Enable with ATLAS_OTEL_JAVAAGENT_ENABLED (e.g. from Docker env); enabled
by default when unset.
+ """
+ if not _truthy_env(os.environ.get(mc.ATLAS_OTEL_JAVAAGENT_ENABLED)):
+ return []
+ jar_fs = os.path.join(web_app_dir, "atlas", "WEB-INF", "lib",
OTEL_JAVAAGENT_WEBINF_LIB_NAME)
+ if mc.isCygwin():
+ jar_for_java = mc.convertCygwinPath(jar_fs)
+ else:
+ jar_for_java = jar_fs
+ if not os.path.isfile(jar_fs):
+ raise RuntimeError(
+ "%s is true but agent JAR was not found at %s. "
+ "Ensure the web application was built with opentelemetry-javaagent
in WEB-INF/lib."
+ % (mc.ATLAS_OTEL_JAVAAGENT_ENABLED, jar_fs)
+ )
+ port = (os.environ.get(mc.ATLAS_OTEL_PROMETHEUS_PORT) or
DEFAULT_OTEL_PROMETHEUS_PORT).strip()
+ if not port:
+ port = DEFAULT_OTEL_PROMETHEUS_PORT
+ host = (os.environ.get(mc.ATLAS_OTEL_PROMETHEUS_HOST) or
"127.0.0.1").strip()
+ if not host:
+ host = "127.0.0.1"
+ return [
Review Comment:
Only the metrics exporter is configured. In the 2.x agent,
otel.traces.exporter and otel.logs.exporter default to otlp (sending to
localhost:4318). With no collector, the agent keeps retrying and logging export
failures, and it captures spans and log records for every request.
Could you also confirm that application.log shows no OTLP export errors when
the agent runs for a few minutes with no collector?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]