feat: Track LS startup with OpenTelemetry

Description

Adds OpenTelemetry (OTel) tracing and metrics to the Language Server startup monitor, following the suggestion in #2284 (closed) to use OTel instead of Snowplow for engineering insights.

I've tested different startup times on prod and we have some data coming to GitLab observability dashboard https://gitlab.com/groups/gitlab-org/-/observability/services. Select gitlab-vscode-extension in the list. The charts are default but I'll see how to configure them better for our purporses.

Screenshot_2026-05-21_at_23.13.12

OTel resource attributes (set once for all spans/metrics)

ide_name, ide_vendor, ide_version, extension_name, extension_version, os, remote_name

ls.startup span attributes (per startup event)

Mirrors the existing Snowplow payload exactly: status, failed_phase, spawn_duration_ms, handshake_duration_ms, total_duration_ms, restart_attempts

ls.startup.duration histogram (per startup event)

Records total startup duration in ms with attributes: status, failed_phase, remote_name

Configuration

OTel is enabled when vscode.env.isTelemetryEnabled is true, same as Snowplow. The OTLP endpoint defaults to a hardcoded base URL and can be overridden via VS Code setting gitlab.telemetry.otlpEndpointUrl for local testing.

How to test locally

Traces only - Jaeger

Jaeger is an open-source distributed tracing UI that accepts OTLP data and lets you visualise spans in a browser.

  1. Start Jaeger locally (exposes OTLP HTTP on port 4318 and the UI on port 16686):
    docker run -p 16686:16686 -p 4318:4318 jaegertracing/all-in-one
  2. Override the OTLP base URL in your VS Code settings.json:
    "gitlab.telemetry.otlpEndpointUrl": "http://localhost:4318"
  3. Launch the extension (F5) and let the Language Server start up.
  4. Open the Jaeger UI at http://localhost:16686, select the gitlab-vscode-extension service, and click Find Traces to see the ls.startup span with all attributes.

Traces and metrics - Grafana LGTM

Grafana LGTM is an all-in-one Docker image that accepts OTLP for both traces and metrics, and provides a Grafana UI to visualise them.

  1. Start the Grafana LGTM container (exposes OTLP HTTP on port 4318 and the Grafana UI on port 3000):
    docker run -d --name grafana-lgtm -p 3000:3000 -p 4318:4318 grafana/otel-lgtm
  2. Override the OTLP base URL in your VS Code settings.json:
    "gitlab.telemetry.otlpEndpointUrl": "http://localhost:4318"
  3. Launch the extension (F5) and let the Language Server start up.
  4. Open Grafana at http://localhost:3000 (admin/admin).
    • Traces: Explore → Tempo → select gitlab-vscode-extension service → find the ls.startup span with all attributes.
    • Metrics: Explore → Prometheus → query ls_startup_duration to see the histogram.

References #2284 (closed)

What CHANGELOG entry will this MR create?

  • fix: Bug fix fixes - a user-facing issue in production - included in changelog
  • feature: New feature - a user-facing change which adds functionality - included in changelog
  • BREAKING CHANGE: (fix or feature that would cause existing functionality to change) - should bump major version, mentioned in the changelog
  • None - other non-user-facing changes
Edited by Olena Horal-Koretska

Merge request reports

Loading
Loading