Open
Description
Package
OpenTelemetry
Package Version
Package Name | Version |
---|---|
OpenTelemetry.Api | 1.11.1 |
OpenTelemetry | 1.11.1 |
TBD | TBD |
Runtime Version
8
Description
This seems still reproducible with 1.11.1.
Steps to Reproduce
Here is samle code -
string loggingendpoint = Environment.GetEnvironmentVariable("LOGGING_GRPC_ENDPOINT") ?? "localhost";
if (string.IsNullOrEmpty(loggingendpoint))
{
Console.WriteLine("No logging endpoint provided.");
}
AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", true);
Console.WriteLine($"Logging endpoint: {loggingendpoint}");
using var loggerFactory = LoggerFactory.Create(builder =>
{
builder.AddOpenTelemetry(options =>
{
options.IncludeScopes = true;
options.IncludeFormattedMessage = true;
options.AddConsoleExporter();
options.AddOtlpExporter((exOpt, pOpts) =>
{
exOpt.Endpoint = new Uri($"http://{loggingendpoint}");
exOpt.Protocol = OtlpExportProtocol.Grpc;
});
});
});
var logger = loggerFactory.CreateLogger("Log");
using (logger.BeginScope(new List<KeyValuePair<string, object>>{
new KeyValuePair<string, object>("category", "OTLPLOGExporter"),
}))
{
logger.LogInformationWithDetails($"LOGGING_GRPC_ENDPOINT {loggingendpoint}");
logger.LogInformationWithDetails("All Done!");
// to flush the in-memory buffer and ensure all logs are exported.
loggerFactory.Dispose();
}
Expected Result
Logs successfully exported
Actual Result
Logs not able to get exported. No errors.
Additional Context
No response
Activity