# Traceparent parser & generator

Paste a traceparent header to see what's inside and whether it's valid, or generate a new one for testing.

## How it works

A traceparent header has four parts separated by dashes: a version, a 32-character trace ID, a 16-character parent span ID and the trace flags. Services pass it along on every call, so every span in a request shares the same trace ID.

The last bit of the flags says whether the caller sampled the trace. Tracestate carries extra, vendor-specific values as a list of key=value pairs, at most 32 of them.

```
traceparent: 00-<trace-id 32 hex>-<parent-id 16 hex>-<flags 2 hex>
tracestate: key1=value1,key2=value2
```

## Questions

### Why is my trace broken into pieces?

Usually a service in the middle doesn't forward the traceparent header, so the next service starts a new trace.

### Can the trace ID be all zeros?

No. An all-zero trace ID or parent ID is invalid, and receivers must ignore the header.

### Should I set the sampled flag?

Let the SDK decide. Set it by hand only in tests, when you need a downstream service to record the trace.

## Related tools

- [OpenTelemetry setup generator](https://powertraces.com/tools/opentelemetry-setup)
- [Collector config builder](https://powertraces.com/tools/collector-config)
- [OTLP JSON validator](https://powertraces.com/tools/otlp-json-validator)
- [Semantic conventions lookup](https://powertraces.com/tools/semantic-conventions)

[All tools](https://powertraces.com/tools)
