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

Add ILoggingBuilder Plugin for Logs

Open rajkumar-rangaraj opened this issue 3 years ago • 2 comments

Feature Request

Describe the solution you'd like A clear and concise description of what you want to happen.

With current implementation, if customer has to use the logs and apply filter code modification is required. We providing a plugin hook to ILoggingBuilder interface will help customer to use a plugin instead of code modification/deployment.

rajkumar-rangaraj avatar Sep 22 '22 22:09 rajkumar-rangaraj

We're working on an Elastic distro of the SDK and auto instrumentation. For the auto instrumentation, we utilise a plugin to register our Elastic defaults via BeforeConfigureTracerProvider and BeforeConfigureMeterProvider. There is no such option for running out defaults using our extension method on LoggerProviderBuilder. From a cursory glance, it looks like auto instrumentation hooks the logging registration via the ILoggingBuilder, so having a mechanism, as proposed above, would be extremely useful. It's something I could contribute to unblock us.

Before starting anything, I wanted to check if ILoggingBuilder is still the preferred choice for registering log observation. Should Instrumentation also support registering via the LoggerProviderBuilder? How would those two interact?

cc @Kielek

stevejgordon avatar Nov 21 '24 15:11 stevejgordon

@stevejgordon, do you have any specific scenario to cover? I am not against, but keep in mind that the Logger (Bridge) API is still unstable and non-available in stable builds. Could you please create POC? I think it will be easier to discuss details in this way.

Ref: Experimental APIs for Logging -https://github.com/open-telemetry/opentelemetry-dotnet/tree/main/docs/diagnostics/experimental-apis Integration for log4net: #3825, still in progress

Kielek avatar Nov 27 '24 12:11 Kielek

Reviving this as we are currently developing a custom log exporter for our AWS customers. We have a custom Auto-Instrumentation Distribution of Opentelemetry and we are plugging our custom traces and metrics exporters using the Plugins module. However, seems like the LogProvider is currently not customizable and I see this issue is a bit old. Are there any plans for adding a LogProvider callback function through the Plugin.cs module? Alternatively, any workaround for plugging in our custom log exporter?

Jeel-mehta avatar Jul 18 '25 20:07 Jeel-mehta

@Jeel-mehta, my previous comment is still valid. There is no progress in Logger (Bridge) API stabilization. I suppose that you are pretty familiar with auto-instrumentation code, as you are creating plugins for it.

It will be great to see POC for your request, both in this repository/possible implementation to discuss it on of next SIG mietings.

Kielek avatar Jul 21 '25 04:07 Kielek