datadog-ci
datadog-ci copied to clipboard
Add 'trace' command support for Gitlab
Feature request description
Currently, the trace
command only supports CircleCI and Jenkins. We use self-managed Gitlab and I would love to be able to see our custom commands in the flame graph from the CI Pipeline Executions page.
Solution
The following should be successful:
echo $GITLAB_CI # emits "true"
datadog-ci trace --name 'My custom command' -- command arg1 arg2
Additional context
We have several complex build jobs that have individual tasks. We have instrumented timing of these with custom metrics, but we don't have a way to include the timing in the flame graph on the CI pipeline executions detail pages in Datadog. It seems it would be straightforward to add support within this tool, but it's not clear to me if the server side requires additional work to support custom trace data.
Command
trace
Unfortunately we have some stateful details that are not available until the Gitlab pipeline finishes.
It's related to how we splits retries into separate flame graphs. For the trace command we need the ID that identifies the flame graph and this does not exist yet at the point where the command runs from within the Gitlab job.
In short we don't have a solution to this so far. Sorry
@AdrianLC Between GITHUB_RUN_ID and GITHUB_RUN_ATTEMPT, is there enough detail to implement the trace command for Github, and should I create another issue to track that?
https://docs.github.com/en/actions/learn-github-actions/variables#default-environment-variables