dt-obs-gcp

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

GCP Cloud Infrastructure

GCP云基础设施

Monitor and analyze GCP resources using Dynatrace Smartscape and DQL. Query GCP services, manage organizational hierarchy, audit security posture, and track resource ownership across your GCP infrastructure.
使用Dynatrace Smartscape和DQL监控并分析GCP资源。查询GCP服务、管理组织层级、审计安全态势,并追踪整个GCP基础设施中的资源归属。

When to Use This Skill

何时使用该技能

Use this skill when the user needs to work with GCP resources in Dynatrace. Load the reference file for the task type:
TaskFile to load
Inventory and topology queries(no additional file — use core patterns above)
Compute Engine instances, machine types, IP addressesLoad
references/compute-instances.md
GKE clusters, node pools, pods, deployments, services, RBACLoad
references/kubernetes-gke.md
Cloud Run services, revisions, executionsLoad
references/serverless-containers.md
VPC networks, subnets, routes, DNS recordsLoad
references/networking-dns.md
Pub/Sub topicsLoad
references/messaging-pubsub.md
IAM service accounts, roles, Secret ManagerLoad
references/iam-security.md
Monitoring dashboards, logging, saved queriesLoad
references/monitoring-logging.md
GCP projects, regions, organizational hierarchyLoad
references/resource-management.md
Resource ownership, GCP labels, organizational structureLoad
references/resource-ownership.md

当用户需要在Dynatrace中处理GCP资源时使用本技能。根据任务类型加载参考文件:
任务需加载的文件
资源清单与拓扑查询(无需额外文件 — 使用上方核心模式)
Compute Engine实例、机器类型、IP地址加载
references/compute-instances.md
GKE集群、节点池、Pod、部署、服务、RBAC加载
references/kubernetes-gke.md
Cloud Run服务、修订版本、执行记录加载
references/serverless-containers.md
VPC网络、子网、路由、DNS记录加载
references/networking-dns.md
Pub/Sub主题加载
references/messaging-pubsub.md
IAM服务账号、角色、Secret Manager加载
references/iam-security.md
监控仪表板、日志、已保存查询加载
references/monitoring-logging.md
GCP项目、区域、组织层级加载
references/resource-management.md
资源归属、GCP标签、组织结构加载
references/resource-ownership.md

Core Concepts

核心概念

Entity Types

实体类型

GCP resources use the
GCP_*
prefix and can be queried using the
smartscapeNodes
function. All GCP entities are automatically discovered and modeled in Dynatrace Smartscape.
Compute:
GCP_COMPUTE_GOOGLEAPIS_COM_INSTANCE
,
GCP_COMPUTE_GOOGLEAPIS_COM_ADDRESS
Networking:
GCP_COMPUTE_GOOGLEAPIS_COM_NETWORK
,
GCP_COMPUTE_GOOGLEAPIS_COM_SUBNETWORK
,
GCP_COMPUTE_GOOGLEAPIS_COM_ROUTE
,
GCP_DNS_GOOGLEAPIS_COM_RESOURCERECORDSET
Kubernetes (GKE):
GCP_K8S_IO_POD
,
GCP_K8S_IO_NODE
,
GCP_K8S_IO_SERVICE
,
GCP_K8S_IO_SERVICEACCOUNT
,
GCP_K8S_IO_PERSISTENTVOLUMECLAIM
,
GCP_APPS_K8S_IO_DEPLOYMENT
,
GCP_APPS_K8S_IO_STATEFULSET
,
GCP_CONTAINER_GOOGLEAPIS_COM_NODEPOOL
,
GCP_RBAC_AUTHORIZATION_K8S_IO_CLUSTERROLEBINDING
,
GCP_RBAC_AUTHORIZATION_K8S_IO_ROLEBINDING
Serverless:
GCP_RUN_GOOGLEAPIS_COM_SERVICE
,
GCP_RUN_GOOGLEAPIS_COM_REVISION
,
GCP_RUN_GOOGLEAPIS_COM_EXECUTION
IAM & Security:
GCP_IAM_GOOGLEAPIS_COM_SERVICEACCOUNT
,
GCP_IAM_GOOGLEAPIS_COM_ROLE
,
GCP_SECRETMANAGER_GOOGLEAPIS_COM_SECRETVERSION
Messaging:
GCP_PUBSUB_GOOGLEAPIS_COM_TOPIC
Monitoring:
GCP_MONITORING_GOOGLEAPIS_COM_DASHBOARD
,
GCP_LOGGING_GOOGLEAPIS_COM_SAVEDQUERY
Infrastructure:
GCP_REGION
GCP资源使用
GCP_*
前缀,可通过
smartscapeNodes
函数查询。所有GCP实体都会被自动发现并在Dynatrace Smartscape中建模。
计算类:
GCP_COMPUTE_GOOGLEAPIS_COM_INSTANCE
GCP_COMPUTE_GOOGLEAPIS_COM_ADDRESS
网络类:
GCP_COMPUTE_GOOGLEAPIS_COM_NETWORK
GCP_COMPUTE_GOOGLEAPIS_COM_SUBNETWORK
GCP_COMPUTE_GOOGLEAPIS_COM_ROUTE
GCP_DNS_GOOGLEAPIS_COM_RESOURCERECORDSET
Kubernetes(GKE):
GCP_K8S_IO_POD
GCP_K8S_IO_NODE
GCP_K8S_IO_SERVICE
GCP_K8S_IO_SERVICEACCOUNT
GCP_K8S_IO_PERSISTENTVOLUMECLAIM
GCP_APPS_K8S_IO_DEPLOYMENT
GCP_APPS_K8S_IO_STATEFULSET
GCP_CONTAINER_GOOGLEAPIS_COM_NODEPOOL
GCP_RBAC_AUTHORIZATION_K8S_IO_CLUSTERROLEBINDING
GCP_RBAC_AUTHORIZATION_K8S_IO_ROLEBINDING
无服务器类:
GCP_RUN_GOOGLEAPIS_COM_SERVICE
GCP_RUN_GOOGLEAPIS_COM_REVISION
GCP_RUN_GOOGLEAPIS_COM_EXECUTION
IAM与安全类:
GCP_IAM_GOOGLEAPIS_COM_SERVICEACCOUNT
GCP_IAM_GOOGLEAPIS_COM_ROLE
GCP_SECRETMANAGER_GOOGLEAPIS_COM_SECRETVERSION
消息类:
GCP_PUBSUB_GOOGLEAPIS_COM_TOPIC
监控类:
GCP_MONITORING_GOOGLEAPIS_COM_DASHBOARD
GCP_LOGGING_GOOGLEAPIS_COM_SAVEDQUERY
基础设施类:
GCP_REGION

Common GCP Fields

通用GCP字段

All GCP entities include:
  • gcp.project.id
    — GCP project identifier
  • gcp.region
    — GCP region (e.g., us-central1)
  • gcp.zone
    — GCP zone (e.g., us-central1-a)
  • gcp.organization.id
    — GCP organization identifier
  • gcp.resource.name
    — Resource name
  • gcp.resource.type
    — Resource type identifier
  • gcp.asset.type
    — GCP asset type
  • gcp.object
    — JSON blob containing full resource configuration
所有GCP实体均包含以下字段:
  • gcp.project.id
    — GCP项目标识符
  • gcp.region
    — GCP区域(例如:us-central1)
  • gcp.zone
    — GCP可用区(例如:us-central1-a)
  • gcp.organization.id
    — GCP组织标识符
  • gcp.resource.name
    — 资源名称
  • gcp.resource.type
    — 资源类型标识符
  • gcp.asset.type
    — GCP资产类型
  • gcp.object
    — 包含完整资源配置的JSON二进制大对象

GCP Organizational Hierarchy

GCP组织层级

GCP resources are organized in a hierarchy:
  • Organization — Top-level container (
    gcp.organization.id
    )
  • Folder — Logical grouping within an organization
  • Project — Resource container (
    gcp.project.id
    )
  • Region/Zone — Physical location (
    gcp.region
    ,
    gcp.zone
    )
