Skip to content

Commit

Permalink
feat: fixing import and checking for instrumentation based on functio…
Browse files Browse the repository at this point in the history
…n instead of instance
  • Loading branch information
obecny committed Nov 9, 2020
1 parent 8aa912b commit 14c7ce4
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions packages/opentelemetry-web/src/WebTracerProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

import { BasePlugin } from '@opentelemetry/core';
import { InstrumentationBase } from '@opentelemetry/instrumentation/build/src/platform/browser';
import { InstrumentationBase } from '@opentelemetry/instrumentation';
import {
BasicTracerProvider,
SDKRegistrationConfig,
Expand Down Expand Up @@ -48,9 +48,10 @@ export class WebTracerProvider extends BasicTracerProvider {
super(config);

for (const plugin of config.plugins) {
if (plugin instanceof InstrumentationBase) {
plugin.setTracerProvider(this);
plugin.enable();
const instrumentation = (plugin as unknown) as InstrumentationBase;
if (typeof instrumentation.setTracerProvider === 'function') {
instrumentation.setTracerProvider(this);
instrumentation.enable();
} else {
plugin.enable([], this, this.logger);
}
Expand Down

0 comments on commit 14c7ce4

Please sign in to comment.