Docs: RUST_LOG also gates span export (#135)
The subscriber's single EnvFilter fronts both the console and the OTel layer, so RUST_LOG decides which spans exist for export. Documented in CLAUDE.md (supported range info/debug) and at the filter in init_tracing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
f510940819
commit
517d1d4b62
2 files changed
+14
-1
No files matched your search
@@ -581,6 +581,16 @@ an incoming `traceparent`). Conventions:
|
|||||||
never hold `span.enter()` across an `.await`.
|
never hold `span.enter()` across an `.await`.
|
||||||
- DB: `otel::trace_db_call`; LLM: `otel::start_llm_request_span` (injects
|
- DB: `otel::trace_db_call`; LLM: `otel::start_llm_request_span` (injects
|
||||||
`traceparent` downstream).
|
`traceparent` downstream).
|
||||||
|
- **`RUST_LOG` gates spans, not just logs.** The subscriber's single
|
||||||
|
`EnvFilter` sits in front of both the console and the OTel layer, so a span
|
||||||
|
below the filter level is never created: it's missing from the export, it
|
||||||
|
breaks the parent chain for its children, and an `llm.request` below it
|
||||||
|
sends no `traceparent`. Every span in the codebase is `info` level, so
|
||||||
|
`RUST_LOG=info` or `debug` (the supported range) exports everything;
|
||||||
|
`warn`/`error` silently turns tracing off. Per-target overrides like
|
||||||
|
`RUST_LOG=info,image_api::otel=warn` drop just those spans (here: DB and
|
||||||
|
LLM). If export ever needs to be independent of console verbosity, give
|
||||||
|
the OTel layer its own per-layer filter in `otel::init_tracing`.
|
||||||
|
|
||||||
**Memory Exclusion:**
|
**Memory Exclusion:**
|
||||||
`PathExcluder` in `memories.rs` filters out directories from memories API via `EXCLUDED_DIRS` environment variable (comma-separated paths or substring patterns). The same excluder is applied to face-detection candidates (`face_watch::filter_excluded`) so junk directories like `@eaDir` / `.thumbnails` don't burn detect calls on Apollo.
|
`PathExcluder` in `memories.rs` filters out directories from memories API via `EXCLUDED_DIRS` environment variable (comma-separated paths or substring patterns). The same excluder is applied to face-detection candidates (`face_watch::filter_excluded`) so junk directories like `@eaDir` / `.thumbnails` don't burn detect calls on Apollo.
|
||||||
@@ -665,7 +675,7 @@ GIFS_DIRECTORY=/path/to/gifs # Video GIF thumbnails
|
|||||||
BIND_URL=0.0.0.0:8080 # Server binding
|
BIND_URL=0.0.0.0:8080 # Server binding
|
||||||
CORS_ALLOWED_ORIGINS=http://localhost:3000
|
CORS_ALLOWED_ORIGINS=http://localhost:3000
|
||||||
SECRET_KEY=your-secret-key-here # JWT signing secret
|
SECRET_KEY=your-secret-key-here # JWT signing secret
|
||||||
RUST_LOG=info # Log level
|
RUST_LOG=info # Log level; also gates span export (keep at info/debug, see "Tracing")
|
||||||
EXCLUDED_DIRS=/private,/archive # Comma-separated paths to exclude from memories
|
EXCLUDED_DIRS=/private,/archive # Comma-separated paths to exclude from memories
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -55,6 +55,9 @@ pub fn init_tracing() {
|
|||||||
let tracer = tracer_provider.tracer("image-server");
|
let tracer = tracer_provider.tracer("image-server");
|
||||||
global::set_tracer_provider(tracer_provider);
|
global::set_tracer_provider(tracer_provider);
|
||||||
|
|
||||||
|
// One EnvFilter in front of BOTH layers: `RUST_LOG` also decides which
|
||||||
|
// spans exist for export. All spans are `info`, so keep it at info/debug
|
||||||
|
// (see CLAUDE.md "Tracing"); `warn` turns span export off.
|
||||||
tracing_subscriber::registry()
|
tracing_subscriber::registry()
|
||||||
.with(
|
.with(
|
||||||
tracing_subscriber::EnvFilter::try_from_default_env()
|
tracing_subscriber::EnvFilter::try_from_default_env()
|
||||||
|
|||||||
Reference in new issue
Block a user