Skip to content

Conversation

@mhennoch
Copy link
Contributor

@mhennoch mhennoch commented Oct 3, 2025

Calls set context_info before methods that actually execute user's SQL(omitting prepare and execBulkLoad). Relevant specification. This is opt in as it causes an extra round trip per request. .NET PR for the same thing

@mhennoch mhennoch requested a review from a team as a code owner October 3, 2025 14:17
@github-actions github-actions bot added pkg:instrumentation-tedious pkg-status:unmaintained This package is unmaintained. Only bugfixes may be acceped until a new owner has been found. labels Oct 3, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Oct 4, 2025

This package does not have an assigned component owner and is considered unmaintained. As such this package is in feature-freeze and this PR will be closed with 14 days unless a new owner or a sponsor (a member of @open-telemetry/javascript-approvers) for the feature is found. It is the responsibility of the author to find a sponsor for this feature.
Are you familiar with this package? Consider becoming a component owner.

@trentm trentm added the has:sponsor This package or feature has a sponsor that has volunteered to review PRs and respond to questions label Oct 8, 2025
cfg.enableTraceContextPropagation &&
thisPlugin._shouldInjectFor(operation);

if (!shouldInject) return runUserRequest();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The previous code and this code path will return the return value of the originalMethod() call, which is typically what is wanted when wrapping. The _injectContextInfo() code path below this will not. I gather that won't matter for this instrumentation because, at least currently, every patched method's return type is void.

thisPlugin
._injectContextInfo(this, tediousModule, traceparent)
.finally(runUserRequest);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Separate question on the async behaviour here:

  • Without calling set context_info, a patched conn.execSql() will synchronously call the original execSql method before returning.
  • With the changes here and when set context_info is enabled, that is no longer true. Now, the original execSql will be called sometime later.

If I have JS code that does something like:

conn.execSql(sql1)
conn.execBulkLoad(sql2)

isn't there a sequencing problem here? I don't know tedious internals at all (e.g. whether and how it is queuing things). But with the example above, is it possible that the actual sequence of SQL executed is the following?

  1. set context_info
  2. sql2
  3. sql1

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This throws an error in Tedious. Docs say: Only one request at a time may be executed on a connection. Once a Request has been initiated (with callProcedure, execSql, or execSqlBatch), another should not be initiated until the Request's completion callback is called.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

has:sponsor This package or feature has a sponsor that has volunteered to review PRs and respond to questions pkg:instrumentation-tedious pkg-status:unmaintained This package is unmaintained. Only bugfixes may be acceped until a new owner has been found.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants