telemetrygen

command module
v0.151.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 28, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

README

Telemetry generator for OpenTelemetry

Status
Stability alpha: metrics, traces, logs
Issues Open issues Closed issues
Code Owners @mx-psi, @codeboten, @Erog38, @bogdan-st

This utility simulates a client generating traces, metrics, and logs. It is useful for testing and demonstration purposes.

Installing

To install the latest version run the following command:

go install github.com/open-telemetry/opentelemetry-collector-contrib/cmd/telemetrygen@latest

Check the go install reference to install specific versions.

Docker build

You can build locally the Docker image with:

make docker-telemetrygen

Using github actions, we also push a docker image on commit to main or on release to this Github docker registry.

Running

First, you'll need an OpenTelemetry Collector to receive the telemetry data. Follow the project's instructions for a detailed setting up guide. The following configuration file should be sufficient:

config.yaml:

receivers:
  otlp:
    protocols:
      grpc:
        endpoint: 0.0.0.0:4317

exporters:
  debug:
    verbosity: detailed

service:
  pipelines:
    logs:
      receivers: [otlp]
      exporters: [debug]
    metrics:
      receivers: [otlp]
      exporters: [debug]
    traces:
      receivers: [otlp]
      exporters: [debug]

Starting OpenTelemetry collector via docker:

docker run -p 4317:4317 -v $(pwd)/config.yaml:/etc/otelcol-contrib/config.yaml ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-contrib:0.149.0

Other options for running the collector are documented here https://opentelemetry.io/docs/collector/getting-started/

Export timeout

The maximum time to wait for signals to reach the destination can be configured with the following flag:

--timeout=10s #Defaults to 10s

Batching signals

All telemetry signals have batching capability configurable with the following flags:

--batch=false #Defaults to true, no flag needed for batching
--batch-size=1000 #Defaults to 100

Once the OpenTelemetry Collector instance is up and running, run telemetrygen for your desired telemetry:

Traces
telemetrygen traces --otlp-insecure --duration 5s

Or, to generate a specific number of traces:

telemetrygen traces --otlp-insecure --traces 1

Or, to generate traces continuously (use --duration inf with --rate for throttling):

telemetrygen traces --otlp-insecure --duration inf --rate 0.1

To send traces in secure connection, see examples/secure-tracing

Check telemetrygen traces --help for all the options.

Logs
telemetrygen logs --otlp-insecure --duration 5s

Or, to generate a specific number of logs:

telemetrygen logs --otlp-insecure --logs 1

Or, to generate logs continuously:

telemetrygen logs --otlp-insecure --duration inf --rate 0.1

To send logs in secure connection, see examples/secure-tracing

Check telemetrygen logs --help for all the options.

Metrics
telemetrygen metrics --otlp-insecure --duration 5s

Or, to generate a specific number of metrics:

telemetrygen metrics --otlp-insecure --metrics 1

Or, to generate metrics continuously:

telemetrygen metrics --otlp-insecure --duration inf --rate 0.1

To send metrics in secure connection, see examples/secure-tracing

Check telemetrygen metrics --help for all the options.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
internal
log
e2etest module
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL