Skip to content

[BUG]: Baggage auto-merge keys do not appear in graphql spans #6945

@agdt3

Description

@agdt3

Tracer Version(s)

5.79.0

Node.js Version(s)

18.19.0

Bug Report

Hello,

I'm trying to pass some params from our access tokens into some downstream graphql spans (specifically graphql.execute). Currently creating a custom span with some tags just adds those at the express-level span and not the children. Based on this (https://docs.datadoghq.com/tracing/trace_collection/trace_context_propagation/?tab=java#adding-baggage-as-span-tags) my understanding is that setting certain baggage keys should get automatically merged into all downstream span tags, but I'm not seeing those tags or any related facets appear.

import tracer from './tracer';

const setTraceContext = ({ userId, tenantId }) => {
  // Using account.id for testing
  tracer.setBaggageItem('account.id', tenantId);
  if (userId) {
    tracer.setBaggageItem('user.id', userId);

    // This only works at the top-level express span
    tracer.setUser({
      id: userId,
      tenantId
    });
  }
};

graphql.execute Span result:

{"process_id":"12","language":"javascript","env":"dev","version":"7.32.0","ecs_task_arn":"arn:aws:ecs:us-east-1:669356653346:task/graphql-svcs/2a703844ba1f495ca4e538716e3c1bdc","component":"graphql","git":{"commit":{"sha":"***"},"repository_url":"***","repository":{"id":"***"}},"service":"apollo","runtime-id":"abb45271-17dd-4697-8bfd-da0dc7925779","graphql":{"operation":{"name":"getLabourRateGroupsByCompany","type":"query"}},"dd_resource_key":"arn:aws:ecs:us-east-1:669356653346:task/graphql-dev-svcs/2a703844ba1f495ca4e538716e3c1bdc","span":{"kind":"server"},"duration":4810223104}

Reproduction Code

No response

Error Logs

No response

Tracer Config

import tracer from 'dd-trace';

tracer.init();
tracer.use('graphql', {
  signature: true,
  source: true
});
tracer.use('pino', {});

export default tracer;

Operating System

No response

Bundling

Webpack

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions