-
Notifications
You must be signed in to change notification settings - Fork 369
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
Log trace association in Google.Cloud.Diagnostics.* 4.2.0-beta01 #5384
Comments
Thanks @EatonZ for using the library so fast and for creating the new issue :). When the Diagnostics tracing component is configured, if the mask is not set or is set to 0 (;o=0), then we completely ignore the trace/span: we don't set it in entries, we don't set You can try registering the TraceIdLogEntryLabelProvider. This is not the Google Trace, but an ASP.NET Core generated trace ID that is generated per request. And it's set in a |
It just seems correct to me to put in the span and trace IDs in logs when possible. Mainly to keep things organized. In some cases there won't be any IDs since the library will not create a span/provide any IDs, but the load balancer provides the IDs.
It does. Interestingly, it seems to sample randomly and not according to any setting. I already filed a bug for that. |
Yes, agree. But as per my explanation, doing so now is a breaking change. I've taken note to possibly include it in the future, no ETA whatsoever though. To keep formal track of this, I'm now closing this issue and adding it to our backlog in #5392. |
@amanda-tarafa Ok, thanks. Just to confirm, there's no workaround to force-set those fields in the meantime? I did note your ASP.NET suggestion. |
You can use your GoogleTraceProvider instead of the one that I added. Yours didn't take into account the mask to return the TraceId and the SpanId from the header, but, do take into account that traceSampled will be set to true. Also, I wonder if you force the mask (;o=1) on the response header, if the trace ends up being sampled. You might be able to do that on your GoogleTraceProvider as well, accessing the HttpContext.Response. But do take into accout that both those things are hacky workarounds, so, if you don't find specific documentation from Google Logging and Tracing that supports these, even if they work now for you, they can stop working at any time. |
Indeed - that's not ideal.
The load balancer has already made up its mind by that point, and I don't want to send that info to the client (load balancer does not send this header to the client by default). Hopefully you'll consider this for your next major version. In the meantime, as long as this bug gets fixed, everything should be ok for me. |
If the load balancer decides not to trace (does not send
;o=1
to my service), the log entry is missingtrace
,spanId
, andtraceSampled
.I'm not sure if that is correct, because now the log entry will have no association with the span/trace. Shouldn't
trace
andspanId
still be set, but nottraceSampled
in these cases?The text was updated successfully, but these errors were encountered: