Repository navigation
The server can export its job queue size and oldest wait per base over OpenTelemetry - #1540
Conversation
ae6d8d6 to
391b322
Compare
Carry the OpenTelemetry metrics onto re-dev (upstream deeplethe#1540 to deeplethe#1548)
The server can push its metrics to Prometheus over OTLP/HTTP (upstream deeplethe#1540)
WaylandYang
left a comment
There was a problem hiding this comment.
Thanks, this follows everything from #1539, and the separate filter and the protocol switch are both welcome. Merging. One optional follow-up: keeping only the HTTP transport would drop tonic and three related crates (reqwest is already in the tree). gRPC users can point at a collector with an HTTP receiver, so I'd take that small PR if you agree.
|
Approved — thanks! It's fallen behind |
…when OTEL_EXPORTER_OTLP_ENDPOINT is set (deeplethe#1539) Signed-off-by: Bogdan Szabo <bogdan@re-cinq.com>
…ane and status (deeplethe#1539) Signed-off-by: Bogdan Szabo <bogdan@re-cinq.com>
…s otherwise (deeplethe#1539) utopia=debug stays a stdout setting: the global EnvFilter now applies to the fmt layer only, so debug spans are no longer exported. One exporter test per metric is kept.
…TER=none keeps metrics only (deeplethe#1539) http/protobuf is the default, as the OTel spec asks, and grpc stays one variable away. Prometheus's own OTLP receiver takes HTTP and no traces, so both are needed to push metrics straight to it.
620458e to
5a5b29a
Compare
|
@WaylandYang thank you so much for the review! Rebased onto the latest |
Hi! This is the first of the three PRs for #1539: the setup and both queue gauges. #1541 is folded in, as suggested on #1539.
When
OTEL_EXPORTER_OTLP_ENDPOINTis set, the server sends its traces and metrics over OTLP. When it is not set, nothing changes and the logs look exactly as before.utopia.jobs.queue.sizeis the number of due queued and running jobs per base, lane and status. One grouped query refreshes it every 30 seconds. A retry that is not due yet is left out, the same way the worker skips it. A job is placed in its base through its kb_id, document or source, and a malformed kb_id lands under "none" instead of failing the count.utopia.jobs.queue.oldest_waitis how long, in seconds, the oldest due queued job of each base, lane and status has waited. It reads from the same snapshot, so it adds no query.OTEL_EXPORTER_OTLP_PROTOCOL:http/protobufby default, as the OTel spec asks, orgrpc.OTEL_TRACES_EXPORTER=nonekeeps metrics only. Together they let the server push straight into Prometheus's own OTLP receiver (--web.enable-otlp-receiver), which takes HTTP and no traces. I checked that against Prometheus 3.5 locally, and both queue gauges arrived.infoby default and overridable withUTOPIA_OTEL_FILTER. The globalEnvFilternow applies to stdout only, soutopia=debugspans stay in the log and are not exported.Tests: one in-memory exporter test per gauge, one for the refresh against the database, one checking that a debug span stays out of the export, and three for reading the endpoint.
I checked it against a local collector and both gauges showed up as expected. Model calls and job outcomes come next, as their own PRs against
dev. Thanks for taking a look!