Package | Info | Description |
---|---|---|
MiniDataProfiler | Core | |
MiniDataProfiler.Listener.Logging | Microsoft.Extensions.Logging Listener | |
MiniDataProfiler.Listener.OpenTelemetry | OpenTelemetry Listener |
- Simple profiler for ADO.NET
// Setup Logger
using var loggerFactory = LoggerFactory.Create(builder =>
{
builder
.AddFilter("MiniDataProfiler.Listener.Logging", LogLevel.Information)
.AddConsole();
});
var logListener = new LoggingListener(loggerFactory.CreateLogger<LoggingListener>(), new LoggingListenerOption());
// Setup OpenTelemetry
using var tracerProvider = Sdk.CreateTracerProviderBuilder()
.ConfigureResource(config =>
{
config.AddService("Example", serviceInstanceId: Environment.MachineName);
})
.AddMiniDataProfilerInstrumentation()
.AddOtlpExporter(config =>
{
config.Endpoint = new Uri("http://otlp-exporter:4317");
})
.Build();
// Listeners
var listener = new ChainListener(logListener, new OpenTelemetryListener(new OpenTelemetryListenerOption()));
// Use ProfileDbConnection
using var con = new ProfileDbConnection(listener, new SqliteConnection(connectionString));
...