opentelemetry-dotnet-contrib icon indicating copy to clipboard operation
opentelemetry-dotnet-contrib copied to clipboard

GenevaLogExporter: respect CustomFields when processing scope key values pairs.

Open jviau opened this issue 2 years ago • 0 comments

Issue with OpenTelemetry.Exporter.Geneva

List of all OpenTelemetry NuGet packages and version that you are using (e.g. OpenTelemetry 1.0.2):

Runtime version (e.g. net462, net48, netcoreapp3.1, net6.0 etc. You can find this information from the *.csproj file):

  • All

Is this a feature request or a bug?

  • [x] Feature Request
  • [ ] Bug

What is the expected behavior?

Logger scope support respects CustomFields. As in, when an encountered scope property is part of GenevaExporterOptions.CustomFields, it will be emitted as its own column. Similarly to how the log record key value pairs behave.

What is the actual behavior?

Logger scope support only puts scope properties in a specific scopes column.

Additional Context

This issue is observed from just reading the code. If I am incorrect and custom fields is actually respected when processing scopes please close this.

Some justification / use case: it is common for a team to have a specific field they find very valuable and want to include it in all logs as a top level property in geneva logs. For example, in AspNetCore some properties like this might be some caller context info: caller tenant, subscription, etc. Or in the case of Azure Resource Providers, we are required to include a CorrelationId property on all our traces and logs. Exposing this as a top level property would be helpful. For these properties, it is cumbersome to ensure they are included in every log message as an explicit property. Instead, we tend to start a log scope with them as properties in a middleware, so all logs within the request get these scope values.

jviau avatar Jul 07 '22 18:07 jviau