Skip to content

Add spans for each job in a pipeline being traced

Reuben Pereira requested to merge rp/tracing-jobs into master

What does this MR do and why?

Describe in detail what your merge request does and why.

When tracing a pipeline, add a span for each job.

This MR adds a new class ProcessJobs that creates a span for each job in a pipeline.

Testing procedure

  1. 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
  2. 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}
  3. 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

Merge request reports