Cloud Trace supports read-time aggregation of stored trace spans, which lets you view and analyze trace data that originates in multiple projects. To configure read-time aggregation, create a trace scope.
Trace storage and views
Spans sent to your Google Cloud project are always stored in a
dataset named Spans. This dataset is created and managed by an
observability bucket named _Trace. There is one view on the dataset,
_AllSpans, which includes every span in the dataset. You can't create custom
views.
The system creates the _Trace bucket in a project when that project receives
spans and the bucket doesn't exist. If default settings for observability buckets
are configured, then the system uses those settings to select the location and
encryption model. Otherwise, the system selects a location and uses a
Google-owned and Google-managed encryption key. If the location or encryption model doesn't
satisfy your regulatory requirements, then you can
reprovision your _Trace bucket.
Configure read-time aggregation using trace scopes
To query trace spans that are stored in multiple projects, create a trace scope in your viewing project and then set it as the default trace scope. When you open the Trace Explorer page, the page automatically queries the views listed in the scope for data and then displays the spans that you have permission to see.
A trace scope can include at most 200
entries, where each entry is a dataset's _AllSpans view. Although both
the Google Cloud console and Google Cloud CLI require that you specify
projects, the system adds each project's _AllSpans view to the scope. To
aggregate trace data from more than 200
projects, create multiple trace scopes.
For more information, see Configure observability scopes for multi-project queries.
Roles required to view trace data
The Cloud Trace User (roles/cloudtrace.user) role
includes all permissions necessary to use the Trace Explorer page
and to view data stored in the project where this role is granted.
Grant principals the Cloud Trace User role on the project where they view trace data and on all projects that store trace data.