Skip to content

Duplicate mysql2 APM spans when connecting APM to Database Monitoring with Rails #3225

Open

Description

Current behaviour

If I have a Rails application that wants to make use of connecting Database Monitoring with APM AFAICS this is the minimum needed ddtrace configuration:

  c.tracing.instrument :mysql2, comment_propagation: "full"
  c.tracing.instrument :rails

And this works, but it leads to seemingly duplicate nested mysql2 spans:

image

The spans differ slightly:

Screenshot 2023-10-25 at 16 10 44 Screenshot 2023-10-25 at 16 10 50

I use the count of mysql2 spans as a proxy for query count, so this doubling up is rather annoying. Removing c.tracing.instrument :mysql2 fixes it, but loses comment propagation.

Expected behaviour

I expect there to be only one span here, or for the purpose of each span to be clearly different if they do represent different things.

How does ddtrace help you?

Its the best thing since sliced 🍞!

Environment

  • ddtrace version: 1.15.0
  • Configuration block (Datadog.configure ...): see above
  • Ruby version: 3.2
  • Operating system: docker.io/ruby:3.2.2-bullseye
  • Relevant library versions: Rails 7.0, mysql2 0.5.5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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