Skip to content

Commit 5b8822f

Browse files
committed
fix(docker): forward signal-specific OTLP protocols
1 parent 2a1fbe5 commit 5b8822f

4 files changed

Lines changed: 30 additions & 1 deletion

File tree

‎docker-compose.yml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ services:
3131
OTEL_EXPORTER_OTLP_METRICS_ENDPOINT: ${OTEL_EXPORTER_OTLP_METRICS_ENDPOINT:-}
3232
OTEL_EXPORTER_OTLP_LOGS_ENDPOINT: ${OTEL_EXPORTER_OTLP_LOGS_ENDPOINT:-}
3333
OTEL_EXPORTER_OTLP_PROTOCOL: ${OTEL_EXPORTER_OTLP_PROTOCOL:-http/protobuf}
34+
OTEL_EXPORTER_OTLP_TRACES_PROTOCOL: ${OTEL_EXPORTER_OTLP_TRACES_PROTOCOL:-}
35+
OTEL_EXPORTER_OTLP_METRICS_PROTOCOL: ${OTEL_EXPORTER_OTLP_METRICS_PROTOCOL:-}
36+
OTEL_EXPORTER_OTLP_LOGS_PROTOCOL: ${OTEL_EXPORTER_OTLP_LOGS_PROTOCOL:-}
3437
OTEL_SERVICE_NAME: ${OTEL_SERVICE_NAME:-}
3538
OTEL_SEMCONV_STABILITY_OPT_IN: ${OTEL_SEMCONV_STABILITY_OPT_IN:-}
3639
OPENCLAW_OTEL_PRELOADED: ${OPENCLAW_OTEL_PRELOADED:-}

‎docs/gateway/configuration-reference.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1340,7 +1340,8 @@ writer is best-effort, not a lossless compliance archive.
13401340
- `OTEL_SEMCONV_STABILITY_OPT_IN=gen_ai_latest_experimental`: environment toggle for latest experimental GenAI inference span shape, including `{gen_ai.operation.name} {gen_ai.request.model}` span names, `CLIENT` span kind, and `gen_ai.provider.name` instead of legacy `gen_ai.system`. By default spans keep `openclaw.model.call` and `gen_ai.system` for compatibility; GenAI metrics use bounded semantic attributes.
13411341
- `OPENCLAW_OTEL_PRELOADED=1`: environment toggle for hosts that already registered a global OpenTelemetry SDK. OpenClaw then skips plugin-owned SDK startup/shutdown while keeping diagnostic listeners active.
13421342
- `OTEL_EXPORTER_OTLP_TRACES_ENDPOINT`, `OTEL_EXPORTER_OTLP_METRICS_ENDPOINT`, and `OTEL_EXPORTER_OTLP_LOGS_ENDPOINT`: signal-specific endpoint env vars used when the matching config key is unset.
1343-
- `OTEL_EXPORTER_OTLP_PROTOCOL`: protocol fallback used only when `otel.protocol` is unset. Set it to `http/protobuf` or leave it unset; unsupported values are rejected when an OTLP signal is enabled and are not rewritten by Doctor.
1343+
- `OTEL_EXPORTER_OTLP_TRACES_PROTOCOL`, `OTEL_EXPORTER_OTLP_METRICS_PROTOCOL`, and `OTEL_EXPORTER_OTLP_LOGS_PROTOCOL`: signal-specific protocol fallbacks used when `otel.protocol` is unset. Each overrides `OTEL_EXPORTER_OTLP_PROTOCOL` for its signal.
1344+
- `OTEL_EXPORTER_OTLP_PROTOCOL`: shared protocol fallback used when neither `otel.protocol` nor the matching signal-specific variable is set. Only `http/protobuf` is supported. Protocol validation is isolated per signal, so an unsupported resolved value disables that signal's OTLP exporter without blocking supported sibling signals. Doctor does not rewrite environment variables.
13441345
- `cacheTrace.enabled`: log cache trace snapshots for embedded runs (default: `false`).
13451346

13461347
---

‎scripts/docker/setup.sh‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -542,6 +542,9 @@ export OTEL_EXPORTER_OTLP_TRACES_ENDPOINT="${OTEL_EXPORTER_OTLP_TRACES_ENDPOINT:
542542
export OTEL_EXPORTER_OTLP_METRICS_ENDPOINT="${OTEL_EXPORTER_OTLP_METRICS_ENDPOINT:-}"
543543
export OTEL_EXPORTER_OTLP_LOGS_ENDPOINT="${OTEL_EXPORTER_OTLP_LOGS_ENDPOINT:-}"
544544
export OTEL_EXPORTER_OTLP_PROTOCOL="${OTEL_EXPORTER_OTLP_PROTOCOL:-}"
545+
export OTEL_EXPORTER_OTLP_TRACES_PROTOCOL="${OTEL_EXPORTER_OTLP_TRACES_PROTOCOL:-}"
546+
export OTEL_EXPORTER_OTLP_METRICS_PROTOCOL="${OTEL_EXPORTER_OTLP_METRICS_PROTOCOL:-}"
547+
export OTEL_EXPORTER_OTLP_LOGS_PROTOCOL="${OTEL_EXPORTER_OTLP_LOGS_PROTOCOL:-}"
545548
export OTEL_SERVICE_NAME="${OTEL_SERVICE_NAME:-}"
546549
export OTEL_SEMCONV_STABILITY_OPT_IN="${OTEL_SEMCONV_STABILITY_OPT_IN:-}"
547550
export OPENCLAW_OTEL_PRELOADED="${OPENCLAW_OTEL_PRELOADED:-}"
@@ -749,6 +752,9 @@ upsert_env "$ENV_FILE" \
749752
OTEL_EXPORTER_OTLP_METRICS_ENDPOINT \
750753
OTEL_EXPORTER_OTLP_LOGS_ENDPOINT \
751754
OTEL_EXPORTER_OTLP_PROTOCOL \
755+
OTEL_EXPORTER_OTLP_TRACES_PROTOCOL \
756+
OTEL_EXPORTER_OTLP_METRICS_PROTOCOL \
757+
OTEL_EXPORTER_OTLP_LOGS_PROTOCOL \
752758
OTEL_SERVICE_NAME \
753759
OTEL_SEMCONV_STABILITY_OPT_IN \
754760
OPENCLAW_OTEL_PRELOADED \

‎src/docker-setup.e2e.test.ts‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,25 @@ describe("scripts/docker/setup.sh", () => {
214214
expect(envFile).toContain("OPENCLAW_DISABLE_BONJOUR=0");
215215
});
216216

217+
it("persists and forwards signal-specific OTLP protocol overrides", async () => {
218+
const activeSandbox = requireSandbox(sandbox);
219+
const protocolEnv = {
220+
OTEL_EXPORTER_OTLP_TRACES_PROTOCOL: "http/protobuf",
221+
OTEL_EXPORTER_OTLP_METRICS_PROTOCOL: "http/protobuf",
222+
OTEL_EXPORTER_OTLP_LOGS_PROTOCOL: "http/protobuf",
223+
};
224+
225+
const result = runDockerSetup(activeSandbox, protocolEnv);
226+
227+
expect(result.status).toBe(0);
228+
const envFile = await readFile(join(activeSandbox.rootDir, ".env"), "utf8");
229+
const compose = await readFile(join(repoRoot, "docker-compose.yml"), "utf8");
230+
for (const [key, value] of Object.entries(protocolEnv)) {
231+
expect(envFile).toContain(`${key}=${value}`);
232+
expect(compose).toContain(`${key}: \${${key}:-}`);
233+
}
234+
});
235+
217236
it("normalizes legacy OPENCLAW_DOCKER_APT_PACKAGES into OPENCLAW_IMAGE_APT_PACKAGES", async () => {
218237
const activeSandbox = requireSandbox(sandbox);
219238
await resetDockerLog(activeSandbox);

0 commit comments

Comments
 (0)