-
Notifications
You must be signed in to change notification settings - Fork 896
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
New "Context" field in Opentelemtry Log Model #1660
Comments
I think this is a related issue: #1613 |
@pmm-sumo , yes it is partially related not entirely. What I am proposing here is to differentiate according to the lifecycle of the data accociated with the LogEvent. What is mentioned in #1613 for Attributes make sense - it can be used for arbitrary key/value pairs, but from implementation perspective its quite challenging to populate MDC fields as well as event specific fields under the same Attributes bucket. I have created a demo app using logback, I will submit it to contrib/examples to help the discussion. |
One possible way is to explore if attributes can be used (with some semantic convention) instead of having to introduce a top level concept. Will be discussed in the upcoming logging SIG. |
I do not see the need for a top-level field in the log data model. These can be recorded as LogRecord Attributes. The log data model design specifically reserves top-level fields for data that is present almost always, which is not the case for the "Context" proposed here, it appears to be a special use case. Log data model encourages using Attributes for such cases.
There is already a semantic convention for user id: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/semantic_conventions/span-general.md#general-identity-attributes |
Marking as candidate for closing with "won't fix" unless we see more arguments in favour. |
Closing since no further arguments provided. |
What are you trying to achieve?
Consider introducing Context field to the Log Model. Please see below Additional Context for more details.
What did you expect to see?
Below field to be part of the Log Model.
Additional context.
AFAIU, there are two root-level fields
Resource
andAttributes
that contains information as per two different lifecycle.Resource
: It contains relatively static information associated with lifecycle of the service (service_name), lifecycle of the particular version or k8s pod, etc. We expect to see the same details for Resource for all LogEvents logged during that lifecycle.Attributes
: It contains dynamic information associated with individual LogEvent. e.g. http.method, http.response_status or http.url. Considering this characteristic, Attributes are usually not defined as part of the static log patterns in most libraries (log4j or logback), otherwise we would see empty Attributes for most of the LogEvent which are not associated with http request/response.Proposal is to introduce new Context field which can serve below usecase:
As
TraceId
andSpanId
are associated with distributed REQUEST call-tree - single request flowing through A-->B-->C. It does not seem to fit the usecases like user sessions/conversationId in saga pattern. Typical example is Order Fulfillment workflow, during the order workflow, same distributed service may get called but with most likely with differentTraceId
depending on design and implementation. In such case, these different calls can be correlated using something like OrderNumber. Another example is associating all traces with same UserId or UserSession.Typical implementation uses Context pattern (e.g. MDC in slf4j) to log such fields without explicitly being part of the Log statements and associated with the lifecycle of the request - which is somewhere middle-ground between the purpose served by
Resource
andAttributes
fields, Hence the need for the newContext
field in the otep log model.The text was updated successfully, but these errors were encountered: