No data in the Trace interface
If you can't view traces in your Google Cloud project when you expect trace data to be present, try the following steps:
In the Google Cloud Console, in the toolbar click menu Navigation menu and select APIs & Services.
In the dashboard that lists all APIs, ensure that the Cloud Trace API is listed. If Cloud Trace API is listed in the table, then the API is enabled. Please proceed to the next numbered step.
If Cloud Trace API isn't listed, then the API isn't enabled. To enable the Cloud Trace API, click Enable APIs and Services, and then search for Trace API. If you see an entry for Cloud Trace API, select it. Otherwise, select Stackdriver Trace API. After you have selected the API, click Enable.
In the dashboard that lists all APIs, if the row for the Cloud Trace API doesn't list any numeric values for the Requests column, Errors column, or for other columns, that indicates that no trace requests are reaching your Google Cloud project. Check your applications and proxies to ensure they are configured to send the traces to the correct project.
To view details about the API usage, click Cloud Trace API, and then click Metrics.
To narrow down the source of the errors, use the Credentials and Methods filters and view the effect your selections have on the Errors by API method chart:
If all writes are failing, ensure that your service account has access to the Cloud Trace Agent role. This role includes the permission
cloudtrace.traces.patch. For more information, see Cloud Trace IAM roles.
If reads are failing, ensure that you have access to the Cloud Trace User role for this Google Cloud project. For a full list of permissions for this role, see Cloud Trace IAM roles.
Upload of spans for the Go OpenCensus exporter fails
The following are examples of errors that occur when the bundler library used by the exporter is unable to manage the number of spans the application is generating and uploading:
OpenCensus Stackdriver exporter: failed to upload span: buffer full OpenCensus Stackdriver exporter: failed to upload 183 spans: buffer full
To resolve this situation, try one or more of the following:
Optionsstruct passed to the
traceExporterconstructor, increase the value of the
TraceSpansBufferMaxBytesfield. This optional field specifies the maximum number of bytes used for buffering spans. The default value is 8MB.
Optionsobject passed to the
traceExporterconstructor, decrease the values for the following fields:
BundleDelayThreshold: This optional field specifies the maximum time the exporter can wait before uploading trace spans. The default value of this field is two seconds.
BundleCountThreshold: This optional field specifies the number of spans that can be buffered. The default value of this field is 50.
Export fewer spans. To reduce the number of spans you export, configure a global sampler or pass a sampler to each
StartSpan. For sample code and more information about these configurations, see OpenCensus Sampling.