Skip to content

Commit

Permalink
Stabilize trace context in non-OTLP formats and define casing (#3909)
Browse files Browse the repository at this point in the history
Closes
#3303

## Changes

From @tigrannajaryan in
#3303 (comment):

> I think the conclusion in
#3518
was that we keep the names. It has been a while and there is no new
evidence that we need to do something else so I suggest that we submit a
PR that declares
https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/compatibility/logging_trace_context.md
"Stable" and closes this issue.

This marks the specification for using `trace_id`, `span_id`, and
`trace_flags` in non-OTLP logging formats stable.
  • Loading branch information
dashpole authored Jul 12, 2024
1 parent 3efed53 commit 9d4acd9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ release.

### Compatibility

- Define casing for hex-encoded IDs and mark the "Trace Context in non-OTLP Log Formats" specification stable.
([#3909](https://github.com/open-telemetry/opentelemetry-specification/pull/3909))

### SDK Configuration

### Common
Expand Down
12 changes: 6 additions & 6 deletions specification/compatibility/logging_trace_context.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Trace Context in non-OTLP Log Formats

**Status**: [Development](../document-status.md)
**Status**: [Stable](../document-status.md)

<details>
<summary>Table of Contents</summary>
Expand All @@ -24,8 +24,8 @@ representing [trace context](../logs/data-model.md#trace-context-fields). This
document defines how trace context should be recorded in non-OTLP Log Formats.
To summarize, the following field names should be used in legacy formats:

- "trace_id" for [TraceId](../logs/data-model.md#field-traceid), hex-encoded.
- "span_id" for [SpanId](../logs/data-model.md#field-spanid), hex-encoded.
- "trace_id" for [TraceId](../logs/data-model.md#field-traceid), lowercase and hex-encoded.
- "span_id" for [SpanId](../logs/data-model.md#field-spanid), lowercase and hex-encoded.
- "trace_flags" for [trace flags](../logs/data-model.md#field-traceflags), formatted
according to W3C traceflags format.

Expand All @@ -39,7 +39,7 @@ Trace id, span id and traceflags SHOULD be recorded via SD-ID "opentelemetry".
For example:

```
[opentelemetry trace_id="102981ABCD2901" span_id="abcdef1010" trace_flags="01"]
[opentelemetry trace_id="102981abcd2901" span_id="abcdef1010" trace_flags="01"]
```

### Plain Text Formats
Expand All @@ -48,7 +48,7 @@ The fields SHOULD be recorded according to the customary approach used for a
particular format (e.g. field:value format for LTSV). For example:

```
host:192.168.0.1<TAB>trace_id:102981ABCD2901<TAB>span_id:abcdef1010<TAB>time:[01/Jan/2010:10:11:23 -0400]<TAB>req:GET /health HTTP/1.0<TAB>status:200
host:192.168.0.1<TAB>trace_id:102981abcd2901<TAB>span_id:abcdef1010<TAB>time:[01/Jan/2010:10:11:23 -0400]<TAB>req:GET /health HTTP/1.0<TAB>status:200
```

### JSON Formats
Expand All @@ -59,7 +59,7 @@ The fields SHOULD be recorded as top-level fields in the JSON structure. For exa
{
"timestamp":1581385157.14429,
"body":"Incoming request",
"trace_id":"102981ABCD2901",
"trace_id":"102981abcd2901",
"span_id":"abcdef1010"
}
```
Expand Down

0 comments on commit 9d4acd9

Please sign in to comment.