Sourcegraph DocsSourcegraph Docs
  • Code Intelligence

    • Cody
    • Code Search
  • Code Management

    • Batch Changes
    • Code Navigation
    • Code Monitoring
    • Code Ownership
    • Code Insights
    • Notebooks
  • Platform

    • Sourcegraph Admin
    • Sourcegraph Cloud
    • Integrations
    • Development
  • CLI & API

    • Sourcegraph CLI
    • Sourcegraph GraphQL API
    • Sourcegraph Stream API
  • Help & Support

    • SLAs & Premium Support
    • Tutorials
    • Sourcegraph Accounts
    • Changelog
  1. Docs
  2. dev
  3. how-to
  4. opentelemetry_local_dev

Set up local Sourcegraph OpenTelemetry development

General OpenTelemetry export configuration is done via environment variables according to the official configuration options specification.

NOTE: For how to use Sourcegraph's OpenTelemetry integrations, refer to the OpenTelemetry for site administrators documentation.

Collector

sg start otel runs otel-collector and jaeger, and configures otel-collector to forward traces to Jaeger. Additional configuration can be provided to export to different destinations—for example, to configure a simple Honeycomb exporter, add the following to your sg.config.overwrite.yaml:

commands:
  otel-collector:
    env:
      CONFIGURATION_FILE: 'configs/honeycomb.yaml'
      HONEYCOMB_API_KEY: '...'

To learn more, see docker-images/opentelemetry-collector.

Configuration

Set dev-private site config to use "observability.tracing": { "type": "opentelemetry" } to enable OpenTelemetry export for most services—this should be set by default in the latest versions of dev-private.

Testing

Use sg start to start services, and run a complex query with &trace=1, e.g. foobar(...) patterntype:structural—this will show the View trace button in the search results.

When using different backends, you can use "urlTemplate" in "observability.tracing" to configure the link.

On this page

  1. Set up local Sourcegraph OpenTelemetry development

    1. Collector
    1. Configuration
    1. Testing