Stackdriver Trace supports the ability to let you view in one Google Cloud Platform (GCP) project, trace spans generated by an application housed in a different GCP project. In this cross-project scenario, Trace automatically filters out spans that you don't have permission to view.
Consider the case where you have GCP projects
assume that an application hosted by project
B makes a gRPC call into
an application hosted by project
If you open the GCP console and select project
you can only view trace spans generated by the applications hosted
A. Specifically, you can't view the trace spans generated by
B when it makes a gRPC call into project
However, if you leverage the cross-project capability of Trace,
from the project
A GCP console, you can view the spans generated by
the application hosted by project
A, and you can view those spans
generated by the application hosted by project
B when it performs the
gRPC calls into project
This page provides details on setting up Stackdriver Trace so that you can view trace spans related GCP projects in one view.
To view trace spans across GCP projects, do the following:
Associate each of your GCP projects with the same organization.
If you are creating a new project in the context of the organization, it is automatically created under the organization resource.
You can see the organization in which you are creating your project in the New Project panel:
If you have a GCP project that isn't part of an organization, you can move it into your organization. For details, go to Migrating existing projects.
To test whether you have this permission, open the project selector at the top of the GCP Console and make sure you can see a drop-down menu of organizations:
Configure the applications to write traces to the projects in which they are hosted:
Viewing trace details across projects
After you have completed the Getting Started steps, do the following:
Find a trace by selecting Stackdriver > Trace > Trace list in the GCP Console, or click the following button:
Make sure you select one of the projects you have configured for cross-project trace viewing. In the previous example, you would select either project
It can take a few minutes for traces to appear the first time you use Trace. For more details, go to Finding and viewing traces. The following screenshot shows a sample Trace list page:
The trace results list and scatter plot will be based on the currently selected project only and not for other projects in the trace.
View a trace's details by clicking any request URI in the Trace list. The trace details appear below the graph:
Trace spans from all the projects associated with the trace are shown in the trace details. The trace details aren't limited to the traces spans for the currently selected project.
Click on any blue bar, which represents a trace span, in the Timeline panel. This opens a Details panel next to the Timeline panel. You can see which Project label is associated with the trace span and view related details.