Report a custom span to Datadog with name, start and end time (or duration), tags, and measures.
datadog-ci trace span [--name <name>] [--start-time <ms>] [--end-time <ms>] [--duration <ms>] [--tags] [--measures] [--dry-run]For example:
datadog-ci trace span --name "Say Hello" --duration 800 --tags responded-hello-too:true--nameis a human-readable name for the reported span.--start-timethe span start time in milliseconds since the unix epoch (UTC).--end-timethe span end time in milliseconds since the unix epoch (UTC).--durationis the duration of the span in milliseconds. If duration is provided instead of--start-timeand--end-time, the span end time is the current time when executing this command. This method is less precise than using start and end times since launching the datadog-ci process requires some time.--tagsis an array of key-value pairs with the formatkey:value. These tags are added to the custom span. The resulting dictionary is merged with the contents of theDD_TAGSenvironment variable. If akeyappears both in--tagsandDD_TAGS, the value inDD_TAGStakes precedence.--measuresis an array of key-value pairs with the formatkey:value. These measures are added to the custom span. Thevaluemust be a number.--dry-run(default:false) runs the command without sending the custom span. All other checks are performed.
The DD_API_KEY environment variable is required for the span command. You can also set tags and the Datadog site:
DD_API_KEY(required): API key used to authenticate the requests.DD_TAGS: Global tags applied to all spans. The format must bekey1:value1,key2:value2.DD_SITE: Your Datadog site'ssite parametervalue, for example, datadoghq.com or datadoghq.eu.
gitis used for extracting repository metadata.
To verify this command works as expected, run it with the dry-run option enabled, and validate that it returns 0:
export DD_API_KEY='<API key>'
export CIRCLECI=true
GITLAB_CI=1 yarn launch trace span --name hello --duration 618 --dry-runAdditional helpful documentation, links, and articles: