Skip to content

Commit b5a2197

Browse files
committed
use getConfig
1 parent bf8692e commit b5a2197

File tree

1 file changed

+9
-10
lines changed
  • plugins/node/instrumentation-typeorm/src

1 file changed

+9
-10
lines changed

plugins/node/instrumentation-typeorm/src/typeorm.ts

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,7 @@ const entityManagerMethods: EntityManagerMethods[] = [
9292
...functionsUsingQueryBuilder,
9393
];
9494

95-
export class TypeormInstrumentation extends InstrumentationBase {
96-
protected override _config!: TypeormInstrumentationConfig;
95+
export class TypeormInstrumentation extends InstrumentationBase<TypeormInstrumentationConfig> {
9796
constructor(config: TypeormInstrumentationConfig = {}) {
9897
super(PACKAGE_NAME, PACKAGE_VERSION, config);
9998
}
@@ -258,11 +257,11 @@ export class TypeormInstrumentation extends InstrumentationBase {
258257

259258
const contextWithSpan = trace.setSpan(context.active(), span);
260259

261-
const traceContext = self._config.enableInternalInstrumentation
260+
const traceContext = self.getConfig().enableInternalInstrumentation
262261
? contextWithSpan
263262
: suppressTypeormInternalTracing(contextWithSpan);
264263

265-
const contextWithSuppressTracing = self._config
264+
const contextWithSuppressTracing = self.getConfig()
266265
.suppressInternalInstrumentation
267266
? suppressTracing(traceContext)
268267
: traceContext;
@@ -301,7 +300,7 @@ export class TypeormInstrumentation extends InstrumentationBase {
301300
[SEMATTRS_DB_STATEMENT]: sql,
302301
[SEMATTRS_DB_SQL_TABLE]: mainTableName,
303302
};
304-
if (self._config.enhancedDatabaseReporting) {
303+
if (self.getConfig().enhancedDatabaseReporting) {
305304
try {
306305
attributes[ExtendedDatabaseAttribute.DB_STATEMENT_PARAMETERS] =
307306
JSON.stringify(parameters);
@@ -319,11 +318,11 @@ export class TypeormInstrumentation extends InstrumentationBase {
319318

320319
const contextWithSpan = trace.setSpan(context.active(), span);
321320

322-
const traceContext = self._config.enableInternalInstrumentation
321+
const traceContext = self.getConfig().enableInternalInstrumentation
323322
? contextWithSpan
324323
: suppressTypeormInternalTracing(contextWithSpan);
325324

326-
const contextWithSuppressTracing = self._config
325+
const contextWithSuppressTracing = self.getConfig()
327326
?.suppressInternalInstrumentation
328327
? suppressTracing(traceContext)
329328
: traceContext;
@@ -365,11 +364,11 @@ export class TypeormInstrumentation extends InstrumentationBase {
365364

366365
const contextWithSpan = trace.setSpan(context.active(), span);
367366

368-
const traceContext = self._config.enableInternalInstrumentation
367+
const traceContext = self.getConfig().enableInternalInstrumentation
369368
? contextWithSpan
370369
: suppressTypeormInternalTracing(contextWithSpan);
371370

372-
const contextWithSuppressTracing = self._config
371+
const contextWithSuppressTracing = self.getConfig()
373372
?.suppressInternalInstrumentation
374373
? suppressTracing(traceContext)
375374
: traceContext;
@@ -384,7 +383,7 @@ export class TypeormInstrumentation extends InstrumentationBase {
384383
// eslint-disable-next-line @typescript-eslint/no-explicit-any
385384
private _endSpan(traced: any, span: Span) {
386385
const executeResponseHook = (response: unknown) => {
387-
const hook = this._config?.responseHook;
386+
const hook = this.getConfig().responseHook;
388387
if (hook !== undefined) {
389388
safeExecuteInTheMiddle(
390389
() => hook(span, { response }),

0 commit comments

Comments
 (0)