@@ -69,26 +69,6 @@ if [[ ! -e "${CONF}/hugegraph-server.keystore" ]]; then
69
69
download " ${CONF} " " ${GITHUB} /apache/hugegraph-doc/raw/binary-1.0/dist/server/hugegraph-server.keystore"
70
70
fi
71
71
72
- if [ " ${OPEN_TELEMETRY} " == " true" ]; then
73
- OT_JAR=" opentelemetry-javaagent.jar"
74
- if [[ ! -e " ${PLUGINS} /${OT_JAR} " ]]; then
75
- echo " Downloading ${OT_JAR} ..."
76
- download " ${PLUGINS} " \
77
- " ${GITHUB} /open-telemetry/opentelemetry-java-instrumentation/releases/download/v2.1.0/${OT_JAR} "
78
- fi
79
-
80
- export JAVA_TOOL_OPTIONS=" -javaagent:${PLUGINS} /${OT_JAR} "
81
- export OTEL_TRACES_EXPORTER=otlp
82
- export OTEL_METRICS_EXPORTER=none
83
- export OTEL_LOGS_EXPORTER=none
84
- export OTEL_EXPORTER_OTLP_TRACES_PROTOCOL=grpc
85
- # 127.0.0.1:4317 is the port of otel-collector running in Docker located in
86
- # 'hugegraph-server/hugegraph-dist/docker/example/docker-compose-trace.yaml'.
87
- # Make sure the otel-collector is running before starting HugeGraphServer.
88
- export OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://127.0.0.1:4317
89
- export OTEL_RESOURCE_ATTRIBUTES=service.name=server
90
- fi
91
-
92
72
# Add the slf4j-log4j12 binding
93
73
CP=$( find -L $LIB -name ' log4j-slf4j-impl*.jar' | sort | tr ' \n' ' :' )
94
74
# Add the jars in lib that start with "hugegraph"
@@ -99,7 +79,7 @@ CP="$CP":$(find -L $LIB -name '*.jar' \
99
79
\! -name ' log4j-slf4j-impl*.jar' | sort | tr ' \n' ' :' )
100
80
# Add the jars in ext (at any subdirectory depth)
101
81
CP=" $CP " :$( find -L $EXT -name ' *.jar' | sort | tr ' \n' ' :' )
102
- # Add the jars in plugins (at any subdirectory depth)
82
+ # Add the jars in plugins (at any subdirectory depth), check "javaagent" related jars carefully
103
83
CP=" $CP " :$( find -L $PLUGINS -name ' *.jar' | sort | tr ' \n' ' :' )
104
84
105
85
# (Cygwin only) Use ; classpath separator and reformat paths for Windows ("C:\foo")
@@ -171,6 +151,27 @@ if [[ ${OPEN_SECURITY_CHECK} == "true" ]]; then
171
151
JVM_OPTIONS=" ${JVM_OPTIONS} -Djava.security.manager=org.apache.hugegraph.security.HugeSecurityManager"
172
152
fi
173
153
154
+ if [ " ${OPEN_TELEMETRY} " == " true" ]; then
155
+ OT_JAR=" opentelemetry-javaagent.jar"
156
+ if [[ ! -e " ${PLUGINS} /${OT_JAR} " ]]; then
157
+ echo " ## Downloading ${OT_JAR} ..."
158
+ download " ${PLUGINS} " \
159
+ " ${GITHUB} /open-telemetry/opentelemetry-java-instrumentation/releases/download/v2.1.0/${OT_JAR} "
160
+ fi
161
+
162
+ # Note: check carefully if multi "javeagent" params are set
163
+ export JAVA_TOOL_OPTIONS=" -javaagent:${PLUGINS} /${OT_JAR} "
164
+ export OTEL_TRACES_EXPORTER=otlp
165
+ export OTEL_METRICS_EXPORTER=none
166
+ export OTEL_LOGS_EXPORTER=none
167
+ export OTEL_EXPORTER_OTLP_TRACES_PROTOCOL=grpc
168
+ # 127.0.0.1:4317 is the port of otel-collector running in Docker located in
169
+ # 'hugegraph-server/hugegraph-dist/docker/example/docker-compose-trace.yaml'.
170
+ # Make sure the otel-collector is running before starting HugeGraphServer.
171
+ export OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://127.0.0.1:4317
172
+ export OTEL_RESOURCE_ATTRIBUTES=service.name=server
173
+ fi
174
+
174
175
# Turn on security check
175
176
exec ${JAVA} -Dname=" HugeGraphServer" ${JVM_OPTIONS} ${JAVA_OPTIONS} -cp ${CLASSPATH} : \
176
177
org.apache.hugegraph.dist.HugeGraphServer ${GREMLIN_SERVER_CONF} ${REST_SERVER_CONF} \
0 commit comments