From ba0ffacb15bc2c5773a794265e2dd915e3c4d65a Mon Sep 17 00:00:00 2001 From: Eric Allam Date: Mon, 18 Mar 2024 20:16:20 +0000 Subject: [PATCH] Set the OTEL_EXPORTER_OTLP_ENDPOINT env var on dev workers --- .env.example | 3 ++- apps/webapp/app/env.server.ts | 1 + .../environmentVariablesRepository.server.ts | 9 +++++++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.env.example b/.env.example index cbfb4902e..9916679a5 100644 --- a/.env.example +++ b/.env.example @@ -58,4 +58,5 @@ COORDINATOR_SECRET=coordinator-secret # generate the actual secret with `openssl # DEPLOY_REGISTRY_HOST=${APP_ORIGIN} # This is the host that the deploy CLI will use to push images to the registry # CONTAINER_REGISTRY_ORIGIN= # CONTAINER_REGISTRY_USERNAME= -# CONTAINER_REGISTRY_PASSWORD= \ No newline at end of file +# CONTAINER_REGISTRY_PASSWORD= +# DEV_OTEL_EXPORTER_OTLP_ENDPOINT="http://0.0.0.0:4318" \ No newline at end of file diff --git a/apps/webapp/app/env.server.ts b/apps/webapp/app/env.server.ts index 455bbc089..54fcae146 100644 --- a/apps/webapp/app/env.server.ts +++ b/apps/webapp/app/env.server.ts @@ -82,6 +82,7 @@ const EnvironmentSchema = z.object({ CONTAINER_REGISTRY_USERNAME: z.string().optional(), CONTAINER_REGISTRY_PASSWORD: z.string().optional(), DEPLOY_REGISTRY_HOST: z.string().optional(), + DEV_OTEL_EXPORTER_OTLP_ENDPOINT: z.string().optional(), }); export type Environment = z.infer; diff --git a/apps/webapp/app/v3/environmentVariables/environmentVariablesRepository.server.ts b/apps/webapp/app/v3/environmentVariables/environmentVariablesRepository.server.ts index f18bf8800..54a80a14b 100644 --- a/apps/webapp/app/v3/environmentVariables/environmentVariablesRepository.server.ts +++ b/apps/webapp/app/v3/environmentVariables/environmentVariablesRepository.server.ts @@ -30,7 +30,7 @@ function parseSecretKey(key: string) { const SecretValue = z.object({ secret: z.string() }); export class EnvironmentVariablesRepository implements Repository { - constructor(private prismaClient: PrismaClient = prisma) {} + constructor(private prismaClient: PrismaClient = prisma) { } async create( projectId: string, @@ -415,7 +415,12 @@ export class EnvironmentVariablesRepository implements Repository { } if (environment.type === "DEVELOPMENT") { - return []; + return [ + { + key: "OTEL_EXPORTER_OTLP_ENDPOINT", + value: env.DEV_OTEL_EXPORTER_OTLP_ENDPOINT ?? env.APP_ORIGIN, + } + ]; } return [