Collectors

Learn how to use OpenTelemetry collectors with BugSnag for powerful trace management.

Collectors are components in your system designed to receive, process and export Telemetry data. They solve for various use cases, including:

  • Making tail-based sampling decisions on whole traces
  • Forwarding data to multiple backends
  • Batching and retries of span data
  • Filtering of sensitive data

We don’t generally recommend using a collector if you are just getting started with OpenTelemetry. Initially it is simpler just to use your application’s exporter to send data to BugSnag directly.

However, as your usage of OpenTelemetry increases and you start to have more complex requirements like those listed above, a collector may help to simplify your system by centralizing a lot of your telemetry data processing.

The OpenTelemetry Collector is a vendor-agnostic implementation that we recommend for use with BugSnag.

Collectors can be deployed in a couple of modes of operation:

  • Agent - a collector is run alongside the application, or on the same host.
  • Gateway - a centrally run collector receives telemetry data from all your applications via a single endpoint. Multiple collector instances may be run alongside one another, for example in a Kubernetes cluster. A load balancer can distribute the load across collectors.

The agent deployment is a more straightforward pattern for getting started, however gateway deployments offer more flexibility, with centralized configuration and generally better scalability.

Configuring a collector

To send data from a collector to BugSnag, you will need to add an entry to the exporters section of your collector’s configuration file:

exporters:
  # gRPC
  otlp/bugsnag:
    endpoint: "<ORGANIZATION_API_KEY>.otlp.bugsnag.com:4317"

  # or over HTTP using `proto` encoding
  otlphttp/bugsnag:
    traces_endpoint: "https://<ORGANIZATION_API_KEY>.otlp.bugsnag.com:4318/v1/traces"
  • ORGANIZATION_API_KEY is an organization level API key for sending OpenTelemetry trace data to BugSnag. See our guide to sending traces for more information on how you can map trace data to a project in BugSnag.
  • The exporters defined here use the type[/name] format, meaning you can add BugSnag to any existing exporters you might already have in your collector Configuration file.

You will need to ensure that the exporter you add also gets added to the pipelines section in the same configuration file, for example:

service:
  pipelines:
    traces:
      # ...other receivers/processors
      exporters: [otlp/bugsnag] # or otlphttp/bugsnag

There are many ways that a collector can be configured. We recommend reading more about how to configure a collector in the OpenTelemetry documentation.

BugSnag currently only supports OpenTelemetry trace signals, so it is important to ensure that you only configure your collector to export traces to BugSnag’s endpoints.