@@ -36,7 +36,7 @@ import { NodeTracerProvider } from "@opentelemetry/sdk-trace-node";
36
36
import { ATTR_SERVICE_NAME } from "@opentelemetry/semantic-conventions" ;
37
37
import { PrismaInstrumentation } from "@prisma/instrumentation" ;
38
38
import { HostMetrics } from "@opentelemetry/host-metrics" ;
39
- import { AwsInstrumentation } from "@opentelemetry/instrumentation-aws-sdk" ;
39
+ import { AwsInstrumentation as AwsSdkInstrumentation } from "@opentelemetry/instrumentation-aws-sdk" ;
40
40
import { awsEcsDetector , awsEc2Detector } from "@opentelemetry/resource-detector-aws" ;
41
41
import {
42
42
detectResources ,
@@ -45,6 +45,7 @@ import {
45
45
osDetector ,
46
46
hostDetector ,
47
47
processDetector ,
48
+ type ResourceDetector ,
48
49
} from "@opentelemetry/resources" ;
49
50
import { env } from "~/env.server" ;
50
51
import type { AuthenticatedEnvironment } from "~/services/apiAuth.server" ;
@@ -171,16 +172,13 @@ export async function emitWarnLog(message: string, params: Record<string, unknow
171
172
}
172
173
173
174
function getResource ( ) {
174
- const detectedResource = detectResources ( {
175
- detectors : [
176
- serviceInstanceIdDetector ,
177
- osDetector ,
178
- hostDetector ,
179
- processDetector ,
180
- awsEcsDetector ,
181
- awsEc2Detector ,
182
- ] ,
183
- } ) ;
175
+ const detectors : ResourceDetector [ ] = [ serviceInstanceIdDetector ] ;
176
+
177
+ if ( env . INTERNAL_OTEL_ADDITIONAL_DETECTORS_ENABLED ) {
178
+ detectors . push ( osDetector , hostDetector , processDetector , awsEcsDetector , awsEc2Detector ) ;
179
+ }
180
+
181
+ const detectedResource = detectResources ( { detectors } ) ;
184
182
185
183
const baseResource = resourceFromAttributes ( {
186
184
[ ATTR_SERVICE_NAME ] : env . SERVICE_NAME ,
@@ -285,7 +283,7 @@ function setupTelemetry() {
285
283
let instrumentations : Instrumentation [ ] = [
286
284
new HttpInstrumentation ( ) ,
287
285
new ExpressInstrumentation ( ) ,
288
- new AwsInstrumentation ( {
286
+ new AwsSdkInstrumentation ( {
289
287
suppressInternalInstrumentation : true ,
290
288
} ) ,
291
289
] ;
0 commit comments