add env var to disable additional detectors
🚀 Publish Trigger.dev Docker / typecheck (push) Failing after 10m50s
🚀 Publish Trigger.dev Docker / publish-webapp (push) Has been skipped
🚀 Publish Trigger.dev Docker / publish-worker (push) Has been skipped
🚀 Publish Trigger.dev Docker / publish-worker-v4 (push) Has been skipped
🚀 Publish Trigger.dev Docker / units (push) Failing after 10m56s

This commit is contained in:
nicktrn
2025-08-29 18:12:11 +01:00
parent c22dbe96a7
commit 64cd327558
2 changed files with 11 additions and 12 deletions
+1
View File
@@ -354,6 +354,7 @@ const EnvironmentSchema = z.object({
INTERNAL_OTEL_METRIC_EXPORTER_INTERVAL_MS: z.coerce.number().int().default(30_000),
INTERNAL_OTEL_HOST_METRICS_ENABLED: BoolEnv.default(true),
INTERNAL_OTEL_NODEJS_METRICS_ENABLED: BoolEnv.default(true),
INTERNAL_OTEL_ADDITIONAL_DETECTORS_ENABLED: BoolEnv.default(true),
ORG_SLACK_INTEGRATION_CLIENT_ID: z.string().optional(),
ORG_SLACK_INTEGRATION_CLIENT_SECRET: z.string().optional(),
+10 -12
View File
@@ -36,7 +36,7 @@ import { NodeTracerProvider } from "@opentelemetry/sdk-trace-node";
import { ATTR_SERVICE_NAME } from "@opentelemetry/semantic-conventions";
import { PrismaInstrumentation } from "@prisma/instrumentation";
import { HostMetrics } from "@opentelemetry/host-metrics";
import { AwsInstrumentation } from "@opentelemetry/instrumentation-aws-sdk";
import { AwsInstrumentation as AwsSdkInstrumentation } from "@opentelemetry/instrumentation-aws-sdk";
import { awsEcsDetector, awsEc2Detector } from "@opentelemetry/resource-detector-aws";
import {
detectResources,
@@ -45,6 +45,7 @@ import {
osDetector,
hostDetector,
processDetector,
type ResourceDetector,
} from "@opentelemetry/resources";
import { env } from "~/env.server";
import type { AuthenticatedEnvironment } from "~/services/apiAuth.server";
@@ -171,16 +172,13 @@ export async function emitWarnLog(message: string, params: Record<string, unknow
}
function getResource() {
const detectedResource = detectResources({
detectors: [
serviceInstanceIdDetector,
osDetector,
hostDetector,
processDetector,
awsEcsDetector,
awsEc2Detector,
],
});
const detectors: ResourceDetector[] = [serviceInstanceIdDetector];
if (env.INTERNAL_OTEL_ADDITIONAL_DETECTORS_ENABLED) {
detectors.push(osDetector, hostDetector, processDetector, awsEcsDetector, awsEc2Detector);
}
const detectedResource = detectResources({ detectors });
const baseResource = resourceFromAttributes({
[ATTR_SERVICE_NAME]: env.SERVICE_NAME,
@@ -285,7 +283,7 @@ function setupTelemetry() {
let instrumentations: Instrumentation[] = [
new HttpInstrumentation(),
new ExpressInstrumentation(),
new AwsInstrumentation({
new AwsSdkInstrumentation({
suppressInternalInstrumentation: true,
}),
];