From c64380625e62fd15a7f2b0a89206b19ba4cf3e0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81ngel=20Paredes?= Date: Tue, 10 Dec 2024 12:18:33 +0100 Subject: [PATCH] Update README.md --- README.md | 63 +++++++++++++++++++++++++++---------------------------- 1 file changed, 31 insertions(+), 32 deletions(-) diff --git a/README.md b/README.md index 5948ac7..bd55399 100644 --- a/README.md +++ b/README.md @@ -1,55 +1,54 @@ -# Datadog Test Optimization GitLab Script +# Datadog Test Optimization GitLab Script Bash script that installs and configures [Datadog Test Optimization](https://docs.datadoghq.com/tests/) for GitLab. -Supported languages are .NET, Java, Javascript, Python, and Ruby. +Supported languages are .NET, Java, Javascript, and Python. ## About Datadog Test Optimization -[Test Optimization](https://docs.datadoghq.com/tests/) provides a test-first view into your CI health by displaying important metrics and results from your tests. +[Test Optimization](https://docs.datadoghq.com/tests/) provides a test-first view into your CI health by displaying important metrics and results from your tests. It can help you investigate and mitigate performance problems and test failures that are most relevant to your work, focusing on the code you are responsible for, rather than the pipelines which run your tests. ## Usage Execute this script in your GitLab CI's job YAML before running the tests. Pass the languages, api key and [site](https://docs.datadoghq.com/getting_started/site/) environment variables: -```yaml -test_node: + ```yaml + test_node: image: node:latest script: - - LANGUAGES="js" SITE="datadoghq.com" API_KEY="YOUR_API_KEY_SECRET" source <(curl -Ls https://github.com/DataDog/test-visibility-gitlab-script/releases/download/v1.0.1/script.sh) - - npm run test -``` + - LANGUAGES="js" SITE="datadoghq.com" API_KEY="YOUR_API_KEY_SECRET" source <(curl -Ls https://github.com/DataDog/test-visibility-gitlab-script/releases/download/v1.0.1/script.sh) + - npm run test + ``` ## Configuration The script takes in the following environment variables: -| Name | Description | Required | Default | -| ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | ------------- | -| LANGUAGES | List of languages to be instrumented. Can be either "all" or any of "java", "js", "python", "dotnet", "ruby" (multiple languages can be specified as a space-separated list). | true | | -| API_KEY | Datadog API key. Can be found at https://app.datadoghq.com/organization-settings/api-keys | true | | -| SITE | Datadog site. See https://docs.datadoghq.com/getting_started/site for more information about sites. | false | datadoghq.com | -| SERVICE | The name of the service or library being tested. | false | | -| DOTNET_TRACER_VERSION | The version of Datadog .NET tracer to use. Defaults to the latest release. | false | | -| JAVA_TRACER_VERSION | The version of Datadog Java tracer to use. Defaults to the latest release. | false | | -| JS_TRACER_VERSION | The version of Datadog JS tracer to use. Defaults to the latest release. | false | | -| PYTHON_TRACER_VERSION | The version of Datadog Python tracer to use. Defaults to the latest release. | false | | -| RUBY_TRACER_VERSION | The version of datadog-ci gem to use. Defaults to the latest release. | false | | -| JAVA_INSTRUMENTED_BUILD_SYSTEM | If provided, only the specified build systems will be instrumented (allowed values are `gradle`,`maven`,`sbt`,`ant`,`all`). `all` is a special value that instruments every Java process. If this property is not provided, all known build systems will be instrumented (Gradle, Maven, SBT, Ant). | false | | +| Name | Description | Required | Default | +| ---- | ----------- | -------- | ------- | + | LANGUAGES | List of languages to be instrumented. Can be either "all" or any of "java", "js", "python", "dotnet" (multiple languages can be specified as a space-separated list). | true | | + | API_KEY | Datadog API key. Can be found at https://app.datadoghq.com/organization-settings/api-keys | true | | + | SITE | Datadog site. See https://docs.datadoghq.com/getting_started/site for more information about sites. | false | datadoghq.com | + | SERVICE | The name of the service or library being tested. | false | | + | DOTNET_TRACER_VERSION | The version of Datadog .NET tracer to use. Defaults to the latest release. | false | | + | JAVA_TRACER_VERSION | The version of Datadog Java tracer to use. Defaults to the latest release. | false | | + | JS_TRACER_VERSION | The version of Datadog JS tracer to use. Defaults to the latest release. | false | | + | PYTHON_TRACER_VERSION | The version of Datadog Python tracer to use. Defaults to the latest release. | false | | + | JAVA_INSTRUMENTED_BUILD_SYSTEM | If provided, only the specified build systems will be instrumented (allowed values are `gradle`,`maven`,`sbt`,`ant`,`all`). `all` is a special value that instruments every Java process. If this property is not provided, all known build systems will be instrumented (Gradle, Maven, SBT, Ant). | false | | ### Additional configuration Any [additional configuration values](https://docs.datadoghq.com/tracing/trace_collection/library_config/) can be added directly to the job that runs your tests: ```yaml -test_node: + test_node: image: node:latest script: - - export DD_API_KEY="YOUR_API_KEY_SECRET" - - export DD_ENV="staging-tests" - - export DD_TAGS="layer:api,team:intake,key:value" - - LANGUAGES="js" SITE="datad0g.com" source <(curl -Ls https://github.com/DataDog/test-visibility-gitlab-script/releases/download/v1.0.1/script.sh) - - npm run test + - export DD_API_KEY="YOUR_API_KEY_SECRET" + - export DD_ENV="staging-tests" + - export DD_TAGS="layer:api,team:intake,key:value" + - LANGUAGES="js" SITE="datad0g.com" source <(curl -Ls https://github.com/DataDog/test-visibility-gitlab-script/releases/download/v1.0.1/script.sh) + - npm run test ``` ## Limitations @@ -60,14 +59,14 @@ test_node: To use this script with vitest you need to modify the NODE_OPTIONS environment variable adding the `--import` flag with the value of the `DD_TRACE_ESM_IMPORT` environment variable. -```yaml -test_node_vitest: + ```yaml + test_node_vitest: image: node:latest script: - - LANGUAGES="js" SITE="datadoghq.com" API_KEY="YOUR_API_KEY_SECRET" source <(curl -Ls https://github.com/DataDog/test-visibility-gitlab-script/releases/download/v1.0.1/script.sh) - - export NODE_OPTIONS="$NODE_OPTIONS --import $DD_TRACE_ESM_IMPORT" - - npm run test -``` + - LANGUAGES="js" SITE="datadoghq.com" API_KEY="YOUR_API_KEY_SECRET" source <(curl -Ls https://github.com/DataDog/test-visibility-gitlab-script/releases/download/v1.0.1/script.sh) + - export NODE_OPTIONS="$NODE_OPTIONS --import $DD_TRACE_ESM_IMPORT" + - npm run test + ``` **Important**: `vitest` and `dd-trace` require Node.js>=18.19 or Node.js>=20.6 to work together.