Skip to content

Commit

Permalink
docs: Add some clarity to ottrace docs (open-telemetry#522)
Browse files Browse the repository at this point in the history
  • Loading branch information
arielvalentin authored Jul 7, 2023
1 parent cc244b9 commit 0f868b7
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions propagator/ottrace/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ The `opentelemetry-propagator-ottrace` gem contains injectors and extractors for

| Header Name | Description | Required |
| ------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | --------------------- |
| `ot-tracer-traceid` | uint64 encoded as a string of 16 hex characters | yes |
| `ot-tracer-spanid` | uint64 encoded as a string of 16 hex characters | yes |
| `ot-tracer-traceid` | 64-bit; 16 hex digits (extract and inject) or 128-bit; 32 hex digits (extract) | yes |
| `ot-tracer-spanid` | 64-bit; 16 hex digits | yes |
| `ot-tracer-sampled` | boolean or bit encoded as a string with the values `'true'`,`'false'`, `'1'`, or `'0'` | no |
| `ot-baggage-*` | repeated string to string key-value baggage items; keys are prefixed with `ot-baggage-` and the corresponding value is the raw string. | if baggage is present |

Expand All @@ -24,11 +24,15 @@ This issue was [fixed](https://github.com/open-telemetry/opentelemetry-go-contri

### Interop and trace ids

The OT trace propagation format expects trace ids to be 64-bits. In order to
interop with OpenTelemetry, trace ids need to be truncated to 64-bits before
sending them on the wire. When truncating, the least significant (right-most)
bits MUST be retained. For example, a trace id of
`3c3039f4d78d5c02ee8e3e41b17ce105` would be truncated to `ee8e3e41b17ce105`.
OTTrace was changed to be interoperable with other format so it is supposed to 8 or 16 byte array values for the trace-id.

In order to do that Lightstep released a version of the OTTrace propagators in OpenTracing SDKs that left padded 64-bit headers to 128-bits using an additional 64-bit of 0s.

The reality of the world is not every application upgraded to support 16 byte array propagation format, but this propagator must still convert legacy 64-bit trace ids to match the W3C Trace Context Trace ID 16 byte array.

In addition to that it must be interoperable with legacy OTTracers, which expect 64-bit headers so this propagator truncates the value from a 128-bit to a 64-bit value before inject it into the carrier.

This propagator is compatible with 64-bit or 128-bit trace ids when extracting the parent context, however it truncates the trace ids down to 64-bit trace ids when injecting the context.

### Baggage Notes

Expand Down

0 comments on commit 0f868b7

Please sign in to comment.