GCP资源按以下层级组织:
  • 组织 — 顶层容器(
    gcp.organization.id
  • 文件夹 — 组织内的逻辑分组
  • 项目 — 资源容器(
    gcp.project.id
  • 区域/可用区 — 物理位置(
    gcp.region
    gcp.zone

Entity Naming Convention

实体命名规范

GCP entity types follow the pattern
GCP_<SERVICE_API>_<RESOURCE>
:
  • Service API maps to the Google API domain (e.g.,
    compute.googleapis.com
    COMPUTE_GOOGLEAPIS_COM
    )
  • Resource is the specific resource type (e.g.,
    INSTANCE
    ,
    NETWORK
    )
Examples:
  • GCP_COMPUTE_GOOGLEAPIS_COM_INSTANCE
    — Compute Engine VM
  • GCP_K8S_IO_POD
    — GKE pod
  • GCP_RUN_GOOGLEAPIS_COM_SERVICE
    — Cloud Run service

GCP实体类型遵循
GCP_<SERVICE_API>_<RESOURCE>
模式:
  • 服务API对应Google API域名(例如:
    compute.googleapis.com
    COMPUTE_GOOGLEAPIS_COM
  • 资源指具体的资源类型(例如:
    INSTANCE
    NETWORK
示例:
  • GCP_COMPUTE_GOOGLEAPIS_COM_INSTANCE
    — Compute Engine虚拟机
  • GCP_K8S_IO_POD
    — GKE Pod
  • GCP_RUN_GOOGLEAPIS_COM_SERVICE
    — Cloud Run服务

Query Patterns

查询模式

All GCP queries build on four core patterns. Master these and adapt them to any entity type.
所有GCP查询都基于四种核心模式。掌握这些模式后可适配至任意实体类型。

Pattern 1: Resource Discovery

模式1:资源发现

List resources by type, filter by project/region/zone, summarize counts:
dql
smartscapeNodes "GCP_COMPUTE_GOOGLEAPIS_COM_INSTANCE"
| fields name, gcp.project.id, gcp.region, gcp.zone, gcp.resource.name
To list all GCP resource types, replace with
"GCP_*"
and add
| summarize count = count(), by: {type} | sort count desc
. Add filters like
| filter gcp.project.id == "<PROJECT_ID>"
or
| filter gcp.region == "<REGION>"
to scope results.
按类型列出资源,按项目/区域/可用区筛选,汇总数量:
dql
smartscapeNodes "GCP_COMPUTE_GOOGLEAPIS_COM_INSTANCE"
| fields name, gcp.project.id, gcp.region, gcp.zone, gcp.resource.name
若要列出所有GCP资源类型,将上述语句替换为
"GCP_*"
并添加
| summarize count = count(), by: {type} | sort count desc
。可添加
| filter gcp.project.id == "<PROJECT_ID>"
| filter gcp.region == "<REGION>"
等筛选条件来限定结果范围。

Pattern 2: Configuration Parsing

模式2:配置解析

Parse
gcp.object
JSON for detailed configuration fields:
dql
smartscapeNodes "GCP_COMPUTE_GOOGLEAPIS_COM_INSTANCE"
| parse gcp.object, "JSON:gcpjson"
| fieldsAdd machineType = gcpjson[configuration][resource][machineType],
            status = gcpjson[configuration][resource][status]
| fields name, gcp.project.id, machineType, status
GCP configuration fields are nested under
gcpjson[configuration][resource][...]
for primary resource attributes and
gcpjson[configuration][additionalAttributes][...]
for extended properties.
解析
gcp.object
JSON以获取详细配置字段:
dql
smartscapeNodes "GCP_COMPUTE_GOOGLEAPIS_COM_INSTANCE"
| parse gcp.object, "JSON:gcpjson"
| fieldsAdd machineType = gcpjson[configuration][resource][machineType],
            status = gcpjson[configuration][resource][status]
| fields name, gcp.project.id, machineType, status
GCP配置字段中,主要资源属性嵌套在
gcpjson[configuration][resource][...]
下,扩展属性嵌套在
gcpjson[configuration][additionalAttributes][...]
下。

Pattern 3: Relationship Traversal

模式3:关系遍历

Follow relationships between resources:
dql
smartscapeNodes "GCP_COMPUTE_GOOGLEAPIS_COM_INSTANCE"
| traverse "*", "GCP_COMPUTE_GOOGLEAPIS_COM_SUBNETWORK"
| fields name, gcp.project.id
GCP entities use
"*"
as the relationship name in traversals because GCP entities do not have named relationship types. Use
fieldsKeep
to carry fields through traversals and
dt.traverse.history[-N]
to access ancestor fields.
追踪资源间的关系:
dql
smartscapeNodes "GCP_COMPUTE_GOOGLEAPIS_COM_INSTANCE"
| traverse "*", "GCP_COMPUTE_GOOGLEAPIS_COM_SUBNETWORK"
| fields name, gcp.project.id
GCP实体在遍历时使用
"*"
作为关系名称,因为GCP实体没有命名的关系类型。使用
fieldsKeep
在遍历过程中保留字段,使用
dt.traverse.history[-N]
访问祖先字段。

Pattern 4: Label-Based Ownership

模式4:基于标签的归属管理

Group resources by GCP labels for ownership and organizational tracking:
dql
smartscapeNodes "GCP_*"
| filter isNotNull(`tags:gcp_labels`)
| fields name, gcp.project.id, `tags:gcp_labels`
GCP labels are exposed via the
tags:gcp_labels
field and must be accessed using backtick syntax. Replace
"GCP_*"
with a specific type to scope to one service.

按GCP标签对资源进行分组,用于归属和组织追踪:
dql
smartscapeNodes "GCP_*"
| filter isNotNull(`tags:gcp_labels`)
| fields name, gcp.project.id, `tags:gcp_labels`
GCP标签通过
tags:gcp_labels
字段暴露,必须使用反引号语法访问。将
"GCP_*"
替换为特定类型可限定至单个服务。

Reference Guide

参考指南

Load reference files for detailed queries when the core patterns above need service-specific adaptation.
ReferenceWhen to loadKey content
compute-instances.mdCompute Engine VMs, machine types, IP addresses, disksInstance inventory, machine type distribution, status checks
kubernetes-gke.mdGKE clusters, node pools, pods, deployments, services, RBACCluster topology, workload distribution, RBAC bindings
serverless-containers.mdCloud Run services, revisions, executionsService inventory, revision tracking, execution analysis
networking-dns.mdVPC networks, subnets, routes, DNS recordsNetwork topology, subnet analysis, route tables, DNS record sets
messaging-pubsub.mdPub/Sub topicsTopic inventory, messaging topology
iam-security.mdIAM service accounts, roles, Secret ManagerService account audit, role analysis, secret version tracking
monitoring-logging.mdMonitoring dashboards, logging, saved queriesDashboard inventory, saved query analysis
resource-management.mdGCP projects, regions, organizational hierarchyProject inventory, region distribution, hierarchy mapping
resource-ownership.mdResource ownership, GCP labels, organizational structureLabel-based grouping, project-level summaries, chargeback

当核心模式需要针对特定服务调整时,加载参考文件获取详细查询语句。
参考文件加载时机核心内容
compute-instances.md处理Compute Engine虚拟机、机器类型、IP地址、磁盘时实例清单、机器类型分布、状态检查
kubernetes-gke.md处理GKE集群、节点池、Pod、部署、服务、RBAC时集群拓扑、工作负载分布、RBAC绑定
serverless-containers.md处理Cloud Run服务、修订版本、执行记录时服务清单、修订版本追踪、执行分析
networking-dns.md处理VPC网络、子网、路由、DNS记录时网络拓扑、子网分析、路由表、DNS记录集
messaging-pubsub.md处理Pub/Sub主题时主题清单、消息拓扑
iam-security.md处理IAM服务账号、角色、Secret Manager时服务账号审计、角色分析、密钥版本追踪
monitoring-logging.md处理监控仪表板、日志、已保存查询时仪表板清单、已保存查询分析
resource-management.md处理GCP项目、区域、组织层级时项目清单、区域分布、层级映射
resource-ownership.md处理资源归属、GCP标签、组织结构时基于标签的分组、项目级汇总、成本分摊

Best Practices

最佳实践

Configuration Parsing

配置解析

  1. Always parse
    gcp.object
    with JSON parser:
    parse gcp.object, "JSON:gcpjson"
  2. Access primary resource attributes via
    gcpjson[configuration][resource][...]
  3. Access extended properties via
    gcpjson[configuration][additionalAttributes][...]
  4. Check for null values after parsing with
    isNotNull()
  1. 始终使用JSON解析器解析
    gcp.object
    parse gcp.object, "JSON:gcpjson"
  2. 通过
    gcpjson[configuration][resource][...]
    访问主要资源属性
  3. 通过
    gcpjson[configuration][additionalAttributes][...]
    访问扩展属性
  4. 解析后使用
    isNotNull()
    检查空值

GCP Hierarchy

GCP层级

  1. Organization → Folder → Project → Region/Zone
  2. Use
    gcp.project.id
    as the primary scoping filter
  3. Use
    gcp.organization.id
    for cross-project queries
  4. Use
    gcp.region
    and
    gcp.zone
    for location-based analysis
  1. 层级顺序:组织 → 文件夹 → 项目 → 区域/可用区
  2. 使用
    gcp.project.id
    作为主要范围筛选条件
  3. 使用
    gcp.organization.id
    进行跨项目查询
  4. 使用
    gcp.region
    gcp.zone
    进行基于位置的分析

Entity Naming

实体命名

  1. Entity types follow the
    GCP_<SERVICE_API>_<RESOURCE>
    format
  2. Service API maps to the Google API domain with underscores replacing dots and hyphens
  3. Use specific entity types (avoid
    "GCP_*"
    wildcards when possible)
  1. 实体类型遵循
    GCP_<SERVICE_API>_<RESOURCE>
    格式
  2. 服务API对应Google API域名,用下划线替换点和连字符
  3. 使用特定实体类型(尽可能避免
    "GCP_*"
    通配符)

Labels

标签

  1. GCP labels must be accessed via backtick syntax:
    `tags:gcp_labels`
  2. Use
    isNotNull(
    tags:gcp_labels
    )
    for label-based filtering
  3. Track label coverage with summarize operations
  1. GCP标签必须使用反引号语法访问:
    `tags:gcp_labels`
  2. 使用
    isNotNull(
    tags:gcp_labels
    )
    进行基于标签的筛选
  3. 使用汇总操作追踪标签覆盖率

Relationship Traversal

关系遍历

  1. Use
    "*"
    as the relationship name — GCP entities do not have named relationship types
  2. Use
    fieldsKeep
    to maintain important fields through traversal
  3. Access traversal history with
    dt.traverse.history[-N]
  4. Complex topologies may require multiple traverse operations

  1. 使用
    "*"
    作为关系名称 — GCP实体没有命名的关系类型
  2. 使用
    fieldsKeep
    在遍历过程中保留重要字段
  3. 使用
    dt.traverse.history[-N]
    访问遍历历史
  4. 复杂拓扑可能需要多次遍历操作

Limitations and Notes

限制与说明

Smartscape Limitations

Smartscape限制

  • Smartscape data reflects the most recent scan; there may be a delay between GCP changes and Dynatrace visibility
  • Not all GCP services are represented as entity types
  • Some configuration fields may be null depending on resource setup
  • Resource discovery depends on GCP integration configuration
  • Smartscape数据反映最新扫描结果;GCP变更与Dynatrace可见性之间可能存在延迟
  • 并非所有GCP服务都以实体类型呈现
  • 根据资源设置,部分配置字段可能为空
  • 资源发现依赖GCP集成配置

GCP-Specific Notes

GCP特定说明

  • GCP labels must be accessed via backtick syntax:
    `tags:gcp_labels`
  • GCP entities use
    "*"
    for relationship traversal (no named relationship types)
  • GCP object configuration requires parsing with
    parse gcp.object, "JSON:gcpjson"
  • Configuration fields nest under
    gcpjson[configuration][resource][...]
    (differs from AWS pattern)
  • GCP标签必须使用反引号语法访问:
    `tags:gcp_labels`
  • GCP实体在关系遍历时使用
    "*"
    (无命名关系类型)
  • GCP对象配置需要使用
    parse gcp.object, "JSON:gcpjson"
    解析
  • 配置字段嵌套在
    gcpjson[configuration][resource][...]
    下(与AWS模式不同)

General Tips

通用提示

  • Filter early by project and region for better performance
  • Use
    isNotNull()
    and
    isNull()
    for graceful null handling
  • Combine project and region filters for large environments
  • Use
    countDistinct()
    for unique resource counts
  • Limit results with
    | limit N
    during exploration
  • 尽早按项目和区域筛选以提升性能
  • 使用
    isNotNull()
    isNull()
    优雅处理空值
  • 在大型环境中组合项目和区域筛选条件
  • 使用
    countDistinct()
    统计唯一资源数量
  • 探索时使用
    | limit N
    限制结果数量