-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
OpenTelemetry traces misused by transport/http #1573
Comments
A related issue: googleapis/google-cloud-go#1573 |
Also related: census-instrumentation/opencensus-go#1180 |
This is a bit tricky... I think we could easily do as you suggest, but then there could be no aggregations on method level calls. In general most of our libraries are not nicely producing their own spans, so we rely on the naming to capture the context of the call. Making this change would force nearly all API calls to have the same span name. Do you think think is much better than many span names?(maybe it is) For storage, on the reader side we do create custom spans. It seems to me that we should also do the same on the writer side, that would alleviate the example you provided at least. If we did aggregate these I suppose people could always examine the http.path attribute for reporting, but I am not sure that is much better than what is there today in this case. Thoughts? |
workaround that works for me:
in tracingutils package:
|
I think it would be better for the Cloud APIs that have user-generated content in the paths. In our case we saw a memory leak of several GB in one of our production services because of this default. So perhaps this suggestion of yours is the way to go:
And perhaps also worth inspecting the other Cloud APIs beyond Storage to see whether they have user-generated content in the Paths. Hopefully it's just Storage writes that are a problem. |
The
transport/http
package by default wraps the HTTP transport with an OpenTelemetryochttp.Transport
. That transport wrapper will record HTTP traces for a subset of all requests if OpenCensus tracing is enabled.However, it is misconfigured. The
Transport
type has this field, which is unsetgoogle-api-go-client
:The default is for the transport to name each span after the request URL path. In practice, this means a proliferation of differently named spans. For example, if you use the Google Cloud Storage library, you will end up with a span for every file you access. This is not how spans are supposed to be named - they should be named after a function or API endpoint, perhaps including some small, finite set of user-specified options.
This becomes pathological if you actually record the traces somewhere. For instance, if you have the OpenCensus
zpages
debug endpoints enabled (common in production systems), a sample of those traces will be stored in a local store. While old traces for a given span are purged, the spans themselves are never purged, and so a running process will accumulate traces indefinitely for every HTTP request path made bygoogle-api-go-client
. Loading the OpenCensustracez
page in such cases is pretty funny: a production service of mine had accumulated several gigabytes of traces, and itstracez
endpoint served so much HTML that it crashed my browser.I think the fix here is to specify a
FormatSpanName
function when setting up theochttp.Transport
. I'm not sure how exactly the spans should be named - probably in some service-specific way - but an immediate remedy would be to give all requests the same span name (google-api-go-client
?).The text was updated successfully, but these errors were encountered: