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

add conventions for log correlation #114

Closed
wants to merge 6 commits into from

Conversation

zenmoto
Copy link

@zenmoto zenmoto commented Jun 8, 2020

This OTEP is to add basic conventions for correlating logs with traces and resources by modifying existing logging formats.

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Jun 8, 2020

CLA Check
The committers are authorized under a signed CLA.

Copy link
Member

@tigrannajaryan tigrannajaryan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zenmoto thanks for starting this document, this is very important for supporting modern observability in applications that emit standalone logs in existing formats.

text/logs/0114-log-correlation.md Outdated Show resolved Hide resolved
text/logs/0114-log-correlation.md Outdated Show resolved Hide resolved
text/logs/0114-log-correlation.md Outdated Show resolved Hide resolved
text/logs/0114-log-correlation.md Outdated Show resolved Hide resolved

### Request Correlation

Trace correlation is achieved primarily with two values- a trace identifier and
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are "Trace correlation" and "Request correlation" interchangeable and equivalent terms?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the answer is no, but I need some help here- I think that "trace correlation" is a David-ism, so I was about to rename it to "request correlation", but not all traces are part of a request- do we have a more general term that we use? Or is request correlation correct in this context?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have an answer, no preference here. Not sure if have a standardized terminology for this already. Perhaps check the rest of the spec and see if there is one.
If there is none let's choose one and stick with it.

text/logs/0114-log-correlation.md Outdated Show resolved Hide resolved
text/logs/0114-log-correlation.md Outdated Show resolved Hide resolved
## Trade-offs and mitigations

As a convention, adherence to these standards may have some variation, and some
of this advice may be difficult to implement in certain circumstances.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not quite clear what this means. What level of variation is acceptable? Typically, where it matters we use RFC kewords MAY, SHOULD, MUST, etc to specify how strict the particular part of the spec is and what variation is allowed.

text/logs/0114-log-correlation.md Outdated Show resolved Hide resolved
text/logs/0114-log-correlation.md Outdated Show resolved Hide resolved
Co-authored-by: Tigran Najaryan <4194920+tigrannajaryan@users.noreply.github.com>
Co-authored-by: Yuri Shkuro <yurishkuro@users.noreply.github.com>
Copy link
Member

@bogdandrutu bogdandrutu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks like a good starting point. Some details will be clarified in the specs

Copy link
Member

@tigrannajaryan tigrannajaryan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@bogdandrutu
Copy link
Member

@open-telemetry/specs-approvers @open-telemetry/specs-logs-approvers please review this.

@zenmoto zenmoto requested review from a team July 15, 2020 21:46
@PatrikSteuer
Copy link

open-telemetry/opentelemetry-specification#1283 changes the format of traceid, spanid, traceflags to trace_id, span_id, and trace_flags which seems to be related.

@kamalmarhubi
Copy link

it also seems that correlation context should be renamed to baggage? cf open-telemetry/opentelemetry-specification#536 and open-telemetry/opentelemetry-specification#857


| Field | Required | Format
| :--------- | :------- | :--------------------------------------------------
| traceid | Yes | 16-byte numeric value as Base16-encoded string
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At least in Python, the log format requires all fields to be present on the log record object or it throws an exception. Also, the log format cannot be changes dynamically depending on whether an active span (or fields on log record) is present or not. So in this case we can either leave the fields empty so that the formatted logs look like trace_id= span_id= or we can set them to zero so it looks like trace_id=0 span_id=0. Can we clarify what values the fields should be set to in case no active span is found in the context?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@owais what would you prefer? Also, it seems like a fairly specific use case, could it be left to whoever configures the logger on how they want to represent the lack of trace context?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a slight preference for 0.

could it be left to whoever configures the logger on how they want to represent the lack of trace context?

It could but then backends will have to deal with multiple ways of representing nil values (0 vs '' vs null in JSON, etc). It would be nicer if the spec recommended one thing when the field cannot be omitted completely so analysis tools can have a standard way of detecting it.

redundant. In certain cases it may be important to associate this context with
log entries. When the context is embedded in a log entry, the key-value
pairs should be placed in a 'ctx' namespace. Where key-value pairs are
supported, embed the correlation key as “correlation.key_name”. In JSON or
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
supported, embed the correlation key as “correlation.key_name”. In JSON or
supported, embed the correlation key as “ctx.key_name”. In JSON or

@tigrannajaryan
Copy link
Member

Most of the proposals in this PR are already part of the specification. This OTEP is actually someone out of sync / behind with the specification. I suggest that we close the OTEP and any additional clarifications necessary are submitted as issues/PRs against specification repo.

@mars64
Copy link

mars64 commented Sep 2, 2021

Most of the proposals in this PR are already part of the specification. This OTEP is actually someone out of sync / behind with the specification. I suggest that we close the OTEP and any additional clarifications necessary are submitted as issues/PRs against specification repo.

I know this is an aged pull here, but just wanted to point out that at least as of today the open-telemetry/opentelemetry-specification/specification/logs/overview.md doc still refers to this pull for definitions on log correlation behavior.

For posterity, I think what you're saying is that folks interested learning more/contributing to the log correlation spec should instead refer to and issue requests against the data-model.md doc/area, is that right? This area is also mentioned, but its confusing. It seems like removing the mention to this pull would be a quick win for anyone else interested in following along.

@tedsuo
Copy link
Contributor

tedsuo commented Feb 6, 2023

@tigrannajaryan
Copy link
Member

@tigrannajaryan the spec still refers to this OTEP: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/logs/README.md#trace-context-in-legacy-formats

Should we go ahead and approve it?

This OTEP's ideas were incorporated in to the spec, so it served its purpose, however the spec slightly deviated from this OTEP in nuances. I will close this OTEP and it can stay for posterity. The spec probably needs slight re-wording to ensure it does not imply that the OTEP is the source of truth.

@tigrannajaryan
Copy link
Member

@tigrannajaryan the spec still refers to this OTEP: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/logs/README.md#trace-context-in-legacy-formats
Should we go ahead and approve it?

This OTEP's ideas were incorporated in to the spec, so it served its purpose, however the spec slightly deviated from this OTEP in nuances. I will close this OTEP and it can stay for posterity. The spec probably needs slight re-wording to ensure it does not imply that the OTEP is the source of truth.

@zenmoto do you think you can condense this OTEP into 1-2 paragraphs that we can incorporate into the spec? Linking to the OTEP is a bit misleading (e.g. OTEP uses traceid, but we went with trace_id in the spec), so I think it is best to avoid linking to the OTEP.

@zenmoto
Copy link
Author

zenmoto commented Feb 8, 2023

The important parts of this OTEP have made their way into the spec. Closing this PR as it's outdated.

@zenmoto zenmoto closed this Feb 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants