-
Notifications
You must be signed in to change notification settings - Fork 782
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
Adding a property to the LogRecordData struct #5275
Conversation
|
OpenTelemetry.Logs.LogRecordData.CategoryName.get -> string! | ||
OpenTelemetry.Logs.LogRecordData.CategoryName.set -> void |
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.
Need to understand the user scenario regarding why new APIs need to be introduced. (working around an exporter exception doesn't justify adding new API in the SDK)
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.
Hi, sorry I should have explained this. I created an NLog target in order to export NLog logs using the OtlpExporter. The idea there is that I could create multiple NLog loggers, all logs would be sent to one OpenTelemetry logger and CategoryName of each log would then be set to the name of the original NLog logger.
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.
@AB027PS Right here where you retrieve your Logger
: https://github.com/juliuskoval/NLog.Targets.OpenTelemetryProtocol/blob/64022137497508953f227457401d320171e1a7e3/NLog.Targets.OpenTelemetryProtocol/OtlpTarget.cs#L57
At the moment you aren't supplying a name. What you probably want to do is do something like loggerProvider.GetLogger(nlogLoggerInstance.Name)
(essentially create a Logger
for each NLog logger). That will establish the "instrumentation scope" as the spec describes it. Then if you modify the OtlpExporter to check LogRecord.Logger.Name
when it doesn't have a CategoryName
everything should work as you want.
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.
I see what you mean. I created a new PR.
I don't think this is a change we're willing to take at this time. I don't speak for everyone, but I think we would be willing to accept a PR which updates the OtlpExporter to use |
+1 to what Blanch suggested. |
@CodeBlanch I had seen the spec, but the way I understood it is that the bridge API must accept the listed parameters, but that it may accept others. |
Fixes #5274
Changes
This would add a new property to the LogRecordData struct with a default value, which would allow us to set LogRecord.CategoryName when using the logging bridge API
Merge requirement checklist
CHANGELOG.md
files updated for non-trivial changes