-
Notifications
You must be signed in to change notification settings - Fork 112
Closed
Labels
api: spannerIssues related to the googleapis/nodejs-spanner API.Issues related to the googleapis/nodejs-spanner API.priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Description
Reported offline by @alkatrivedi, whereby their code didn't involve creating a new traces at all but was using this instrumented package and their code used async/await yet spans that are supposed to be nested were disjoint.
OpenTelemetry-JS acknowledges that for code to work correctly and for context to be correctly propagated (as a replacement for threadlocal storage) a context manager must be enabled beforehand https://opentelemetry.io/docs/languages/js/context/
Customers should never have to think about these reasons and do it themselves, instead our package should automatically handle this scenario so that customers can transparently keep their code without any needs to edit
Task
- Check for if a prior context manager was enabled and if not, create oen like this ideally in src/instrument.ts
const {AsyncHooksContextManager} = require('@opentelemetry/context-async-hooks');
const {context} = require('@opentelemetry/api');
const contextManager = new AsyncHooksContextManager();
contextManager.enable();
context.setGlobalContextManager(contextManager);along with regression tests for it.
Metadata
Metadata
Assignees
Labels
api: spannerIssues related to the googleapis/nodejs-spanner API.Issues related to the googleapis/nodejs-spanner API.priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.