-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Cannot query Loki using otel-lgtm #16202
Comments
Here is a bit more info on ASP.NET side of things, in case there is a need to repro. Dependencies are:
Startup/registration logic: webApplicationBuilder
.Services
.AddOpenTelemetry()
.ConfigureResource(fun builder ->
builder
.AddService(
serviceName = "backend_web",
serviceVersion =
(
typeof<Startup>.Assembly.GetName().Version
|> Option.ofObj
|> Option.map string
|> Option.defaultValue "unknown"
),
serviceInstanceId = Environment.MachineName
)
|> ignore
)
.WithMetrics(fun builder ->
builder
.AddMeter(requiredValue<string> telemetrySection "MeterName")
.AddAspNetCoreInstrumentation()
.AddRuntimeInstrumentation()
.AddProcessInstrumentation()
.AddOtlpExporter(fun opts ->
opts.Endpoint <- openTelemetryUri
)
|> ignore
)
.WithTracing(fun builder ->
builder
.AddAspNetCoreInstrumentation()
.AddOtlpExporter(fun opts ->
opts.Endpoint <- openTelemetryUri
)
|> ignore
)
.WithLogging(fun builder ->
builder
.AddOtlpExporter(fun opts ->
opts.Endpoint <- openTelemetryUri
)
|> ignore
)
|> ignore
From there, it was just a case of logging with an |
+1 having this same issue... No idea what's happening if this is Grafana or Loki actually causing the issue... |
This seems to come down to a bug in the .NET OpenTelemetry implementation. On startup, ASP.NET uses the public KeyValuePair<string, object?> this[int index] => index switch
{
0 => new KeyValuePair<string, object?>(nameof(_request.Protocol), _request.Protocol),
1 => new KeyValuePair<string, object?>(nameof(_request.Method), _request.Method),
2 => new KeyValuePair<string, object?>(nameof(_request.ContentType), _request.ContentType),
3 => new KeyValuePair<string, object?>(nameof(_request.ContentLength), _request.ContentLength),
4 => new KeyValuePair<string, object?>(nameof(_request.Scheme), _request.Scheme),
5 => new KeyValuePair<string, object?>(nameof(_request.Host), _request.Host.Value),
6 => new KeyValuePair<string, object?>(nameof(_request.PathBase), _request.PathBase.Value),
7 => new KeyValuePair<string, object?>(nameof(_request.Path), _request.Path.Value),
8 => new KeyValuePair<string, object?>(nameof(_request.QueryString), _request.QueryString.Value),
9 => new KeyValuePair<string, object?>("{OriginalFormat}", OriginalFormat),
_ => throw new ArgumentOutOfRangeException(nameof(index)),
}; If any of those attribute have a Downstream of this, the OpenTelemetry implementation has this code in its public bool TryWriteTag(
ref TTagState state,
string key,
object? value,
int? tagValueMaxLength = null)
{
if (value == null)
{
return false;
} Thus, when any attribute is written with a I will open an issue with the .NET team and link back to here. |
(migrated from here)
Describe the bug
I'm using latest
otel-lgtm
and hooked into it via an ASP.NET backend usingOpenTelemetry.Exporter.OpenTelemetryProtocol
. Metrics seem to work fine, but not so for logs. If I attempt a query over a time range that includes some log entries I get the following error (enabled Loki logging to see this):Maybe it's because I'm new to this stack but I have no idea what it's complaining about or how to rectify. Help would be very much appreciated.
To Reproduce
Steps to reproduce the behavior:
sha256:7b7644781f8f801bb8639872e6a8aef28ee94b59bc82f41bd75725aef872c02d
)<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.11.1" />
repro.mp4
Expected behavior
I was expecting to see the captured logs.
Environment:
Screenshots, Promtail config, or terminal output
See above.
The text was updated successfully, but these errors were encountered: