achandel-01 commented on code in PR #630:
URL: https://github.com/apache/atlas/pull/630#discussion_r4704145943
##########
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:
Added explicit JVM system properties in atlas_start.py when the agent is
enabled:
-Dotel.traces.exporter=none
-Dotel.logs.exporter=none
so only the Prometheus metrics exporter is active (no default OTLP export to
localhost:4318).
--
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]