-
Notifications
You must be signed in to change notification settings - Fork 370
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
Log enrichment and/or inserted properties #5929
Comments
I'll assign this to Amanda for more comment, but I don't expect this to happen. If you want something like Serilog, I'd suggest using Serilog with its Stackdriver integration. In the future I expect our diagnostics integration to be slimmer rather than more involved - I'm hoping that when https://github.com/googleapis/google-cloud-dotnet/tree/master/apis/Google.Cloud.Logging.Console is ready, that would be the simplest integration point, with Stackdriver just collecting log entries from the console. Designing our own fully-featured competitor to Serilog is something that I don't personally think we should invest time in. |
I tend to agree. I was really just looking for something in between. This package has the log schema, and I'm really just looking for a way to insert into that log schema rather than having to implement a completely new integration. Serilog doesn't have a 1st class Cloud Logging sink, it's maintained by a random community member. |
There's another alternative that you can use, and that is to use directly And another type of extra info you can add to the log entries is labels. We have |
Just leaving a note here to acknowledge the reply, thank you. I'll need to experiment with |
Yep, no rush at all. |
@jstafford5380 Just wanted to check if you've had a chance to try |
Oh I'm sorry I have not! I had to pass that project to a teammate so I could work on a different part of the cloud migration but it is still something I plan to do. I'll actually point him to this thread to see
if maybe he can give it a try, or see where he's at with it.
…On Thu, Apr 1, 2021 at 2:21 AM Amanda Tarafa Mas ***@***.***> wrote:
@jstafford5380 <https://github.com/jstafford5380> Just wanted to check if
you've had a chance to try ILogger.Log<TState>(LogLevel, EventId, TState,
Exception, Func<TState, Exception, string>) to add extra properties to
log entries?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#5929 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ALI4RECMKDXOSKJT6ZOCE63TGQ3KLANCNFSM4XLN6KZQ>
.
|
That's fine. I'll mark this one as |
Moves GoogleLoggerScope to Diagnostics.Common. In preparation for allowing LogEntry augmentation and making it easier to use Google logging from non ASP.NET Core apps. Towards googleapis#5313, googleapis#5360, googleapis#5929 and googleapis#6367
Moves GoogleLoggerScope to Diagnostics.Common. In preparation for allowing LogEntry augmentation and making it easier to use Google logging from non ASP.NET Core apps. Towards googleapis#5313, googleapis#5360, googleapis#5929 and googleapis#6367
Moves GoogleLoggerScope to Diagnostics.Common. In preparation for allowing LogEntry augmentation and making it easier to use Google logging from non ASP.NET Core apps. Towards googleapis#5313, googleapis#5360, googleapis#5929 and googleapis#6367
Moves GoogleLoggerScope to Diagnostics.Common. In preparation for allowing LogEntry augmentation and making it easier to use Google logging from non ASP.NET Core apps. Towards googleapis#5313, googleapis#5360, googleapis#5929 and googleapis#6367
Moves GoogleLoggerScope to Diagnostics.Common. In preparation for allowing LogEntry augmentation and making it easier to use Google logging from non ASP.NET Core apps. Towards googleapis#5313, googleapis#5360, googleapis#5929 and googleapis#6367
Moves GoogleLoggerScope to Diagnostics.Common. In preparation for allowing LogEntry augmentation and making it easier to use Google logging from non ASP.NET Core apps. Towards googleapis#5313, googleapis#5360, googleapis#5929 and googleapis#6367
Changes in Google.Cloud.Diagnostics.AspNetCore version 4.3.0-beta01: - [Commit 60e8cd8](googleapis@60e8cd8): - feat: Copies GoogleLogger to Common. This allows easier use of GoogleLogger in non ASP.NET Core applications. - Towards [issue 6367](googleapis#6367) - Replicate LoggerOptions in Common, and have AspNetCore\*.LoggerOptions be just a wrapper of Common.LoggerOptions. - Copies ILogEntryLabelProvider to Common and marks the one in AspNetCore* Obsolete. - Makes AspNetCore*.IExternalTraceProvider obsolete. It can now be replaced by Common.ITraceContext. - [Commit 32cb606](googleapis@32cb606): - feat: Allows per log entry labels. - Closes [issue 5313](googleapis#5313) - Closes [issue 5929](googleapis#5929) - [Commit c8e9a48](googleapis@c8e9a48): - refactor: Makes GoogleLoggerScope extendable. Moves GoogleLoggerScope to Diagnostics.Common. In preparation for allowing LogEntry augmentation and making it easier to use Google logging from non ASP.NET Core apps. Towards [issue 5313](googleapis#5313), [issue 5360](googleapis#5360), [issue 5929](googleapis#5929) and [issue 6367](googleapis#6367) - [Commit 7f5f89e](googleapis@7f5f89e): - docs: Change Stackdriver to Google Cloud, and fix some typos, including in test code. - [Commit c4c9cd5](googleapis@c4c9cd5): - feat: Makes it easier to use tracing from non ASP.NET Core applications Closes [issue 5897](googleapis#5897) Towards [issue 6367](googleapis#6367) - [Commit b35b9ea](googleapis@b35b9ea): - feat: Decouples Diagnostics tracing from Google's trace header. Towards [issue 5360](googleapis#5360) and [issue 5897](googleapis#5897) - [Commit 0c00d2c](googleapis@0c00d2c): - refactor: Remove unnecesary service provider extension method. There's an equivalent method offered by Microsoft.Extensions.DependencyInjection so we don't need our own. - [Commit bb0c7b2](googleapis@bb0c7b2): - refactor: Remove unnecesary interface IManagedTracerFactory. It's an internal interface that we don't use anywhere. We can always add it back in if we need it at some point. - [Commit 8ef3983](googleapis@8ef3983): - fix: X-Cloud-Trace-Context trace mask values should be 0-1. See https://cloud.google.com/trace/docs/setup#force-trace Note: changing a generic type parameter constraint in `LabelProviderExtensions` is notionally a breaking change, but due to how it will be used, we don't expect it to actually break any customers. Changes in Google.Cloud.Diagnostics.AspNetCore3 version 4.3.0-beta01: - [Commit 60e8cd8](googleapis@60e8cd8): - feat: Copies GoogleLogger to Common. - This allows easier use of GoogleLogger in non ASP.NET Core applications. - Towards [issue 6367](googleapis#6367) - Replicate LoggerOptions in Common. - And have AspNetCore*.LoggerOptions be just a wrapper of Common.LoggerOptions. - Copies ILogEntryLabelProvider to Common. - And marks the one in AspNetCore* Obsolete. - Makes AspNetCore*.IExternalTraceProvider obsolete. - It can now be replaced by Common.ITraceContext. - [Commit 32cb606](googleapis@32cb606): - feat: Allows per log entry labels. - Closes [issue 5313](googleapis#5313) - Closes [issue 5929](googleapis#5929) - [Commit c8e9a48](googleapis@c8e9a48): - refactor: Makes GoogleLoggerScope extendable. - Moves GoogleLoggerScope to Diagnostics.Common. - In preparation for allowing LogEntry augmentation and making it easier to use Google logging from non ASP.NET Core apps. - Towards [issue 5313](googleapis#5313), [issue 5360](googleapis#5360), [issue 5929](googleapis#5929) and [issue 6367](googleapis#6367) - [Commit 7f5f89e](googleapis@7f5f89e): - docs: Change Stackdriver to Google Cloud - And fix some typos, including in test code. - [Commit c4c9cd5](googleapis@c4c9cd5): - feat: Makes it easier to use tracing from non ASP.NET Core applications - Closes [issue 5897](googleapis#5897) - Towards [issue 6367](googleapis#6367) - [Commit b35b9ea](googleapis@b35b9ea): - feat: Decouples Diagnostics tracing from Google's trace header - Towards [issue 5360](googleapis#5360) and [issue 5897](googleapis#5897) - [Commit bb0c7b2](googleapis@bb0c7b2): - refactor: Remove unnecesary interface IManagedTracerFactory. - It's an internal interface that we don't use anywhere. We can always add it back in if we need it at some point. - [Commit 8ef3983](googleapis@8ef3983): - fix: X-Cloud-Trace-Context trace mask values should be 0-1. - See https://cloud.google.com/trace/docs/setup#force-trace Packages in this release: - Release Google.Cloud.Diagnostics.AspNetCore version 4.3.0-beta01 - Release Google.Cloud.Diagnostics.AspNetCore3 version 4.3.0-beta01 - Release Google.Cloud.Diagnostics.Common version 4.3.0-beta01
Changes in Google.Cloud.Diagnostics.AspNetCore version 4.3.0-beta01: - [Commit 60e8cd8](googleapis@60e8cd8): - feat: Copies GoogleLogger to Common. This allows easier use of GoogleLogger in non ASP.NET Core applications. - Towards [issue 6367](googleapis#6367) - Replicate LoggerOptions in Common, and have AspNetCore\*.LoggerOptions be just a wrapper of Common.LoggerOptions. - Copies ILogEntryLabelProvider to Common and marks the one in AspNetCore* Obsolete. - Makes AspNetCore*.IExternalTraceProvider obsolete. It can now be replaced by Common.ITraceContext. - [Commit 32cb606](googleapis@32cb606): - feat: Allows per log entry labels. - Closes [issue 5313](googleapis#5313) - Closes [issue 5929](googleapis#5929) - [Commit c8e9a48](googleapis@c8e9a48): - refactor: Makes GoogleLoggerScope extendable. Moves GoogleLoggerScope to Diagnostics.Common. In preparation for allowing LogEntry augmentation and making it easier to use Google logging from non ASP.NET Core apps. Towards [issue 5313](googleapis#5313), [issue 5360](googleapis#5360), [issue 5929](googleapis#5929) and [issue 6367](googleapis#6367) - [Commit 7f5f89e](googleapis@7f5f89e): - docs: Change Stackdriver to Google Cloud, and fix some typos, including in test code. - [Commit c4c9cd5](googleapis@c4c9cd5): - feat: Makes it easier to use tracing from non ASP.NET Core applications Closes [issue 5897](googleapis#5897) Towards [issue 6367](googleapis#6367) - [Commit b35b9ea](googleapis@b35b9ea): - feat: Decouples Diagnostics tracing from Google's trace header. Towards [issue 5360](googleapis#5360) and [issue 5897](googleapis#5897) - [Commit 0c00d2c](googleapis@0c00d2c): - refactor: Remove unnecesary service provider extension method. There's an equivalent method offered by Microsoft.Extensions.DependencyInjection so we don't need our own. - [Commit bb0c7b2](googleapis@bb0c7b2): - refactor: Remove unnecesary interface IManagedTracerFactory. It's an internal interface that we don't use anywhere. We can always add it back in if we need it at some point. - [Commit 8ef3983](googleapis@8ef3983): - fix: X-Cloud-Trace-Context trace mask values should be 0-1. See https://cloud.google.com/trace/docs/setup#force-trace Note: changing a generic type parameter constraint in `LabelProviderExtensions` is notionally a breaking change, but due to how it will be used, we don't expect it to actually break any customers. Changes in Google.Cloud.Diagnostics.AspNetCore3 version 4.3.0-beta01: - [Commit 60e8cd8](googleapis@60e8cd8): - feat: Copies GoogleLogger to Common. This allows easier use of GoogleLogger in non ASP.NET Core applications. - Towards [issue 6367](googleapis#6367) - Replicate LoggerOptions in Common, and have AspNetCore\*.LoggerOptions be just a wrapper of Common.LoggerOptions. - Copies ILogEntryLabelProvider to Common and marks the one in AspNetCore* Obsolete. - Makes AspNetCore*.IExternalTraceProvider obsolete. It can now be replaced by Common.ITraceContext. - [Commit 32cb606](googleapis@32cb606): - feat: Allows per log entry labels. - Closes [issue 5313](googleapis#5313) - Closes [issue 5929](googleapis#5929) - [Commit c8e9a48](googleapis@c8e9a48): - refactor: Makes GoogleLoggerScope extendable. Moves GoogleLoggerScope to Diagnostics.Common. In preparation for allowing LogEntry augmentation and making it easier to use Google logging from non ASP.NET Core apps. Towards [issue 5313](googleapis#5313), [issue 5360](googleapis#5360), [issue 5929](googleapis#5929) and [issue 6367](googleapis#6367) - [Commit 7f5f89e](googleapis@7f5f89e): - docs: Change Stackdriver to Google Cloud, and fix some typos, including in test code. - [Commit c4c9cd5](googleapis@c4c9cd5): - feat: Makes it easier to use tracing from non ASP.NET Core applications Closes [issue 5897](googleapis#5897) Towards [issue 6367](googleapis#6367) - [Commit b35b9ea](googleapis@b35b9ea): - feat: Decouples Diagnostics tracing from Google's trace header. Towards [issue 5360](googleapis#5360) and [issue 5897](googleapis#5897) - [Commit 0c00d2c](googleapis@0c00d2c): - refactor: Remove unnecesary service provider extension method. There's an equivalent method offered by Microsoft.Extensions.DependencyInjection so we don't need our own. - [Commit bb0c7b2](googleapis@bb0c7b2): - refactor: Remove unnecesary interface IManagedTracerFactory. It's an internal interface that we don't use anywhere. We can always add it back in if we need it at some point. - [Commit 8ef3983](googleapis@8ef3983): - fix: X-Cloud-Trace-Context trace mask values should be 0-1. See https://cloud.google.com/trace/docs/setup#force-trace Note: changing a generic type parameter constraint in `LabelProviderExtensions` is notionally a breaking change, but due to how it will be used, we don't expect it to actually break any customers. Packages in this release: - Release Google.Cloud.Diagnostics.AspNetCore version 4.3.0-beta01 - Release Google.Cloud.Diagnostics.AspNetCore3 version 4.3.0-beta01 - Release Google.Cloud.Diagnostics.Common version 4.3.0-beta01
Changes in Google.Cloud.Diagnostics.AspNetCore version 4.3.0-beta01: - [Commit 60e8cd8](60e8cd8): - feat: Copies GoogleLogger to Common. This allows easier use of GoogleLogger in non ASP.NET Core applications. - Towards [issue 6367](#6367) - Replicate LoggerOptions in Common, and have AspNetCore\*.LoggerOptions be just a wrapper of Common.LoggerOptions. - Copies ILogEntryLabelProvider to Common and marks the one in AspNetCore* Obsolete. - Makes AspNetCore*.IExternalTraceProvider obsolete. It can now be replaced by Common.ITraceContext. - [Commit 32cb606](32cb606): - feat: Allows per log entry labels. - Closes [issue 5313](#5313) - Closes [issue 5929](#5929) - [Commit c8e9a48](c8e9a48): - refactor: Makes GoogleLoggerScope extendable. Moves GoogleLoggerScope to Diagnostics.Common. In preparation for allowing LogEntry augmentation and making it easier to use Google logging from non ASP.NET Core apps. Towards [issue 5313](#5313), [issue 5360](#5360), [issue 5929](#5929) and [issue 6367](#6367) - [Commit 7f5f89e](7f5f89e): - docs: Change Stackdriver to Google Cloud, and fix some typos, including in test code. - [Commit c4c9cd5](c4c9cd5): - feat: Makes it easier to use tracing from non ASP.NET Core applications Closes [issue 5897](#5897) Towards [issue 6367](#6367) - [Commit b35b9ea](b35b9ea): - feat: Decouples Diagnostics tracing from Google's trace header. Towards [issue 5360](#5360) and [issue 5897](#5897) - [Commit 0c00d2c](0c00d2c): - refactor: Remove unnecesary service provider extension method. There's an equivalent method offered by Microsoft.Extensions.DependencyInjection so we don't need our own. - [Commit bb0c7b2](bb0c7b2): - refactor: Remove unnecesary interface IManagedTracerFactory. It's an internal interface that we don't use anywhere. We can always add it back in if we need it at some point. - [Commit 8ef3983](8ef3983): - fix: X-Cloud-Trace-Context trace mask values should be 0-1. See https://cloud.google.com/trace/docs/setup#force-trace Note: changing a generic type parameter constraint in `LabelProviderExtensions` is notionally a breaking change, but due to how it will be used, we don't expect it to actually break any customers. Changes in Google.Cloud.Diagnostics.AspNetCore3 version 4.3.0-beta01: - [Commit 60e8cd8](60e8cd8): - feat: Copies GoogleLogger to Common. This allows easier use of GoogleLogger in non ASP.NET Core applications. - Towards [issue 6367](#6367) - Replicate LoggerOptions in Common, and have AspNetCore\*.LoggerOptions be just a wrapper of Common.LoggerOptions. - Copies ILogEntryLabelProvider to Common and marks the one in AspNetCore* Obsolete. - Makes AspNetCore*.IExternalTraceProvider obsolete. It can now be replaced by Common.ITraceContext. - [Commit 32cb606](32cb606): - feat: Allows per log entry labels. - Closes [issue 5313](#5313) - Closes [issue 5929](#5929) - [Commit c8e9a48](c8e9a48): - refactor: Makes GoogleLoggerScope extendable. Moves GoogleLoggerScope to Diagnostics.Common. In preparation for allowing LogEntry augmentation and making it easier to use Google logging from non ASP.NET Core apps. Towards [issue 5313](#5313), [issue 5360](#5360), [issue 5929](#5929) and [issue 6367](#6367) - [Commit 7f5f89e](7f5f89e): - docs: Change Stackdriver to Google Cloud, and fix some typos, including in test code. - [Commit c4c9cd5](c4c9cd5): - feat: Makes it easier to use tracing from non ASP.NET Core applications Closes [issue 5897](#5897) Towards [issue 6367](#6367) - [Commit b35b9ea](b35b9ea): - feat: Decouples Diagnostics tracing from Google's trace header. Towards [issue 5360](#5360) and [issue 5897](#5897) - [Commit 0c00d2c](0c00d2c): - refactor: Remove unnecesary service provider extension method. There's an equivalent method offered by Microsoft.Extensions.DependencyInjection so we don't need our own. - [Commit bb0c7b2](bb0c7b2): - refactor: Remove unnecesary interface IManagedTracerFactory. It's an internal interface that we don't use anywhere. We can always add it back in if we need it at some point. - [Commit 8ef3983](8ef3983): - fix: X-Cloud-Trace-Context trace mask values should be 0-1. See https://cloud.google.com/trace/docs/setup#force-trace Note: changing a generic type parameter constraint in `LabelProviderExtensions` is notionally a breaking change, but due to how it will be used, we don't expect it to actually break any customers. Packages in this release: - Release Google.Cloud.Diagnostics.AspNetCore version 4.3.0-beta01 - Release Google.Cloud.Diagnostics.AspNetCore3 version 4.3.0-beta01 - Release Google.Cloud.Diagnostics.Common version 4.3.0-beta01
Describe the solution you'd like
Serilog is a pretty popular logger and it has the ability to enrich logs. It does this by decomposing objects into a list of properties that can be made available to the log output both as interpolated values but also as a list of properties which I believe are
format_parameters
in the stackdriver schema. I think right now, scalar properties get added asformat_parameters
, but objects only get serialized to json, but the properties of those objects are not added as queryable properties in the collection.It would be useful to have something similar to serilog in thsi respect, as part of this package, or at least some means to write extension packages to achieve this. I think this could be achieved by introducing some sort of middleware pipeline that can be added to configuration. This middleware (or chain of middlewares) would run on every log statement and allow a developer to insert additional properties to each log. I believe the way this is achieved in serilog is to make available, a collection of properties that can be accessed in the middleware, allowing the developer to read from and add to the collection that would ultimately be mapped into
format_parameters
Describe alternatives you've considered
I considered simply adding the desired properties to the actual log statement, but this approach is a bit more obtrusive.
Additional context
None.
The text was updated successfully, but these errors were encountered: