Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Adding OTEL_EXPORTER_OTLP_ENDPOINT #189

Merged
merged 19 commits into from
Nov 9, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion apps/webservice/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,18 @@ const config = {
"@appsignal/opentelemetry-instrumentation-bullmq",
"@opentelemetry/exporter-trace-otlp-http",
"@opentelemetry/resources",
"@opentelemetry/sdk-node",
"@opentelemetry/semantic-conventions",
],
},
// This is for tracing:
webpack: (config, { isServer }) => {
if (isServer == null)
config.resolve.fallback = {
// Disable the 'tls' module on the client side
tls: false,
};
return config;
},

async rewrites() {
return [
Expand Down
2 changes: 1 addition & 1 deletion apps/webservice/src/instrumentation.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const sdk = new NodeSDK({
enabled: true,
},
"@opentelemetry/instrumentation-winston": {
enabled: true,
enabled: false,
},
}),
],
Expand Down
4 changes: 4 additions & 0 deletions apps/webservice/src/trpc/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ import { headers } from "next/headers";
import { createCaller, createTRPCContext } from "@ctrlplane/api";
import { auth } from "@ctrlplane/auth";

import { register } from "../instrumentation";

await register();
zacharyblasczyk marked this conversation as resolved.
Show resolved Hide resolved

/**
* This wraps the `createTRPCContext` helper and provides the required context for the tRPC API when
* handling a tRPC call from a React Server Component.
Expand Down
13 changes: 13 additions & 0 deletions docker-compose.dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,19 @@ services:
volumes:
- redisinsight-data:/data

# otel-collector:
# image: otel/opentelemetry-collector-contrib:latest
# container_name: ctrlplane-otel-collector
# command: ["--config=/etc/otel-collector-config.yaml"]
# volumes:
# - ./otel-collector-config.yaml:/etc/otel-collector-config.yaml
# ports:
# - "4317:4317" # OTLP gRPC
# - "4318:4318" # OTLP HTTP
# - "8125:8125" # StatsD
# - "8888:8888" # Telemetry
# - "9109:9109" # Prometheus endpoint

volumes:
db-data:
redis-data:
Expand Down
45 changes: 35 additions & 10 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: "3.8"
version: "3.9"

services:
postgres:
Expand Down Expand Up @@ -26,17 +26,21 @@ services:

migrations:
platform: linux/amd64
image: ctrlplane/migrations:c656deb
image: ctrlplane/migrations:eccfca2
container_name: ctrlplane-migrations
zacharyblasczyk marked this conversation as resolved.
Show resolved Hide resolved
restart: "no"
environment:
DATABASE_URL: postgres://ctrlplane:ctrlplane@postgres:5432/ctrlplane
POSTGRES_URL: "postgres://ctrlplane:ctrlplane@postgres:5432/ctrlplane"
depends_on:
- postgres

webservice:
platform: linux/amd64
image: ctrlplane/webservice:c656deb
image: ctrlplane/webservice:6593512
# build:
# context: .
# dockerfile: ./apps/webservice/Dockerfile

container_name: ctrlplane-webservice
environment:
BASE_URL: "http://127.0.0.1" # <set your instance url>
Expand All @@ -46,32 +50,53 @@ services:
# AUTH_OIDC_CLIENT_SECRET: "<oidc-client-secret>"

NEXTAUTH_URL: ${BASE_URL}
DATABASE_URL: postgres://ctrlplane:ctrlplane@postgres:5432/ctrlplane
OTEL_EXPORTER_OTLP_ENDPOINT: "http://otel-collector:4318"
REDIS_URL: redis://redis:6379
POSTGRES_URL: postgres://ctrlplane:ctrlplane@postgres:5432/ctrlplane
VARIABLES_AES_256_KEY: d2506d733ee210078461c08ee8e1605be75ed73b0941d4b513ab7b159c6fbcd9
# NODE_OPTIONS: "--require /app/apps/webservice/.next/serverinstrumentation.js"
zacharyblasczyk marked this conversation as resolved.
Show resolved Hide resolved
depends_on:
zacharyblasczyk marked this conversation as resolved.
Show resolved Hide resolved
- postgres
- migrations
ports:
- "8080:8080"
- "3000:3000"

jobs:
platform: linux/amd64
image: ctrlplane/jobs:c656deb
image: ctrlplane/jobs:eccfca2
container_name: ctrlplane-jobs
environment:
POSTGRES_URL: postgres://ctrlplane:ctrlplane@postgres:5432/ctrlplane
POSTGRES_URL: "postgres://ctrlplane:ctrlplane@postgres:5432/ctrlplane"
REDIS_URL: "redis://redis:6379"
VARIABLES_AES_256_KEY: d2506d733ee210078461c08ee8e1605be75ed73b0941d4b513ab7b159c6fbcd9
depends_on:
- postgres

event-worker:
platform: linux/amd64
image: ctrlplane/event-worker:c656deb
image: ctrlplane/event-worker:eccfca2
container_name: ctrlplane-event-worker
environment:
POSTGRES_URL: postgres://ctrlplane:ctrlplane@postgres:5432/ctrlplane
POSTGRES_URL: "postgres://ctrlplane:ctrlplane@postgres:5432/ctrlplane"
REDIS_URL: "redis://redis:6379"
VARIABLES_AES_256_KEY: d2506d733ee210078461c08ee8e1605be75ed73b0941d4b513ab7b159c6fbcd9
depends_on:
- postgres
- redis

# otel-collector:
# image: otel/opentelemetry-collector-contrib:latest
# container_name: ctrlplane-otel-collector
# command: ["--config=/etc/otel-collector-config.yaml"]
# volumes:
# - ./otel-collector-config.yaml:/etc/otel-collector-config.yaml
# ports:
# - "4317:4317" # OTLP gRPC
# - "4318:4318" # OTLP HTTP
# - "8125:8125" # StatsD
# - "8888:8888" # Telemetry
# - "9109:9109" # Prometheus endpoint

volumes:
postgres_data:
redis_data:
Loading
Loading