Files
genai-toolbox/docs/en/how-to/export_telemetry.md
Yuan Teoh 6e87349431 docs: telemetry docs to provide endpoint without scheme or path (#2179)
## Description

According to the OTEL
([docs](https://pkg.go.dev/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp#WithEndpoint)),
`WithEndpoint()` sets the target endpoint (host and port) the Exporter
will connect to. The provided endpoint should resemble
"example.com:4318" (no scheme or path). And it requires the endpoint to
be secure using `https://`.

To provide an insecure endpoint with `http://`, user will need to set
`OTEL_EXPORTER_OTLP_INSECURE=true`. This PR update the docs to reflect
this.

🛠️ Fixes #1539
2025-12-18 16:24:22 +00:00

3.1 KiB

title, type, weight, description
title type weight description
Export Telemetry docs 5 How to set up and configure Toolbox to use the Otel Collector.

About

The OpenTelemetry Collector offers a vendor-agnostic implementation of how to receive, process and export telemetry data. It removes the need to run, operate, and maintain multiple agents/collectors.

Configure the Collector

To configure the collector, you will have to provide a configuration file. The configuration file consists of four classes of pipeline component that access telemetry data.

  • Receivers
  • Processors
  • Exporters
  • Connectors

Example of setting up the classes of pipeline components (in this example, we don't use connectors):

receivers:
  otlp:
    protocols:
      http:
        endpoint: "127.0.0.1:4553"

exporters:
  googlecloud:
    project: <YOUR_GOOGLE_CLOUD_PROJECT>

processors:
  batch:
    send_batch_size: 200

After each pipeline component is configured, you will enable it within the service section of the configuration file.

service:
  pipelines:
    traces:
      receivers: ["otlp"]
      processors: ["batch"]
      exporters: ["googlecloud"]

Running the Collector

There are a couple of steps to run and use a Collector.

  1. Install the Collector binary. Pull a binary or Docker image for the OpenTelemetry contrib collector.

  2. Set up credentials for telemetry backend.

  3. Set up the Collector config. Below are some examples for setting up the Collector config:

  4. Run the Collector with the configuration file.

    ./otelcol-contrib --config=collector-config.yaml
    
  5. Run toolbox with the --telemetry-otlp flag. Configure it to send them to 127.0.0.1:4553 (for HTTP) or the Collector's URL.

    ./toolbox --telemetry-otlp=127.0.0.1:4553
    

    {{< notice tip >}} To pass an insecure endpoint, set environment variable OTEL_EXPORTER_OTLP_INSECURE=true. {{< /notice >}}

  6. Once telemetry datas are collected, you can view them in your telemetry backend. If you are using GCP exporters, telemetry will be visible in GCP dashboard at Metrics Explorer and Trace Explorer.

{{< notice note >}} If you are exporting to Google Cloud monitoring, we recommend that you use the Google Cloud Exporter for traces and the Google Managed Service for Prometheus Exporter for metrics. {{< /notice >}}