You can view and analyze trace data collected from multiple Google Cloud projects in a single view by configuring a trace scope and the observability scope. A trace scope lists the resources to search for trace data, and the observability scope specifies which trace scope to use by default.
To view trace spans that are stored in multiple projects—for example, when an application in one project calls a service hosted in another project—do the following:
Identify the geographical storage location for the project where you plan to view trace data and for each project that stores trace data. For information about how to display the location of a project's observability bucket named
_Trace, see List observability buckets.When all projects store trace data in the same location, continue with the steps in this guide. For example, you can see a combined view of data from three projects that all store trace data in the
uslocation.Trace can't combine trace data stored in different locations.
For each project that stores trace data, ask your administrator to grant you the Cloud Trace User (
roles/cloudtrace.user) role on the project. This role lets you view the trace data stored in the project.For the project where you plan to view trace data, ask your administrator to grant you the following roles on that project:
- Cloud Trace User (
roles/cloudtrace.user) - Observability Scopes Editor (
roles/observability.scopesEditor)
- Cloud Trace User (
In the project where you plan to view trace data, do the following:
Create a trace scope and configure it to list the default trace view for each project that stores trace data.
A project's default trace view provides access to all trace data stored in the project and has the path
_Trace/Spans/_AllSpans, where the fields_Trace,Spans, and_AllSpansrefer to an observability bucket, a dataset, and a view. For information about trace scopes, see Create and manage trace scopes.Set your new trace scope as the default.
When you set a default trace scope, you also update the observability scope, which the Trace Explorer page uses to identify the resources to search for trace data. Because the observability scope also identifies the default log scope, it lets the system correlate log and trace data.
If you don't perform this step, the Trace Explorer page automatically searches only your selected project for trace data, and the system might not be able to correlate log and trace data. For more information, see Configure observability scopes for multi-project queries.
When the Trace Explorer page is open, use the Scope element in the toolbar to change which resources the page searches for trace data. For more information, see Configure which views the Trace Explorer searches.