sourcegraph/doc/dev/how-to/opentelemetry_local_dev.md
Julie Tibshirani e45ec596b4
Batch changes: remove structural search example (#62958)
This PR refactors a batch changes example that uses `patterntype:structural` to
use regex instead. We no longer expose `patterntype:structural` by default, and
want to push users towards other pattern types.
2024-05-30 08:47:46 -07:00

1.7 KiB

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\(\w+\) patterntype:regexp—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.