|
1 | | -# otelgen |
2 | | -Simple, reliable CLI tool for generating OpenTelemetry traces, metrics, and logs to test OTLP endpoints |
| 1 | +# Telemetrygen |
| 2 | + |
| 3 | +A simple and reliable CLI tool for generating OpenTelemetry traces, metrics, and logs to test OTLP endpoints. |
| 4 | + |
| 5 | +## Features |
| 6 | + |
| 7 | +- Generate traces, metrics, and logs |
| 8 | +- Support for gRPC, gRPCs, HTTP, and HTTPS protocols |
| 9 | +- Automatic port selection (4317 for gRPC, 4318 for HTTP) |
| 10 | +- Configurable rate and duration |
| 11 | +- Simple and intuitive CLI interface |
| 12 | + |
| 13 | +## Installation |
| 14 | + |
| 15 | +### Build from source |
| 16 | + |
| 17 | +```bash |
| 18 | +go build -o telemetrygen |
| 19 | +``` |
| 20 | + |
| 21 | +### Build Docker image |
| 22 | + |
| 23 | +```bash |
| 24 | +docker build -t telemetrygen . |
| 25 | +``` |
| 26 | + |
| 27 | +The Docker image uses a multi-stage build with `scratch` as the final base image for minimal size (~20MB). |
| 28 | + |
| 29 | +## Usage |
| 30 | + |
| 31 | +### Traces |
| 32 | + |
| 33 | +Generate trace data: |
| 34 | + |
| 35 | +```bash |
| 36 | +# Using gRPCs (secure gRPC) |
| 37 | +./telemetrygen traces \ |
| 38 | + --otlp-endpoint grpcs://852e95f4-5bbc-4d54-9879-b8591ff6194c-grpc-us-west2-cf.aws-staging.edgedelta.com:4317 \ |
| 39 | + --service my-service \ |
| 40 | + --rate 1 \ |
| 41 | + --duration 10s |
| 42 | + |
| 43 | +# Using HTTP |
| 44 | +./telemetrygen traces \ |
| 45 | + --otlp-endpoint http://localhost:4318 \ |
| 46 | + --service my-service \ |
| 47 | + --rate 10 \ |
| 48 | + --duration 1m |
| 49 | + |
| 50 | +# Port is optional - will use default 4317 for gRPC |
| 51 | +./telemetrygen traces \ |
| 52 | + --otlp-endpoint grpc://localhost \ |
| 53 | + --service my-service |
| 54 | +``` |
| 55 | + |
| 56 | +### Metrics |
| 57 | + |
| 58 | +Generate metrics data: |
| 59 | + |
| 60 | +```bash |
| 61 | +# Using gRPCs |
| 62 | +./telemetrygen metrics \ |
| 63 | + --otlp-endpoint grpcs://852e95f4-5bbc-4d54-9879-b8591ff6194c-grpc-us-west2-cf.aws-staging.edgedelta.com:4317 \ |
| 64 | + --service my-service \ |
| 65 | + --rate 1 \ |
| 66 | + --duration 10s |
| 67 | + |
| 68 | +# Using HTTPS |
| 69 | +./telemetrygen metrics \ |
| 70 | + --otlp-endpoint https://localhost:4318 \ |
| 71 | + --service my-service \ |
| 72 | + --rate 5 \ |
| 73 | + --duration 30s |
| 74 | +``` |
| 75 | + |
| 76 | +### Logs |
| 77 | + |
| 78 | +Generate log data: |
| 79 | + |
| 80 | +```bash |
| 81 | +# Using gRPCs |
| 82 | +./telemetrygen logs \ |
| 83 | + --otlp-endpoint grpcs://852e95f4-5bbc-4d54-9879-b8591ff6194c-grpc-us-west2-cf.aws-staging.edgedelta.com:4317 \ |
| 84 | + --service my-service \ |
| 85 | + --rate 1 \ |
| 86 | + --duration 10s |
| 87 | + |
| 88 | +# Using HTTP with custom port |
| 89 | +./telemetrygen logs \ |
| 90 | + --otlp-endpoint http://localhost:8080 \ |
| 91 | + --service my-service \ |
| 92 | + --rate 20 \ |
| 93 | + --duration 5s |
| 94 | +``` |
| 95 | + |
| 96 | +## Docker Usage |
| 97 | + |
| 98 | +```bash |
| 99 | +# Traces |
| 100 | +docker run --rm telemetrygen traces \ |
| 101 | + --otlp-endpoint grpcs://your-endpoint:4317 \ |
| 102 | + --service my-service \ |
| 103 | + --rate 1 \ |
| 104 | + --duration 10s |
| 105 | + |
| 106 | +# Metrics |
| 107 | +docker run --rm telemetrygen metrics \ |
| 108 | + --otlp-endpoint grpcs://your-endpoint:4317 \ |
| 109 | + --service my-service \ |
| 110 | + --rate 1 \ |
| 111 | + --duration 10s |
| 112 | + |
| 113 | +# Logs |
| 114 | +docker run --rm telemetrygen logs \ |
| 115 | + --otlp-endpoint grpcs://your-endpoint:4317 \ |
| 116 | + --service my-service \ |
| 117 | + --rate 1 \ |
| 118 | + --duration 10s |
| 119 | +``` |
| 120 | + |
| 121 | +## Flags |
| 122 | + |
| 123 | +| Flag | Description | Default | Required | |
| 124 | +|------|-------------|---------|----------| |
| 125 | +| `--otlp-endpoint` | OTLP endpoint URL (grpc://, grpcs://, http://, https://) | - | Yes | |
| 126 | +| `--service` | Service name for telemetry | telemetrygen | No | |
| 127 | +| `--rate` | Number of telemetry items per second | 1 | No | |
| 128 | +| `--duration` | How long to generate telemetry (e.g., 10s, 1m, 1h) | 10s | No | |
| 129 | +| `--insecure` | Use insecure connection (not implemented yet) | false | No | |
| 130 | + |
| 131 | +## Protocol Support |
| 132 | + |
| 133 | +- `grpc://` - Insecure gRPC (default port: 4317) |
| 134 | +- `grpcs://` - Secure gRPC with TLS (default port: 4317) |
| 135 | +- `http://` - Insecure HTTP (default port: 4318) |
| 136 | +- `https://` - Secure HTTP with TLS (default port: 4318) |
| 137 | + |
| 138 | +## Default Ports |
| 139 | + |
| 140 | +If you don't specify a port in the endpoint URL, the following defaults are used: |
| 141 | + |
| 142 | +- gRPC/gRPCs: 4317 |
| 143 | +- HTTP/HTTPS: 4318 |
| 144 | + |
| 145 | +## Examples |
| 146 | + |
| 147 | +```bash |
| 148 | +# Quick test with local collector |
| 149 | +./telemetrygen traces --otlp-endpoint grpc://localhost --service test-app --duration 5s |
| 150 | + |
| 151 | +# High-volume test |
| 152 | +./telemetrygen metrics --otlp-endpoint http://localhost:4318 --service load-test --rate 100 --duration 1m |
| 153 | + |
| 154 | +# Production endpoint test |
| 155 | +./telemetrygen logs --otlp-endpoint grpcs://prod.example.com:4317 --service prod-app --rate 10 --duration 30s |
| 156 | +``` |
| 157 | + |
| 158 | +## What Gets Generated |
| 159 | + |
| 160 | +### Traces |
| 161 | +- Parent spans with child spans |
| 162 | +- Random operation types and IDs |
| 163 | +- Realistic timing and nesting |
| 164 | + |
| 165 | +### Metrics |
| 166 | +- Counter: `telemetrygen.requests` |
| 167 | +- Histogram: `telemetrygen.duration` |
| 168 | +- Gauge: `telemetrygen.cpu_usage` |
| 169 | + |
| 170 | +### Logs |
| 171 | +- Various log levels (INFO, WARN, ERROR, DEBUG) |
| 172 | +- Realistic log messages |
| 173 | +- Additional attributes (component, request_id, user_id) |
0 commit comments