使用 BigQuery Studio 查询轨迹数据

本文档介绍了如何从 BigQuery Studio 查询跟踪记录数据。使用 BigQuery Studio 时,您可以将跟踪记录数据与其他商家数据联接。

如需开始使用 Observability Analytics,请参阅 查询和分析跟踪记录

准备工作

  1. 登录您的 Google Cloud 账号。如果您是新手 Google Cloud, 请创建一个账号来评估我们的产品在 实际场景中的表现。新客户还可获享 $300 赠金,用于 运行、测试和部署工作负载。
  2. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Roles required to select or create a project

    • Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
    • Create a project: To create a project, you need the Project Creator role (roles/resourcemanager.projectCreator), which contains the resourcemanager.projects.create permission. Learn how to grant roles.

    Go to project selector

  3. Verify that billing is enabled for your Google Cloud project.

  4. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Roles required to select or create a project

    • Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
    • Create a project: To create a project, you need the Project Creator role (roles/resourcemanager.projectCreator), which contains the resourcemanager.projects.create permission. Learn how to grant roles.

    Go to project selector

  5. Verify that billing is enabled for your Google Cloud project.

  6. 如需获得从 BigQuery 查询关联数据集所需的权限,请让管理员向您授予以下 IAM 角色:

    • Observability View Accessor (roles/observability.viewAccessor) 针对您要查询的可观测性视图。此角色支持 IAM 条件,可让您将授予的权限限制为仅针对特定视图。如果您未为角色授予附加条件,则主账号可以访问所有可观测性视图。
    • BigQuery Data Viewer (roles/bigquery.dataViewer) 针对项目或关联的 BigQuery 数据集的

    如需详细了解如何授予角色,请参阅管理对项目、文件夹和组织的访问权限

    您也可以通过自定义 角色或其他预定义 角色来获取所需的权限。

  7. 验证您在存储跟踪记录数据的可观测性数据集上是否有关联的 BigQuery 数据集。如果关联的 BigQuery 数据集不存在,请创建该数据集。

在 BigQuery Studio 上运行查询

如需从 Observability Analytics 页面打开 BigQuery,然后查询跟踪记录数据,请执行以下操作:

  1. 在 Google Cloud 控制台中,前往 Observability Analytics 页面:

    前往 Observability Analytics

    如果您使用搜索栏查找此页面,请选择子标题为 Logging 的结果。

  2. 输入或加载查询。如需了解详情,请参阅 查询和分析跟踪记录

  3. 在工具栏中,展开标有运行查询在 BigQuery 上运行的菜单,然后选择在 BigQuery 中打开

    BigQuery Studio 随即会打开。在此页面上,FROM 语句 使用 BigQuery 表路径语法指定关联的数据集。您可以对查询执行任何受支持的操作,例如对其进行修改。

    如果在 BigQuery 中打开 选项处于停用状态,则表示关联的数据集不存在,或者您没有在 BigQuery 中打开和查看查询所需的权限。

  4. 在 BigQuery Studio 上,点击运行查询

价格

如需了解使用 BigQuery 相关的费用,请参阅 BigQuery 价格

后续步骤