Skip to content

Trace with UnifiedTracer does not respect service option #4170

Open
@cosmini

Description

@cosmini

Current behaviour

When datadog tracing is configured manually on the schema as described in docs it doesn't apply the custom service option, instead it applies the service name from the global configuration.

This is not on par with graphql's own tracer (trace_with GraphQL::Tracing::DataDogTrace, service: 'my-service-name') which is no longer recommended to be used for the latest version of datadog & graphql gems.
Since this solution of providing service name via options was recommended at version 2.1.11 it is more likely this is a bug in the unified tracer.

Will result in the service name being set to default value of nil:

Service: nil

Expected behaviour

Service: 'my-service-name'

Steps to reproduce

For example having a schema configured like this and no other instrumentation for graphql configured

class YourSchema < GraphQL::Schema
  trace_with Datadog::Tracing::Contrib::GraphQL::UnifiedTrace, service: 'my-service-name'
end 

Environment

  • datadog version: 2.7.0
  • Configuration block:
Datadog.configure do |c|
  app_name = ENV['DD_SERVICE'] || ENV['DATADOG_SERVICE_NAME']
  env_name = Rails.env

  c.env = env_name
  c.runtime_metrics.enabled = true
  c.runtime_metrics.statsd = DATADOG_STATSD_CLIENT
  c.service = app_name
  c.tags = {
    'application' => app_name,
    'environment' => env_name,
  }

  c.tracing.instrument :rails, service_name: app_name, request_queuing: true
end
  • Ruby version: 3.3.4
  • Operating system: osx, debian
  • Relevant library versions: graphql: 2.4.3

Metadata

Metadata

Assignees

Labels

bugInvolves a bugcommunityWas opened by a community member

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions