Viewing traces across projects

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 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 GCP 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 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 A.

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

Getting started

To view trace spans across GCP projects, do the following:

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

      New project pane displaying your organization.

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

  2. Make sure you have the Cloud Trace User Cloud Identity and Access Management (Cloud IAM) role and Logging Viewer Cloud 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 Cloud IAM role.

    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:

    Stackdriver 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. Find a trace by selecting Stackdriver > Trace > Trace list in the GCP Console, or click the following button:

    Go to the Trace List page

    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, go to Finding and viewing traces. The following screenshot shows a sample Trace list page:

    Stackdriver 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:

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

What's next

หน้านี้มีประโยชน์ไหม โปรดแสดงความคิดเห็น

ส่งความคิดเห็นเกี่ยวกับ...

หากต้องการความช่วยเหลือ ให้ไปที่หน้าการสนับสนุน