diff --git a/src/index.ts b/src/index.ts index a2c2d9126..107d94c40 100644 --- a/src/index.ts +++ b/src/index.ts @@ -84,6 +84,7 @@ import { promisifyAll, startTrace, setSpanError, + addAutoInstrumentation, } from './instrument'; // eslint-disable-next-line @typescript-eslint/no-var-requires @@ -2096,6 +2097,7 @@ export {MutationGroup}; */ import * as protos from '../protos/protos'; import IInstanceConfig = instanceAdmin.spanner.admin.instance.v1.IInstanceConfig; +export {addAutoInstrumentation}; export {v1, protos}; export default {Spanner}; export {Float32, Float, Int, Struct, Numeric, PGNumeric, SpannerDate}; diff --git a/src/instrument.ts b/src/instrument.ts index bedde3e06..e379429ac 100644 --- a/src/instrument.ts +++ b/src/instrument.ts @@ -75,11 +75,13 @@ Notes and requests from peer review: please see /~https://github.com/googleapis/java-spanner?tab=readme-ov-file#opentelemetry-configuration. */ -export function addAutoInstrumentation(opts: { - grpc?: boolean; +interface autoInstrumentOpts { + grpc: boolean; http: boolean; - traceProvider: typeof TracerProvider; -}) { + tracerProvider: typeof TracerProvider; +} + +export function addAutoInstrumentation(opts: autoInstrumentOpts) { const instrumentations: (typeof Instrumentation)[] = []; if (opts.grpc) { @@ -93,9 +95,9 @@ export function addAutoInstrumentation(opts: { return; } - if (opts.traceProvider) { + if (opts.tracerProvider) { instrumentations.forEach(instrumentation => { - instrumentation.setTraceProvider(opts.traceProvider); + instrumentation.setTracerProvider(opts.tracerProvider); instrumentation.enable(); }); } else {