跟踪 span 属性和事件

客户端轨迹通过执行 RPC 收集,可为客户端的每个请求提供多条信息,包括时间戳跨度(指示客户端何时发送 RPC 请求以及何时收到 RPC 响应)。这些 span 包括网络和客户端系统引入的延迟时间。

客户端跟踪记录可以包含以下信息:

Span 元数据

span ID 相应 span 的唯一 ID
父级 Span ID 父 span 的 ID,对于根 span 未设置
项目 ID Google Cloud 提取轨迹的项目 ID
开始时间 Span 开始时间
结束时间 Span 结束时间

Span 属性

客户端版本
otel.scope.version 字符串
客户端环境
gcp.firestore.memory_utilization double(百分比)
客户端连接属性
gcp.firestore.settings.channel.needs_credentials 布尔值
gcp.firestore.settings.channel.needs_endpoint 布尔值
gcp.firestore.settings.channel.needs_headers 布尔值
gcp.firestore.settings.channel.should_auto_close 布尔值
gcp.firestore.settings.channel.transport_name 字符串示例。“grpc”
gcp.firestore.settings.credentials.authentication_type 字符串示例。“OAuth2”
gcp.firestore.settings.host 字符串示例。“firestore.googleapis.com:443”
数据库属性
gcp.firestore.settings.project_id 字符串
Google Cloud 包含 Firestore 数据库的项目 ID
gcp.firestore.settings.database_id string
数据库外部 ID(名称)
客户端 RPC 重试设置
gcp.firestore.settings.retrySettings.initial_retry_delay 字符串
以秒为单位的时长。示例:0.01 秒
gcp.firestore.settings.retrySettings.initial_rpc_timeout
gcp.firestore.settings.retrySettings.max_attempts 整数(数量)
gcp.firestore.settings.retrySettings.max_retry_delay 字符串
以秒为单位的时长。示例:0.1 秒
gcp.firestore.settings.retrySettings.max_rpc_timeout
gcp.firestore.settings.retrySettings.retry_delay_multiplier 双精度
gcp.firestore.settings.retrySettings.rpc_timeout_multiplier 双精度
gcp.firestore.settings.retrySettings.total_timeout 字符串
时长(以秒为单位)
OpenTelemetry 配置
otel.scope.name 字符串示例。"com.google.cloud.firestore"
service.name Sparky
telemetry.sdk.language 字符串示例。“java”
telemetry.sdk.name opentelemetry
telemetry.sdk.version 例如:1.29.0

日志和事件

客户端轨迹提供以下日志和事件。

gRPC 事件

RPC 属性
message.id 整数,例如 1、2
message.type SENT 或 RECEIVED

AggregateQuery 事件

事件:“RunAggregationQuery 流已启动。”
尝试 大于或等于 0 的整数(例如:2)。0 表示初始尝试
事件:“收到了 RunAggregationQuery 响应。”
尝试 大于或等于 0 的整数(例如:2)。0 表示初始尝试
事件:“RunAggregationQuery:可重试的错误。”
error.message 字符串
事件:“RunAggregationQuery:错误。”
error.message 字符串

BatchGetDocuments 事件

事件:“BatchGetDocuments:开始”
doc_count 整数
transactional 布尔值
事件:“BatchGetDocuments:已收到第一个响应”
// 每当收到 100 个响应时
事件:“BatchGetDocuments:已收到 100 个响应”
事件:“BatchGetDocuments:已完成,包含 ${N} 个响应”
response_count 整数

RunQuery 事件

事件:“RunQuery”
transactional 布尔值
retry_query_with_cursor 布尔值
事件:“RunQuery:收到第一个响应”
// 每收到 100 个响应时触发一次
事件:“RunQuery:已收到 100 个文档”
// 仅当服务器执行半关闭时
事件:“RunQuery:收到了 RunQueryResponse.Done”
事件:“RunQuery:可重试的错误。”
error.message 字符串
事件:“RunQuery:错误。”
error.message 字符串
事件:“RunQuery:已完成。”
response_count 整数

交易事件

Span: "Transaction.Run"
transaction_type 字符串(“READ_ONLY”或“READ_WRITE”)
attempts_allowed 整数
attempts_remaining 整数
// 仅当重试交易时
事件:“启动交易重试”

提交事件

Span: "BulkWriter.Commit"
doc_count 整数
Span: "Batch.Commit"
doc_count 整数
Span: "Transaction.Commit"
doc_count 整数

特殊事件

Span Status = ERROR
exception.message 字符串
exception.type 字符串
exception.stacktrace 字符串