diff --git a/nextcloud_mcp_server/cli.py b/nextcloud_mcp_server/cli.py index a787fdeb..f247a1cd 100644 --- a/nextcloud_mcp_server/cli.py +++ b/nextcloud_mcp_server/cli.py @@ -326,6 +326,10 @@ def _init_worker_observability(settings: Settings) -> None: "OpenTelemetry tracing enabled (endpoint: %s)", settings.otel_exporter_otlp_endpoint, ) + else: + logger.info( + "OpenTelemetry tracing disabled (set OTEL_EXPORTER_OTLP_ENDPOINT to enable)" + ) @click.command() @@ -363,13 +367,9 @@ def worker(concurrency: int | None): f"resolved INGEST_QUEUE={settings.ingest_queue!r}" ) - # Initialize observability once the config is known to be runnable. The - # always-on API pod does this in its lifespan (app.py); the worker has its - # own entrypoint, so without this it emits plain-text logs and exposes no - # /metrics — leaving the ingest workload (which does the real - # parse/embed/upsert work, and where the astrolabe_* pipeline metrics + - # document_processor.parse spans are recorded) invisible in external - # split-worker mode (Deck #310, unblocks #175). + # Initialize observability here, not in a lifespan — the worker never runs + # uvicorn, so it skips app.py's bootstrap (the WHY lives in the helper's + # docstring). Done after the queue check so a misconfig fails fast. _init_worker_observability(settings) from nextcloud_mcp_server.vector.queue.procrastinate import ( # noqa: PLC0415 diff --git a/tests/test_cli.py b/tests/test_cli.py index c54fcc60..638e62ae 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -406,14 +406,14 @@ def test_init_worker_observability_sets_up_tracing_when_endpoint( """An OTLP endpoint enables tracing so worker spans (parse/embed) export.""" _init_worker_observability( _fake_settings( - otel_exporter_otlp_endpoint="http://otel:4317", + otel_exporter_otlp_endpoint="https://otel:4317", otel_traces_sampler_arg=0.5, ) ) assert patched_observability["tracing"] == { "service_name": "nextcloud-mcp-server", - "otlp_endpoint": "http://otel:4317", + "otlp_endpoint": "https://otel:4317", "otlp_verify_ssl": False, "sampling_rate": 0.5, }