-
Notifications
You must be signed in to change notification settings - Fork 293
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
[Exporter.Geneva] Add DI support for GenevaLogExporter #613
Comments
Could you please let us which method you want to see on Geneva Log Exporter in DI? |
Yes, I'm talking about OpenTelemetryLoggerOptions.AddGenevaLogExporter specifically. Within the extension method |
Hey, I wonder if is this available yet? I would like to have this:
, where I can add custom scrubbing rules through Host builder @CodeBlanch |
Update for everyone. This is not available yet. Sorry! We're waiting on the OpenTelemetry Specification to declare log API/SDK specs stable before we do anything. Hoping that will be soon and then we can have parity in logs with the DI API surface we have for tracing & metrics. Current plan is for 1.6 to ship the SDK support and then we can update things like GenevaExporter. That being said, you can accomplish some stuff today with a bit of ugly code! Here is a startup snippet which accomplishes what some of the above is requesting... appBuilder.Logging.AddOpenTelemetry();
appBuilder.Services.AddSingleton<Custom_Log_Scrubber_Rule_List>();
appBuilder.Services.AddOptions<OpenTelemetryLoggerOptions>().Configure<IServiceProvider>((options, sp) =>
{
options.AddProcessor(sp.GetRequiredService<Custom_Log_Scrubber_Rule_List>());
options.AddGenevaLogExporter(genevaOptions =>
{
appBuilder.Configuration.GetSection("GenevaExporter").Bind(genevaOptions);
});
}); The key bit of knowledge is that |
Update...
|
Update...
Logging code can now be made to work exactly like tracing & metrics.
services
.AddOpenTelemetry()
.WithLogging(
builder =>
{
builder.AddProcessor<MyProcessor>(); // Example of calling a DI-friendly API
builder.AddGenevaLogExporter(o => o.ConnectionString = "<fill out>");
},
options => options.IncludeFormattedMessage = true);
using var loggerFactory = LoggerFactory.Create(logging =>
{
logging.AddOpenTelemetry(options => options.IncludeFormattedMessage = true);
logging.Services.ConfigureOpenTelemetryLoggerProvider(builder =>
{
builder.AddProcessor<MyProcessor>(); // Example of calling a DI-friendly API
builder.AddGenevaLogExporter(o => o.ConnectionString = "<fill out>");
});
}); |
Issue with OpenTelemetry.Exporter.Geneva
List of all OpenTelemetry NuGet packages and version that you are using:
Runtime version:
Is this a feature request or a bug?
What is the expected behavior?
It would be great if we can add DI support for GenevaLogExporter, similar to what we have for GenevaMetricExporter and GenevaTraceExporter. This is possible now that open-telemetry/opentelemetry-dotnet#3504 is released.
The text was updated successfully, but these errors were encountered: