Viewing traces across projects

Cloud Trace supports the ability to let you view in one Google Cloud project, trace spans generated by an application housed in a different Google Cloud 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 Google Cloud projects A and B, and assume that an application hosted by project B makes a gRPC call into an application hosted by project A. If you open the Google Cloud console and select project A, you can only view trace spans generated by the applications hosted by project A. Specifically, you can't view the trace spans generated by project B when it makes a gRPC call into project A.

However, if you leverage the cross-project capability of Trace, from the project A Google Cloud 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 A.

This page provides details on setting up Cloud Trace so that you can view trace spans related Google Cloud projects in one view.

Getting started

To view trace spans across Google Cloud projects, do the following:

  1. Associate each of your Google Cloud projects with the same organization.

    • If you are creating a new project in the context of the organization, it is automatically created in the organization resource.

      You can see the organization in which you are creating your project in the New Project dialog:

      New project pane displaying your organization.

    • If you have a Google Cloud project that isn't part of an organization, you can move it into your organization. For details, see Migrating existing projects.

  2. Make sure you have the Cloud Trace User Identity and Access Management (IAM) role and Logging Viewer IAM role for each project.

  3. Make sure you have the resourcemanager.organizations.get permission for read access to the projects' organization. This permission is part of the Organization viewer IAM role.

    To test whether you have this permission, open the project selector at the top of the Cloud Console and make sure you can see a drop-down menu of organizations:

    Cloud Trace organization view.

  4. 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:

  1. In the Cloud Console, select Trace, and then Trace list, or click the following button:

    Go to Trace List

    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 A or B.

    It can take a few minutes for traces to appear the first time you use Trace. For more details, see Finding and viewing traces. The following screenshot shows a sample Trace list page:

    Cloud 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.

  2. View a trace's details by clicking any request URI in the Trace list. The trace details appear below the graph:

    Cloud Trace details pane.

    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.

  3. Click on any blue bar, which represents a trace span, in the timeline to view the Details pane. You can see which Project label is associated with the trace span and view related details.

What's next