Configure Grafana Alloy to send traces

Grafana Alloy uses a component-based architecture that allows you to build flexible telemetry pipelines tailored to your specific requirements.

For trace collection, you typically need the following types of components:

  • Receiver components: Accept trace data from applications and other sources
  • Processor components: Transform, filter, or enhance trace data
  • Exporter components: Send processed traces to destinations like Grafana Cloud

The most common component for receiving traces is otelcol.receiver.otlp, which accepts OpenTelemetry Protocol (OTLP) traces from instrumented applications.

To configure trace collection components, you need to edit the configuration file. The example in this milestone includes the otelcol.receiver.otlp component that accepts traces on standard ports, and an OTLP exporter that sends traces to Grafana Cloud using basic authentication.

Alloy adds a default configuration file when you install it.

Create a configuration file and API token

To configure Alloy, complete the following steps:

  1. Sign in to your Grafana Cloud stack and navigate to your stack.

  2. Select Details next to your stack.

  3. Locate the Tempo section and select Send Traces or Details.

  4. Open the configuration file in your preferred text editor. The file location depends on your operating system. For example:

    • Linux: /etc/alloy/config.alloy
    • macOS: $(brew --prefix)/etc/alloy/config.alloy
    • Windows: %ProgramFiles%\GrafanaLabs\Alloy\config.alloy
    • Docker: <CONFIG_FILE_PATH>
  5. Copy the example configuration file from Sending data to Grafana Cloud using Grafana Alloy Step 2. example configuration file

  6. Paste your configuration into your Alloy configuration file.

  7. Return to your Grafana Cloud stack and create a new API token:

    1. Click Generate now on Step 3. Replace <Your Grafana.com API Token> with a Grafana.com API token.
    2. Enter a Token name.
    3. Select Create token. Copy the token.
  8. Replace <Your Grafana.com API Token> with the token you just created.

  9. Save the changes to your configuration file.

Consider using batch processing if you’re using a production environment.

Next steps

In the next milestone, you will restart Alloy with your updated config.alloy and validate your configuration.

More to explore (optional)

At this point in your journey, you can explore the following paths:

Configure Alloy

Alloy component reference

OpenTelemetry receiver components

Add batch processing to Alloy


page 5 of 8