Add rake task and service to trace pipelines
What does this MR do and why?
Describe in detail what your merge request does and why.
- Add
PipelineTracer::Service
class to trace a pipeline.- Create a root span.
- Trace bridge jobs.
- Add a new rakefile and rake task to trace a pipeline given a pipeline URL.
Testing procedure
-
Start an opentelemetry collector (taken from https://opentelemetry.io/docs/instrumentation/ruby/getting-started/#exporting-traces):
git clone git@github.com:open-telemetry/opentelemetry-ruby.git; \ cd opentelemetry-ruby/examples/otel-collector; \ docker-compose up
-
Run the trace rake task:
OTEL_EXPORTER_OTLP_ENDPOINT='http://localhost:4318' RELEASE_BOT_DEV_TOKEN='token' RELEASE_BOT_OPS_TOKEN='token' bundle exec rake 'trace:pipeline_url[https://ops.gitlab.net/gitlab-org/release/tools/-/pipelines/1634983,deployment pipelines]'
A few lines should appear in the terminal where the opentelemetry collector is running:
otel-collector_1 | 2023-01-02T11:21:58.975Z INFO loggingexporter/logging_exporter.go:41 TracesExporter {"#spans": 6} otel-collector_1 | 2023-01-02T11:22:00.581Z INFO loggingexporter/logging_exporter.go:41 TracesExporter {"#spans": 5}
-
Open http://localhost:16686/search?end=1672495440000000&limit=20&lookback=custom&service=deployment%20pipelines&start=1672165800000000 and view the traces. The trace will only contain 11 spans since we are only tracing the bridge jobs currently.
gitlab-com/gl-infra/delivery#2722 (closed)
Author Check-list
-
Has documentation been updated?
Edited by Reuben Pereira