Skip to content

Commit

Permalink
fix: Don't disable instrumentation if OpenTelemetry isn't enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
nwalters512 committed Apr 13, 2022
1 parent 0eabfdc commit fb3d0be
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/stale-actors-repeat.md
@@ -0,0 +1,5 @@
---
'@prairielearn/opentelemetry': patch
---

Don't disable instrumentation if OpenTelemetry isn't enabled
9 changes: 7 additions & 2 deletions packages/opentelemetry/src/index.ts
Expand Up @@ -128,8 +128,13 @@ export interface OpenTelemetryConfig {
*/
export async function init(config: OpenTelemetryConfig) {
if (!config.openTelemetryEnabled) {
// Just disable all of the OTEL instrumentations to avoid any unnecessary overhead.
instrumentations.forEach((i) => i.disable());
// If not enabled, do nothing. We used to disable the instrumentations, but
// per maintainers, that can actually be problematic. See the comments on
// https://github.com/open-telemetry/opentelemetry-js-contrib/issues/970
// The Express instrumentation also logs a benign error, which can be
// confusing to users. There's a fix in progress if we want to switch back
// to disabling instrumentations in the future:
// https://github.com/open-telemetry/opentelemetry-js-contrib/pull/972
return;
}

Expand Down

0 comments on commit fb3d0be

Please sign in to comment.