From 54dd5211cb81d90e172bfb15f81642cde04d535a Mon Sep 17 00:00:00 2001 From: Oscar Reyes Date: Wed, 1 Nov 2023 08:44:49 -0600 Subject: [PATCH] chore: adding otel setup logging --- api/src/telemetry/tracing.ts | 3 +++ docker-compose.yml | 28 ++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/api/src/telemetry/tracing.ts b/api/src/telemetry/tracing.ts index 2077c46..3d2b88a 100644 --- a/api/src/telemetry/tracing.ts +++ b/api/src/telemetry/tracing.ts @@ -5,6 +5,9 @@ import { Resource } from '@opentelemetry/resources'; import * as dotenv from 'dotenv'; import { SemanticResourceAttributes } from '@opentelemetry/semantic-conventions'; import { SpanStatusCode } from '@opentelemetry/api'; +import { diag, DiagConsoleLogger, DiagLogLevel } from '@opentelemetry/api'; + +diag.setLogger(new DiagConsoleLogger(), DiagLogLevel.DEBUG); // Make sure all env variables are available in process.env dotenv.config(); diff --git a/docker-compose.yml b/docker-compose.yml index 4ba207e..f1fb93c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -89,6 +89,34 @@ services: retries: 60 ports: - 8081:8081 + depends_on: + db: + condition: service_healthy + cache: + condition: service_healthy + queue: + condition: service_healthy + jaeger: + condition: service_healthy + otel-collector: + condition: service_started + + rpc: + build: . + environment: + REDIS_URL: cache + DATABASE_URL: postgresql://ashketchum:squirtle123@db:5432/pokeshop?schema=public + RABBITMQ_HOST: queue + POKE_API_BASE_URL: https://pokeapi.co/api/v2 + COLLECTOR_ENDPOINT: http://otel-collector:4317 + ZIPKIN_URL: http://localhost:9411 + NPM_RUN_COMMAND: rpc + healthcheck: + test: ['CMD', 'wget', '--spider', 'localhost:8081/pokemon/healthcheck'] + interval: 1s + timeout: 3s + retries: 60 + ports: - 8082:8082 depends_on: db: