Skip to content

Commit 5094866

Browse files
Do not instrument every JVM by default (#10)
1 parent 0a5e6c5 commit 5094866

File tree

3 files changed

+17
-5
lines changed

3 files changed

+17
-5
lines changed

.gitlab-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ variables:
55
AWS_MAX_ATTEMPTS: 5 # retry AWS operations 5 times if they fail on network errors
66
DATADOG_AGENT_BUILDERS: v9930706-ef9d493
77
S3_CP_CMD: aws s3 cp --only-show-errors --region us-east-1 --sse AES256
8-
SCRIPT_VERSION: 2
8+
SCRIPT_VERSION: 3
99

1010
deploy:
1111
image: 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/datadog-agent-builders/gitlab_agent_deploy:$DATADOG_AGENT_BUILDERS

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ The script parameters are
2626
- `DD_SET_TRACER_VERSION_JAVA`: (optional) Version of the Java tracer to install (without the `v` prefix, e.g. `1.37.1`). If not provided, the latest version is installed.
2727
- `DD_SET_TRACER_VERSION_JS`: (optional) Version of the JS tracer to install. If not provided, the latest version is installed.
2828
- `DD_SET_TRACER_VERSION_PYTHON`: (optional) Version of the Python tracer to install. If not provided, the latest version is installed.
29-
- `DD_INSTRUMENTATION_BUILD_SYSTEM_JAVA`: (optional) A hint for Java instrumentation to instrument a specific build system. Allowed values are `maven` and `gradle`. If not specified, all Java processes will be instrumented.
29+
- `DD_INSTRUMENTATION_BUILD_SYSTEM_JAVA`: (optional) A hint for Java instrumentation to instrument a specific build system. Allowed values are `maven`, `gradle`, `sbt`, `ant`, and `all`. If not specified, every Maven, Gradle, SBT, and Ant build will be instrumented. `all` is a special value that allows instrumenting _every JVM process_.
3030

3131
The script will install the libraries and print the list of environment variables that should be set in order to enable Test Visibility. Example output:
3232
```shell

install_test_visibility.sh

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,13 @@ install_java_tracer() {
4040
maven)
4141
echo "MAVEN_OPTS=-javaagent:$filepath_tracer $MAVEN_OPTS"
4242
;;
43-
*)
43+
sbt)
44+
echo "SBT_OPTS=-javaagent:$filepath_tracer SBT_OPTS"
45+
;;
46+
ant)
47+
echo "ANT_OPTS=-javaagent:$filepath_tracer ANT_OPTS"
48+
;;
49+
all)
4450
local updated_java_tool_options="-javaagent:$filepath_tracer $JAVA_TOOL_OPTIONS"
4551
if [ ${#updated_java_tool_options} -le 1024 ]; then
4652
echo "JAVA_TOOL_OPTIONS=$updated_java_tool_options"
@@ -49,6 +55,12 @@ install_java_tracer() {
4955
return 1
5056
fi
5157
;;
58+
*)
59+
echo "GRADLE_OPTS=-Dorg.gradle.jvmargs=-javaagent:$filepath_tracer $GRADLE_OPTS"
60+
echo "MAVEN_OPTS=-javaagent:$filepath_tracer $MAVEN_OPTS"
61+
echo "SBT_OPTS=-javaagent:$filepath_tracer $SBT_OPTS"
62+
echo "ANT_OPTS=-javaagent:$filepath_tracer $ANT_OPTS"
63+
;;
5264
esac
5365

5466
echo "DD_TRACER_VERSION_JAVA=$(command -v java >/dev/null 2>&1 && java -jar $filepath_tracer || unzip -p $filepath_tracer META-INF/MANIFEST.MF | grep -i implementation-version | cut -d' ' -f2)"
@@ -138,8 +150,8 @@ install_js_tracer() {
138150
echo "DD_TRACE_PACKAGE=$dd_trace_ci_init_path"
139151
fi
140152
# We can't set the --import flag directly in NODE_OPTIONS since it's only compatible from Node.js>=20.6.0 and Node.js>=18.19,
141-
# not even if !is_github_actions.
142-
# Additionally, it's not useful for test frameworks other than vitest, which is ESM first.
153+
# not even if !is_github_actions.
154+
# Additionally, it's not useful for test frameworks other than vitest, which is ESM first.
143155
echo "DD_TRACE_ESM_IMPORT=$dd_trace_register_path"
144156

145157
echo "DD_TRACER_VERSION_JS=$(npm list -g dd-trace | grep dd-trace | awk -F@ '{print $2}')"

0 commit comments

Comments
 (0)