@@ -36,7 +36,7 @@ import { NodeTracerProvider } from "@opentelemetry/sdk-trace-node";
3636import { ATTR_SERVICE_NAME } from "@opentelemetry/semantic-conventions" ;
3737import { PrismaInstrumentation } from "@prisma/instrumentation" ;
3838import { HostMetrics } from "@opentelemetry/host-metrics" ;
39- import { AwsInstrumentation } from "@opentelemetry/instrumentation-aws-sdk" ;
39+ import { AwsInstrumentation as AwsSdkInstrumentation } from "@opentelemetry/instrumentation-aws-sdk" ;
4040import { awsEcsDetector , awsEc2Detector } from "@opentelemetry/resource-detector-aws" ;
4141import {
4242 detectResources ,
@@ -45,6 +45,7 @@ import {
4545 osDetector ,
4646 hostDetector ,
4747 processDetector ,
48+ type ResourceDetector ,
4849} from "@opentelemetry/resources" ;
4950import { env } from "~/env.server" ;
5051import type { AuthenticatedEnvironment } from "~/services/apiAuth.server" ;
@@ -171,16 +172,13 @@ export async function emitWarnLog(message: string, params: Record<string, unknow
171172}
172173
173174function 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 } ) ;
184182
185183 const baseResource = resourceFromAttributes ( {
186184 [ ATTR_SERVICE_NAME ] : env . SERVICE_NAME ,
@@ -285,7 +283,7 @@ function setupTelemetry() {
285283 let instrumentations : Instrumentation [ ] = [
286284 new HttpInstrumentation ( ) ,
287285 new ExpressInstrumentation ( ) ,
288- new AwsInstrumentation ( {
286+ new AwsSdkInstrumentation ( {
289287 suppressInternalInstrumentation : true ,
290288 } ) ,
291289 ] ;
0 commit comments