Skip to content

Commit 1bd8972

Browse files
committed
refactor: extract checkManuallyProvidedInstrumentationNames method
open-telemetry#1672
1 parent d0fc194 commit 1bd8972

File tree

1 file changed

+11
-6
lines changed
  • metapackages/auto-instrumentations-node/src

1 file changed

+11
-6
lines changed

metapackages/auto-instrumentations-node/src/utils.ts

+11-6
Original file line numberDiff line numberDiff line change
@@ -135,12 +135,7 @@ export type InstrumentationConfigMap = {
135135
export function getNodeAutoInstrumentations(
136136
inputConfigs: InstrumentationConfigMap = {}
137137
): Instrumentation[] {
138-
for (const name of Object.keys(inputConfigs)) {
139-
if (!Object.prototype.hasOwnProperty.call(InstrumentationMap, name)) {
140-
diag.error(`Provided instrumentation name "${name}" not found`);
141-
continue;
142-
}
143-
}
138+
checkManuallyProvidedInstrumentationNames(Object.keys(inputConfigs));
144139

145140
const instrumentations: Instrumentation[] = [];
146141

@@ -167,6 +162,16 @@ export function getNodeAutoInstrumentations(
167162
return instrumentations;
168163
}
169164

165+
function checkManuallyProvidedInstrumentationNames(
166+
manuallyProvidedInstrumentationNames: string[]
167+
) {
168+
for (const name of manuallyProvidedInstrumentationNames) {
169+
if (!Object.prototype.hasOwnProperty.call(InstrumentationMap, name)) {
170+
diag.error(`Provided instrumentation name "${name}" not found`);
171+
}
172+
}
173+
}
174+
170175
export function getResourceDetectorsFromEnv(): Array<Detector | DetectorSync> {
171176
const resourceDetectors = new Map<
172177
string,

0 commit comments

Comments
 (0)