Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@opentelemetry/api 1.8.0 produces detached spans from knex.raw() calls #4630

Open
KidkArolis opened this issue Apr 12, 2024 · 2 comments
Open
Labels
bug Something isn't working needs:reproducer This bug/feature is in need of a minimal reproducer pkg:api priority:p2 Bugs and spec inconsistencies which cause telemetry to be incomplete or incorrect

Comments

@KidkArolis
Copy link

What happened?

Steps to Reproduce

Use @opentelemetry/api and @opentelemetry/instrumentation-knex where sql queries executed by knex are nested inside some other trace.

Specifically, calling a raw select like so should be nested under the active parent span:

knex.raw('select 1=1') 

Expected Result

The span produced by knex.raw call has parentSpanId set to the parent span ID.

Actual Result

The span produced by knex.raw call has parentSpanId set to undefined.

Additional Details

This specifically breaks when going from version 1.7.0 to 1.8.0 of the @opentelemetry/api package as the only change in the repo.

I can provide more details - I can provide a full span object with 1.7.0 and 1.8.0 if that helps or .. I can work on a fully reproducible example. But just wanted to post this in case someone knows what might be going on. We observed in our Honeycomb UI that all knex.raw calls "fell out" of their parent spans after upgrading to 1.8.0.

OpenTelemetry Setup Code

import { HoneycombSDK } from '@honeycombio/opentelemetry-node'
import { Instrumentation as FeathersInstrumentation } from '@humaans/instrumentation-feathers/instrumentation.ts'
import { Attributes, Span, SpanStatusCode, Tracer } from '@opentelemetry/api'
import { KnexInstrumentation } from '@opentelemetry/instrumentation-knex'

if (config.get('honeycomb.enabled')) {
  const sdk = new HoneycombSDK({
    apiKey: config.get('apiKey')
    instrumentations: [
      new KnexInstrumentation(),
      new FeathersInstrumentation({ getSpanAttributes }),
    ],
  })

  sdk.start()
}

package.json

No response

Relevant log output

No response

@KidkArolis KidkArolis added bug Something isn't working triage labels Apr 12, 2024
@pichlermarc pichlermarc added the priority:p2 Bugs and spec inconsistencies which cause telemetry to be incomplete or incorrect label Apr 17, 2024
@trentm
Copy link
Contributor

trentm commented Apr 17, 2024

I can work on a fully reproducible example.

That would be very helpful, yes, please.

@pichlermarc pichlermarc added needs:reproducer This bug/feature is in need of a minimal reproducer and removed triage labels Apr 17, 2024
@trentm
Copy link
Contributor

trentm commented Apr 17, 2024

Also, I'm curious if there are other package version changes. Perhaps showing the output of npm ls -a for both the working and failling cases might help show that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs:reproducer This bug/feature is in need of a minimal reproducer pkg:api priority:p2 Bugs and spec inconsistencies which cause telemetry to be incomplete or incorrect
Projects
None yet
Development

No branches or pull requests

3 participants