-
Notifications
You must be signed in to change notification settings - Fork 772
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 ability to export attributes corresponding to Logrecord.EventId
#4925
Add ability to export attributes corresponding to Logrecord.EventId
#4925
Conversation
…add-otlp-excluded-attributes' of https://github.com/vishweshbankwar/opentelemetry-dotnet into vibankwa/add-otlp-excluded-attributes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Codecov Report
@@ Coverage Diff @@
## main #4925 +/- ##
==========================================
- Coverage 83.65% 83.36% -0.29%
==========================================
Files 295 295
Lines 12325 12333 +8
==========================================
- Hits 10310 10282 -28
- Misses 2015 2051 +36
Flags with carried forward coverage won't be shown. Click here to find out more.
|
src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OtlpLogRecordTransformer.cs
Outdated
Show resolved
Hide resolved
resolves #4404 too |
src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ExperimentalOptions.cs
Outdated
Show resolved
Hide resolved
src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OtlpLogRecordTransformer.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to ship this under experimental flag, given there is no existing semantic convention for this.
Would be nice to make the changelog more self-contained to help end users navigate these changes more smoothly.
@nblumhardt Could you review as well? |
I think we should shy away from using
Why tie ourselves to that /cc @alanwest |
Agreed. @vishweshbankwar and I spoke about this yesterday. If we are adopting the event conventions then I think it is inappropriate to only adopt them halfway. @vishweshbankwar you were going to discuss this with other. Any updates? Any ideas of what to set The idea I shared was
I'm still not a fan of adopting them, however, as I discussed with @vishweshbankwar, I can get behind it if we embrace the spirit of applying the experimental conventions to help drive them forward based on feedback we may learn. What this looks like to me is:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Going to try and push clarification through the spec on this: open-telemetry/semantic-conventions#372
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In .NET, EventId.Id
and EventId.Name
are generally only unique/useful in the context of an ILogger
category:
Event IDs and names should be unique so that different message types can be identified. (source)
So if they were to be translated into event.id
and event.name
(seems fine to me) then perhaps the category belongs alongside them in an event.*
attribute, too?
Putting the category into event.domain
instead of dotnet.ilogger.category
would make this intent clear and qualify the names/ids nicely:
event.id = 7
event.name = UserCreated
event.domain = Microsoft.AspNetCore.Identity.UI
Unfortunately the definition of event.domain
seems to exclude this usage, but, perhaps another event.*
attribute can be coined? dotnet.ilogger.category
is a bit of an oddity right now and seems like a good candidate for unification into something more general.
@alanwest Firstly, I think deciding this would take some more time and discussion and we need not block this PR for that. We don't have any users asking us to export Now if we could go with Proposal A in open-telemetry/semantic-conventions#372, then we wouldn't have to worry about In the case where we have to go forward with Proposal B/ Event semantic conventions, I feel that The current description for
|
We now have two people on this PR who have expressed this intuition. It's also an option @CodeBlanch suggested long ago. Is there a reason we shouldn't set |
Let me take a step back and summarize what I think we should do: P0 - Resolve issues reported by users1) Issue of missing attributesThese attributes have been part of the exporter since the very beginning, and not having the ability to get these attributes is disruptive for users.
Additionally, users have asked about this offline as well. 2) Issue of name and id being too genericThis PR addresses both of these feedbacks. P1 - Stabilize these experimental attributesAll the discussions here on this PR are a good step towards that. There is already some engagement on the issue opened by @CodeBlanch. So, in favor of addressing P0, I think we should go ahead with this PR. Additionally, this will help with getting more feedback as well. We should continue our discussions on P1 on semantic-conventions issue and opentelemetry-dotnet issue. For the part of setting the category to
That being said, I agree that P1 still remains unaddressed but it should be handled separately from this PR. |
Using instrumentation scopes could be suboptimal for libraries/the SDK generating OTLP payloads, since (as far as I understand it) "log records" nest under "scope logs" and so the SDK would need to sort/group events in order to build properly nested/non-degenerate OTLP payloads. |
+1, |
I really think we should shy away from trying to use the "events" spec here. It seems to be going in a much different direction.
|
I agree. It's especially nasty to have something emitted with ilogger in the name from the OTLP exporter.
This was my intuition too, but I am open to trying it and continuing to solicit feedback from the community working on the event conventions. Adopting the event conventions as they are is important because the spec benefits from our participation in adopting them to drive them forward. |
This is what the spec says about InstrumentationScope and it matches closely with category definition.
This is one of the reasons I think we should not use |
Good point and I agree that CategoryName could be a good candidate for instrumentation scope name. In fact, this approach would allow our handling of CategoryName be shipped stable and we'd get rid of the This may be tricky as mentioned #4925 (comment), but it may be the right thing to do and we'll need to figure out a way to do it performantly. Circling back to address your comment with regards to event id and name.
No argument. However, this should not be conflated with what this PR is doing. This PR is attempting to adopt the event conventions. I am not aware of any users that have asked for that. For now, until someone successfully champions for something different in the spec, Also, side note, if you read open-telemetry/opentelemetry-specification#2994 carefully, you'll note that while the separate event.domain attribute may go away one suggestion is that its value is merged into |
addressing #4925 (comment) : This is a good point. However, we already do similar thing for spans and metrics [Spans are grouped by ActivitySource and Metrics are grouped by Meter]. We have a slightly optimized way of achieving this which we could further look in to improving. But the first step should be complying with stable spec. Not exporting LogRecord.CategoryName is not an option as this is also important information as per the feedback shared by users. I think we should go ahead use InstrumentationScope name for CategoryName. I am ok to try and keep that part experimental for user feedback. Regarding the Edit:
Proposal B in open-telemetry/semantic-conventions#372 is proposing |
These are questions I'm looking to you to answer. As the person recommending we use the event conventions, I'm leaning on you to describe how they're a good match for what you're trying to solve. We can't go into this ignoring the intentions of the folk who designed the conventions. We need to strive to understand their intentions and work with them to determine if we're heading down the right path. I appreciate that an issue was opened to start this discussion, but I think it's important we see it through before charging forth with whatever approach we deem convenient for our purposes. If you're finding applying the event conventions is too nebulous a challenge at this point in time. I have some other ideas for moving forward.
|
I am not recommending to use events conventions as is. If I was, I wouldn't put I see this as an opportunity to bring multiple languages in sync and not define our own conventions. It's not just .NET that needs And to add, we have not stopped for spec to ship stable things in the past so, I would like to understand the rationale behind blocking changes that depends on experimental spec and experimental feature flag. Additionally, I don't think we should be doing any workarounds. Setting experimental feature flag itself is workaround we are asking users to do on a stable library. |
In favor of making progress and unblocking this, I have updated the attributes to be @open-telemetry/dotnet-approvers @open-telemetry/dotnet-maintainers Please review. |
…b.com/vishweshbankwar/opentelemetry-dotnet into vibankwa/add-otlp-excluded-attributes
Logrecord.EventId
and LogRecord.CategoryName
Logrecord.EventId
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
towards #4875
Design discussion issue #
Changes
Introduces
OTEL_DOTNET_EXPERIMENTAL_OTLP_EMIT_EVENT_LOG_ATTRIBUTES
for exporting corresponding toLogRecord.EventId
. The attributes will be exported aslogrecord.event.id
andlogrecord.event.name
.Merge requirement checklist
CHANGELOG.md
files updated for non-trivial changes