chaitalicod commented on code in PR #630:
URL: https://github.com/apache/atlas/pull/630#discussion_r4677711094
##########
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()
Review Comment:
The port is passed through without validation, so a value like abc only
fails inside the agent at runtime. Please check it is an integer between 1 and
65535 and fail with a clear message.
##########
webapp/pom.xml:
##########
@@ -554,6 +581,13 @@
<directory>${project.build.directory}/api/v2/apidocs/ui</directory>
<targetPath>apidocs</targetPath>
</resource>
+ <resource>
+
<directory>${project.build.directory}/otel-agent</directory>
Review Comment:
shipping it outside the webapp instead, for example as
${ATLAS_HOME}/otel/opentelemetry-javaagent.jar through the distro assembly
Since every war bigger and adds a large jar for Jetty to scan at startup.
Check if this can be considered
--
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]