-
Notifications
You must be signed in to change notification settings - Fork 809
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
[sdk-logs] Support enrichment of LogRecords #5454
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5454 +/- ##
==========================================
+ Coverage 83.38% 85.21% +1.82%
==========================================
Files 297 290 -7
Lines 12531 12456 -75
==========================================
+ Hits 10449 10614 +165
+ Misses 2082 1842 -240
Flags with carried forward coverage won't be shown. Click here to find out more.
|
Haven't checked the actual code, but a quick thought. https://github.com/dotnet/extensions/tree/main/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions#log-enrichment this looks ready, but haven't tested myself. |
@dariusclay to comment on plans for https://github.com/open-telemetry/opentelemetry-dotnet-contrib/tree/main/src/OpenTelemetry.Extensions.Enrichment as well. We should try and keep a single solution, unless there is a strong reason to have multiple... |
To add some context here... The use case I got from @vishweshbankwar is for AzureMonitor which wants to modify this processor to be something like... public override void OnEnd(LogRecord logRecord)
{
if (logRecord.SpanId == default || logRecord.TraceFlags == ActivityTraceFlags.Recorded)
{
logRecord.AddAttribute(new KeyValuePair<string, object?>("azureMonitor.samplingRate", value));
base.OnEnd(logRecord);
}
} Some thoughts... SDK supports enrichment today because
|
@CodeBlanch I understand the desire to have a
|
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 suggest that we should first align on where enrichment should happen, and discuss this with the owners of ILogger and Microsoft.Extensions.Telemetry.Abstractions, so we don't end up with 3 confusing mechanisms while each solving 80% of the problems.
One approach would be documenting the end goal / experience before the actual implementation https://github.com/open-telemetry/opentelemetry-dotnet/tree/main/docs/logs#log-enrichment
Alignment? 🤔
We MUST support specifically enrichment via processors. Which we already do. The question is: Do we want to make it efficient and easy to do or no? |
This PR was marked stale due to lack of activity and will be closed in 7 days. Commenting or Pushing will instruct the bot to automatically remove the label. This bot runs once per day. |
This PR was marked stale due to lack of activity and will be closed in 7 days. Commenting or Pushing will instruct the bot to automatically remove the label. This bot runs once per day. |
The extensions mentioned here were to bridge the gap in current .NET 8 support for trace enrichment. I will try to get an update but from last time this was spoken about internally the goal was to have proper trace enrichment natively inside .NET 9. |
The "extended" logger is what enables redaction and enrichment. |
This PR was marked stale due to lack of activity and will be closed in 7 days. Commenting or Pushing will instruct the bot to automatically remove the label. This bot runs once per day. |
This PR was marked stale due to lack of activity and will be closed in 7 days. Commenting or Pushing will instruct the bot to automatically remove the label. This bot runs once per day. |
This PR was marked stale due to lack of activity and will be closed in 7 days. Commenting or Pushing will instruct the bot to automatically remove the label. This bot runs once per day. |
Closed as inactive. Feel free to reopen if this PR is still being worked on. |
[Opening as a draft to discuss if this is something we want to do.]
Changes
AddAtribute
API onLogRecord
to give users wanting to do enrichment a very efficient way to do itMerge requirement checklist
CHANGELOG.md
files updated for non-trivial changes