GraphQL 服务器 Span 的语义约定

状态: 开发中

状态: 开发中

此 Span 表示 GraphQL 服务器实现上的一个入站操作。

Span 名称 应为 {graphql.operation.type} 格式,前提是 graphql.operation.type 可用。如果 graphql.operation.type 不可用,Span 应命名为 GraphQL Operation

警告 graphql.operation.name 值由客户端提供,可能具有高基数性。不建议(默认情况下)在 GraphQL 服务器 Span 名称中使用它。

Instrumentation 可以提供一个配置选项,以便在 graphql.operation.name 可用时,采用 {graphql.operation.type} {graphql.operation.name} 格式实现更具描述性的 Span 名称。

Span kind 应为 SERVER

**Span 状态**应遵循 记录错误文档。

Attributes

Stability需求级别Value Type描述Example Values
graphql.documentDevelopment推荐字符串正在执行的 GraphQL 文档。 [1]query findBookById { bookById(id: ?) { name } }
graphql.operation.nameDevelopment推荐字符串正在执行的操作的名称。findBookById
graphql.operation.typeDevelopment推荐字符串正在执行的操作的类型。querymutationsubscription

[1] graphql.document: 该值可能会被清理以排除敏感信息。


graphql.operation.type 具有以下已知值列表。如果其中一个适用,则必须使用相应的值;否则,可以改用自定义值。

描述Stability
mutationGraphQL mutationDevelopment
queryGraphQL queryDevelopment
subscriptionGraphQL subscriptionDevelopment