Skip to content

Database spans incorrectly have internal span.kind instead of client #10868

Description

@Blacksmoke16

Version Information

Server Version: 2.50.0

Environment

EE

What is the current behaviour?

The OTEL span for when Hasura makes a DB query, e.g. Postgres Query for root field "my_query" currently has a span.kind of internal.

Because of this, and the way Datadog maps OTEL span types to DD span types, the span ends up with a type of custom which breaks OTEL trace => DD database monitoring correlation.

What is the expected behaviour?

As per the semantic conventions, the span.kind for database related spans should be client, as it's not making a call to an in-memory database.

Span kind SHOULD be CLIENT. It MAY be set to INTERNAL on spans representing in-memory database calls. It’s RECOMMENDED to use CLIENT kind when database system being instrumented usually runs in a different process than its client or when database calls happen over instrumented protocol such as HTTP.

How to reproduce the issue?

  1. Configure https://hasura.io/docs/2.0/observability/opentelemetry/graphql-engine/
  2. Add the HASURA_GRAPHQL_ENABLE_QUERY_TRACING: "true" env var
  3. Execute a query and look at the trace in something like Jaeger

Screenshots or Screencast

Image

Any possible solutions/workarounds you're aware of?

Manually override span.kind to client via OTEL collector

Keywords

  • "span.kind"
  • "internal span"

Metadata

Metadata

Assignees

No one assigned

    Labels

    k/bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions