Skip to content

Commit 57ba9fa

Browse files
authored
fix(doc): TOML otel exporter example — multi-line inline table is inv… (#7669)
…alid (#7668) The `otel` exporter example in `docs/config.md` is misleading and will cause the configuration parser to fail if copied verbatim. Summary ------- The example uses a TOML inline table but spreads the inline-table braces across multiple lines. TOML inline tables must be contained on a single line (`key = { a = 1, b = 2 }`); placing newlines inside the braces triggers a parse error in most TOML parsers and prevents Codex from starting. Reproduction ------------ 1. Paste the snippet below into `~/.codex/config.toml` (or your project config). 2. Run `codex` (or the command that loads the config). 3. The process will fail to start with a TOML parse error similar to: ```text Error loading config.toml: TOML parse error at line 55, column 27 | 55 | exporter = { otlp-http = { | ^ newlines are unsupported in inline tables, expected nothing ``` Problematic snippet (as currently shown in the docs) --------------------------------------------------- ```toml [otel] exporter = { otlp-http = { endpoint = "https://otel.example.com/v1/logs", protocol = "binary", headers = { "x-otlp-api-key" = "${OTLP_TOKEN}" } }} ``` Recommended fixes ------------------ ```toml [otel.exporter."otlp-http"] endpoint = "https://otel.example.com/v1/logs" protocol = "binary" [otel.exporter."otlp-http".headers] "x-otlp-api-key" = "${OTLP_TOKEN}" ``` Or, keep an inline table but write it on one line (valid but less readable): ```toml [otel] exporter = { "otlp-http" = { endpoint = "https://otel.example.com/v1/logs", protocol = "binary", headers = { "x-otlp-api-key" = "${OTLP_TOKEN}" } } } ```
1 parent acb8ed4 commit 57ba9fa

File tree

2 files changed

+38
-43
lines changed

2 files changed

+38
-43
lines changed

docs/config.md

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -615,40 +615,37 @@ Set `otel.exporter` to control where events go:
615615
endpoint, protocol, and headers your collector expects:
616616

617617
```toml
618-
[otel]
619-
exporter = { otlp-http = {
620-
endpoint = "https://otel.example.com/v1/logs",
621-
protocol = "binary",
622-
headers = { "x-otlp-api-key" = "${OTLP_TOKEN}" }
623-
}}
618+
[otel.exporter."otlp-http"]
619+
endpoint = "https://otel.example.com/v1/logs"
620+
protocol = "binary"
621+
622+
[otel.exporter."otlp-http".headers]
623+
"x-otlp-api-key" = "${OTLP_TOKEN}"
624624
```
625625

626626
- `otlp-grpc` – streams OTLP log records over gRPC. Provide the endpoint and any
627627
metadata headers:
628628

629629
```toml
630630
[otel]
631-
exporter = { otlp-grpc = {
632-
endpoint = "https://otel.example.com:4317",
633-
headers = { "x-otlp-meta" = "abc123" }
634-
}}
631+
exporter = { otlp-grpc = {endpoint = "https://otel.example.com:4317",headers = { "x-otlp-meta" = "abc123" }}}
635632
```
636633

637634
Both OTLP exporters accept an optional `tls` block so you can trust a custom CA
638635
or enable mutual TLS. Relative paths are resolved against `~/.codex/`:
639636

640637
```toml
641-
[otel]
642-
exporter = { otlp-http = {
643-
endpoint = "https://otel.example.com/v1/logs",
644-
protocol = "binary",
645-
headers = { "x-otlp-api-key" = "${OTLP_TOKEN}" },
646-
tls = {
647-
ca-certificate = "certs/otel-ca.pem",
648-
client-certificate = "/etc/codex/certs/client.pem",
649-
client-private-key = "/etc/codex/certs/client-key.pem",
650-
}
651-
}}
638+
[otel.exporter."otlp-http"]
639+
endpoint = "https://otel.example.com/v1/logs"
640+
protocol = "binary"
641+
642+
[otel.exporter."otlp-http".headers]
643+
"x-otlp-api-key" = "${OTLP_TOKEN}"
644+
645+
[otel.exporter."otlp-http".tls]
646+
ca-certificate = "certs/otel-ca.pem"
647+
client-certificate = "/etc/codex/certs/client.pem"
648+
client-private-key = "/etc/codex/certs/client-key.pem"
652649
```
653650

654651
If the exporter is `none` nothing is written anywhere; otherwise you must run or point to your

docs/example-config.md

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -341,30 +341,28 @@ environment = "dev"
341341
exporter = "none"
342342

343343
# Example OTLP/HTTP exporter configuration
344-
# [otel]
345-
# exporter = { otlp-http = {
346-
# endpoint = "https://otel.example.com/v1/logs",
347-
# protocol = "binary", # "binary" | "json"
348-
# headers = { "x-otlp-api-key" = "${OTLP_TOKEN}" }
349-
# }}
344+
# [otel.exporter."otlp-http"]
345+
# endpoint = "https://otel.example.com/v1/logs"
346+
# protocol = "binary" # "binary" | "json"
347+
348+
# [otel.exporter."otlp-http".headers]
349+
# "x-otlp-api-key" = "${OTLP_TOKEN}"
350350

351351
# Example OTLP/gRPC exporter configuration
352-
# [otel]
353-
# exporter = { otlp-grpc = {
354-
# endpoint = "https://otel.example.com:4317",
355-
# headers = { "x-otlp-meta" = "abc123" }
356-
# }}
352+
# [otel.exporter."otlp-grpc"]
353+
# endpoint = "https://otel.example.com:4317",
354+
# headers = { "x-otlp-meta" = "abc123" }
357355

358356
# Example OTLP exporter with mutual TLS
359-
# [otel]
360-
# exporter = { otlp-http = {
361-
# endpoint = "https://otel.example.com/v1/logs",
362-
# protocol = "binary",
363-
# headers = { "x-otlp-api-key" = "${OTLP_TOKEN}" },
364-
# tls = {
365-
# ca-certificate = "certs/otel-ca.pem",
366-
# client-certificate = "/etc/codex/certs/client.pem",
367-
# client-private-key = "/etc/codex/certs/client-key.pem",
368-
# }
369-
# }}
357+
# [otel.exporter."otlp-http"]
358+
# endpoint = "https://otel.example.com/v1/logs"
359+
# protocol = "binary"
360+
361+
# [otel.exporter."otlp-http".headers]
362+
# "x-otlp-api-key" = "${OTLP_TOKEN}"
363+
364+
# [otel.exporter."otlp-http".tls]
365+
# ca-certificate = "certs/otel-ca.pem"
366+
# client-certificate = "/etc/codex/certs/client.pem"
367+
# client-private-key = "/etc/codex/certs/client-key.pem"
370368
```

0 commit comments

Comments
 (0)