Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What capitalization of field names to use for trace context in non-OTLP Log Formats #3518

Closed
tigrannajaryan opened this issue May 24, 2023 · 6 comments
Assignees
Labels
spec:logs Related to the specification/logs directory

Comments

@tigrannajaryan
Copy link
Member

tigrannajaryan commented May 24, 2023

Trace Context in non-OTLP Log Formats uses snake case for field names currently: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/compatibility/logging_trace_context.md

The OTLP/JSON which is another format where field names are recorded as text uses camelCase (traceId, spanId).

Should we change recommendation for non-OTLP formats to use use camelCase?

@open-telemetry/specs-logs-approvers @open-telemetry/specs-approvers what do you think?

Relation PR that previously suggested yet another approach (using dots to match ECS): #3469

@tigrannajaryan tigrannajaryan added the spec:logs Related to the specification/logs directory label May 24, 2023
@tigrannajaryan tigrannajaryan self-assigned this May 24, 2023
@tigrannajaryan tigrannajaryan changed the title What capitalization of field names to use for trace Context in non-OTLP Log Formats What capitalization of field names to use for trace context in non-OTLP Log Formats May 24, 2023
@trask
Copy link
Member

trask commented Jun 13, 2023

@open-telemetry/specs-logs-approvers @open-telemetry/specs-approvers now that logs are stable, it would be great if we can get consensus on this

In particular, it looks like Java and Go may already be using different field names: open-telemetry/opentelemetry-java#5528

Also, see a third option which would align with ECS: #3303 (cc @AlexanderWert @ruflin from ECS perspective)

@ruflin
Copy link

ruflin commented Jun 15, 2023

On my end, I would expect that semconv uses the same convention for all signals and fields. For things like http.methods.* (open-telemetry/semantic-conventions#17) it seems the dot notation was adopted. This also aligns well with ECS. But it seems this conflicts with some existing json logging (https://github.com/open-telemetry/opentelemetry-proto/blob/main/docs/specification.md) as it was noted in the PR from @trask

I assume because of backward compatibility, some fields will keep existing that don't follow the general convention. But is there a decision made on what the convention is? My current assumption is it is dot notation with _, not camelCase which ECS uses.

@tigrannajaryan
Copy link
Member Author

Are you proposing to use trace.id? Dots are for namespace separation in semconv. trace_id is a field name in log data model, it is not an "id" field in the "trace" namespace, so we shouldn't use a dot to separate "trace" from "id". Underscore is used in semconv to separate words in the name, which is what we are doing in trace_id.

@jack-berg
Copy link
Member

Something to think about:

While its true that OTLP/JSON converts keys to lowerCamelCase, that applies to the field names - the names of attributes are left untouched. So the question seems to be are trace_id / span_id closer to field names or attribute names? If we think they're closer to attribute names, we SHOULD leave them untouched. If we think they're closer to field names, we might consider switching to lowerCamelCase. But we also shouldn't feel obligated to adopt the same rules as OTLP/JSON for something that isn't related.

I'd argue trace_id / span_id ARE field names since they appear as top level fields on LogRecord. However, the changing the case is disruptive, and the benefit of alignment with the unrelated OTLP/JSON format does not justify the disruption. Therefore, I'm in favor of keeping the trace_id / span_id the way they are.

@tigrannajaryan
Copy link
Member Author

I agree with @jack-berg's arguments. I don't see strong enough arguments to make a disruptive change.

@tigrannajaryan
Copy link
Member Author

No other new arguments brought up. Closing, will keep the spec as is.

@tigrannajaryan tigrannajaryan closed this as not planned Won't fix, can't repro, duplicate, stale Jul 19, 2023
carlosalberto pushed a commit that referenced this issue Jul 12, 2024
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.
carlosalberto pushed a commit to carlosalberto/opentelemetry-specification that referenced this issue Oct 31, 2024
…elemetry#3909)

Closes
open-telemetry#3303

## Changes

From @tigrannajaryan in
open-telemetry#3303 (comment):

> I think the conclusion in
open-telemetry#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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
spec:logs Related to the specification/logs directory
Projects
None yet
Development

No branches or pull requests

5 participants