Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
7 changes: 7 additions & 0 deletions .devcontainer/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ DB_READONLY_USER=readonly
DB_TRUST_SERVER_CERTIFICATE=true
NEXT_TELEMETRY_DISABLED=1
NODE_ENV=development
OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-lgtm:4318
OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
OTEL_GRAFANA_HOST_PORT=3300
OTEL_GRPC_HOST_PORT=4317
OTEL_HTTP_HOST_PORT=4318
OTEL_SDK_ENABLED=true
OTEL_SERVICE_NAME=kravhantering

# Optional explicit overrides for the derived DB_* connection settings above:
# DATABASE_URL=mssql://sa:YourStrong!Passw0rd@db:1433/kravhantering?encrypt=true&trustServerCertificate=true
Expand Down
14 changes: 13 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@
},

// Use 'forwardPorts' to make a list of ports inside the container available locally
"forwardPorts": [3000, 3001, 4443, 1433, 8080, 9323, 51204],
"forwardPorts": [3000, 3001, 3300, 4317, 4318, 4443, 1433, 8080, 9323, 51204],
"portsAttributes": {
"3000": {
"label": "Next.js Dev Server 1",
Expand All @@ -190,6 +190,18 @@
"label": "Next.js Dev Server 2",
"onAutoForward": "notify"
},
"3300": {
"label": "Grafana LGTM",
"onAutoForward": "notify"
},
"4317": {
"label": "OpenTelemetry OTLP gRPC",
"onAutoForward": "silent"
},
"4318": {
"label": "OpenTelemetry OTLP HTTP",
"onAutoForward": "silent"
},
"4443": {
"label": "Next.js Dev HTTPS",
"protocol": "https",
Expand Down
14 changes: 14 additions & 0 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ services:
DB_TRUST_SERVER_CERTIFICATE: ${DB_TRUST_SERVER_CERTIFICATE:-true}
NODE_ENV: ${NODE_ENV:-development}
NEXT_TELEMETRY_DISABLED: ${NEXT_TELEMETRY_DISABLED:-1}
OTEL_EXPORTER_OTLP_ENDPOINT: ${OTEL_EXPORTER_OTLP_ENDPOINT:-http://otel-lgtm:4318}
OTEL_EXPORTER_OTLP_PROTOCOL: ${OTEL_EXPORTER_OTLP_PROTOCOL:-http/protobuf}
OTEL_SDK_ENABLED: ${OTEL_SDK_ENABLED:-true}
OTEL_SERVICE_NAME: ${OTEL_SERVICE_NAME:-kravhantering}
# Ports are forwarded via devcontainer.json forwardPorts (VS Code handles this)
# Proper init system for signal handling and zombie process reaping
init: true
Expand Down Expand Up @@ -87,6 +91,16 @@ services:
volumes:
- ../dev/keycloak:/opt/keycloak/data/import:ro

otel-lgtm:
image: grafana/otel-lgtm:latest
ports:
- "${OTEL_GRAFANA_HOST_PORT:-3300}:3000"
- "${OTEL_GRPC_HOST_PORT:-4317}:4317"
- "${OTEL_HTTP_HOST_PORT:-4318}:4318"
volumes:
- ../dev/grafana/provisioning/dashboard-provider.yml:/otel-lgtm/grafana/conf/provisioning/dashboards/kravhantering.yml:ro
- ../dev/grafana/provisioning/dashboards:/otel-lgtm/grafana/conf/provisioning/dashboards/custom:ro

volumes:
sqlserver-devcontainer-data:
codex-tmp:
14 changes: 13 additions & 1 deletion .devcontainer/elevated/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@
},

// Use 'forwardPorts' to make a list of ports inside the container available locally
"forwardPorts": [3000, 3001, 4443, 1433, 8080, 9323, 51204],
"forwardPorts": [3000, 3001, 3300, 4317, 4318, 4443, 1433, 8080, 9323, 51204],
"portsAttributes": {
"3000": {
"label": "Next.js Dev Server 1",
Expand All @@ -190,6 +190,18 @@
"label": "Next.js Dev Server 2",
"onAutoForward": "notify"
},
"3300": {
"label": "Grafana LGTM",
"onAutoForward": "notify"
},
"4317": {
"label": "OpenTelemetry OTLP gRPC",
"onAutoForward": "silent"
},
"4318": {
"label": "OpenTelemetry OTLP HTTP",
"onAutoForward": "silent"
},
"4443": {
"label": "Next.js Dev HTTPS",
"protocol": "https",
Expand Down
14 changes: 14 additions & 0 deletions .devcontainer/elevated/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ services:
DB_TRUST_SERVER_CERTIFICATE: ${DB_TRUST_SERVER_CERTIFICATE:-true}
NODE_ENV: ${NODE_ENV:-development}
NEXT_TELEMETRY_DISABLED: ${NEXT_TELEMETRY_DISABLED:-1}
OTEL_EXPORTER_OTLP_ENDPOINT: ${OTEL_EXPORTER_OTLP_ENDPOINT:-http://otel-lgtm:4318}
OTEL_EXPORTER_OTLP_PROTOCOL: ${OTEL_EXPORTER_OTLP_PROTOCOL:-http/protobuf}
OTEL_SDK_ENABLED: ${OTEL_SDK_ENABLED:-true}
OTEL_SERVICE_NAME: ${OTEL_SERVICE_NAME:-kravhantering}
# WARNING: This profile grants elevated privileges (SYS_ADMIN,
# seccomp=unconfined) and is intended only for trusted code.
# It must remain opt-in — do not use as the default configuration.
Expand Down Expand Up @@ -101,6 +105,16 @@ services:
volumes:
- ../../dev/keycloak:/opt/keycloak/data/import:ro

otel-lgtm:
image: grafana/otel-lgtm:latest
ports:
- "${OTEL_GRAFANA_HOST_PORT:-3300}:3000"
- "${OTEL_GRPC_HOST_PORT:-4317}:4317"
- "${OTEL_HTTP_HOST_PORT:-4318}:4318"
volumes:
- ../../dev/grafana/provisioning/dashboard-provider.yml:/otel-lgtm/grafana/conf/provisioning/dashboards/kravhantering.yml:ro
- ../../dev/grafana/provisioning/dashboards:/otel-lgtm/grafana/conf/provisioning/dashboards/custom:ro

volumes:
sqlserver-elevated-devcontainer-data:
codex-tmp:
11 changes: 11 additions & 0 deletions .env.development
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,17 @@ MSSQL_SA_PASSWORD=YourStrong!Passw0rd
NEXTJS_ENV=development
NEXT_PUBLIC_SITE_URL=http://localhost:3000

# Local OpenTelemetry defaults. The SDK only starts when
# OTEL_SDK_ENABLED=true and an OTLP endpoint is configured.
# This file is host-oriented, so it targets the LGTM host port. The
# devcontainer compose files inject http://otel-lgtm:4318 for the app
# container, matching DB_HOST=db inside the compose network.
CAPACITY_JSON_LOGS_ENABLED=true
OTEL_EXPORTER_OTLP_ENDPOINT=http://127.0.0.1:4318
OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
OTEL_SDK_ENABLED=true
OTEL_SERVICE_NAME=kravhantering

AUTH_OIDC_CLIENT_ID=kravhantering-app
AUTH_OIDC_CLIENT_SECRET=dev-only-app-secret
# --------------------------------------
Expand Down
17 changes: 17 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,23 @@ OPENROUTER_MGMT_API_KEY=
# Example: anthropic/claude-sonnet-4
NEXT_PUBLIC_DEFAULT_MODEL=

# --------------------------------------
# OpenTelemetry capacity observability
# --------------------------------------

# OTel is disabled unless this is exactly true and an OTLP endpoint is set.
# Host-based development can use docker-compose.otel.yml with 127.0.0.1.
# Inside the devcontainer/Docker Compose network, use http://otel-lgtm:4318.
# Deployments must opt in per environment with their platform collector endpoint.
OTEL_EXPORTER_OTLP_ENDPOINT=http://127.0.0.1:4318
OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
OTEL_SDK_ENABLED=false
OTEL_SERVICE_NAME=kravhantering

# Capacity JSON logs are enabled by default. Set this to false only after
# OTel logs and dashboards have been verified in the target environment.
CAPACITY_JSON_LOGS_ENABLED=true

# --------------------------------------
# Authentication (PhenixID OIDC)
# --------------------------------------
Expand Down
6 changes: 6 additions & 0 deletions .env.prodlike
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ DB_TRUST_SERVER_CERTIFICATE=true
MSSQL_SA_PASSWORD=YourStrong!Passw0rd
NEXT_PUBLIC_SITE_URL=http://localhost:3001

# Production-like validation mirrors deployment defaults: OTel stays disabled
# unless the environment explicitly opts in.
CAPACITY_JSON_LOGS_ENABLED=true
OTEL_SDK_ENABLED=false
OTEL_SERVICE_NAME=kravhantering

# --------------------------------------
# Authentication (PhenixID OIDC) — prodlike runs with NODE_ENV=production,
# which means auth boot validation is strict (cannot disable, all OIDC
Expand Down
9 changes: 8 additions & 1 deletion cspell.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,7 @@
"ztna",
"pointerup",
"pointercancel",
"piechart",
"Kravtexter",
"Kravtexterna",
"viewports",
Expand Down Expand Up @@ -384,6 +385,9 @@
"misroutes",
"misalign",
"deepseek",
"dedup",
"drilldown",
"drilldowns",
"konfidens",
"medelkonfidens",
"mistralai",
Expand Down Expand Up @@ -419,6 +423,7 @@
"typeorm",
"authorsteward",
"resursnära",
"rgba",
"routas",
"sandboxed",
"tokenverifierare",
Expand Down Expand Up @@ -447,7 +452,9 @@
"kravkontrakt",
"SARIF",
"aquasecurity",
"schemathesis"
"schemathesis",
"timepicker",
"traceql"
],
"flagWords": [],
"ignorePaths": [
Expand Down
14 changes: 14 additions & 0 deletions dev/grafana/provisioning/dashboard-provider.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: 1

providers:
- name: Kravhantering capacity observability
orgId: 1
folder: Kravhantering
type: file
disableDeletion: false
updateIntervalSeconds: 10
allowUiUpdates: true
options:
path: /otel-lgtm/grafana/conf/provisioning/dashboards/custom
foldersFromFilesStructure: true

Loading
Loading