You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(traffic): apply bound road conditions to the routing graph
Consume the OpenConditions segment bindings so a closure or speed cap
lands on the exact edges of the affected carriageway instead of a
point exclusion or a whole way.
- Core: isEdgeClosure / isRoutingRelevantBinding with normalized
vehicle-class matching, and binding fields on RoadConditionEvent.
- data-manager live cycle: fetch /segments/conditions.json, gate on
binding status and origin, trace edge-exact spans through Valhalla
trace_attributes with a per-cycle budget and a persisted cache,
fall back to whole-way overrides when tracing fails and to no
overrides when classification fails, then write closed (speed 0)
and capped edges into the live traffic tar. Stale conditions are
reused up to TRAFFIC_CONDITIONS_STALE_MS.
- GET /traffic/conditions/applied reports the observation ids whose
every override edge was written; 501 without OPENCONDITIONS_URL.
- Routing integration reads that applied set (fresh for ten minutes,
fail-open) and skips point exclusions for events the graph already
closes; the closure decision routes through isEdgeClosure and
active-time evaluation intersects span and schedule, so lorry-only
closures no longer detour cars.
- New env: TRAFFIC_VALHALLA_URL, TRAFFIC_CONDITIONS_STALE_MS; routing
manifest optionally requires data-manager.
- Docs: log lines, endpoint, and the operator end-to-end procedure in
monitoring.md; new configuration rows and .env.example entries.
|`traffic-live: span tracing`| Tracing counters for the cycle: `traced`, `unanswered`, `negative`, `skippedBudget`, `cacheHits`, `edgeExactSpans`, `wholeWaySpans`. |
371
+
|`traffic-live: bound ways missing from way→edge map, scheduling refresh`| Conditions referenced ways this deployment's map does not know; a way→edge rebuild was kicked off (at most hourly). Persistent counts mean the graph and the feed's road spine are on different OSM vintages. |
372
+
|`traffic-live: conditions fetch failed, reusing last good set`| OpenConditions was unreachable; the previous set is still within `TRAFFIC_CONDITIONS_STALE_MS` and stays applied. |
373
+
|`traffic-live: conditions fetch failed and last set is stale, dropping closures`| The outage outlasted `TRAFFIC_CONDITIONS_STALE_MS`. Closures are dropped from the graph; the router falls back to point exclusions. |
374
+
|`traffic-live: span tracing failed, falling back to whole-way binding`| The tracing pass itself failed. Closures still apply, whole-way instead of edge-exactly. |
375
+
|`traffic-live: conditions classification failed, writing no overrides`| Turning conditions into edge overrides threw. Live speeds are still written, but this cycle applies no closures or caps; the next cycle retries. |
376
+
|`traffic-live: span cache save failed`| The trace cache could not be persisted. Harmless for correctness: the in-memory cache still serves the rest of this process, so only a restart loses the verdicts and re-traces them. |
377
+
|`traffic-live: skipped out-of-range edges (traffic.tar/waysToEdges mismatch)`| The way→edge map references edges the current `traffic.tar` does not have. The daily traffic-extract cron resolves this by rebuilding both. |
378
+
379
+
A healthy instance shows `unanswered` at zero and `edgeExactSpans` dominating
380
+
`wholeWaySpans`. A rising `unanswered` points at the routing container, not at
381
+
the conditions feed; a `wholeWaySpans` that never falls usually means
382
+
`TRAFFIC_VALHALLA_URL` points somewhere other than the Valhalla holding this
383
+
deployment's traffic graph.
384
+
385
+
### Verifying edge closures end-to-end
386
+
387
+
Once the cycle reports closures, three requests confirm the graph really carries
388
+
them. First, check that conditions are arriving and that the writer credited
|`VALHALLA_CONTAINER`| Docker container name for data-manager traffic extraction. | Default `docker-valhalla-1`|
308
+
|`TRAFFIC_VALHALLA_URL`| Valhalla endpoint data-manager traces road-condition spans against, to narrow a closure to the exact graph edges it covers. Must be the co-deployed Valhalla holding this deployment's traffic graph — deliberately separate from `VALHALLA_URL`, which may point at a hosted endpoint. | Default `http://valhalla:8002`|
309
+
|`OPENCONDITIONS_URL`| Base URL of the OpenConditions instance the data-manager reads live road conditions from (`/segments/speed.csv` and `/segments/conditions.json`). Leave unset to run without live traffic — the live and predicted traffic crons then do not start at all. | Optional. Default unset |
310
+
|`TRAFFIC_LIVE_CRON`| Cron schedule for the live-traffic cycle that writes speeds, speed caps and closures into `traffic.tar`. Set to `disabled`, `off` or `false` to turn the cycle off. | Default `*/2 * * * *`|
311
+
|`TRAFFIC_CONDITIONS_STALE_MS`| How long the last good conditions set is reused while `/segments/conditions.json` keeps failing. Past this age the closures are dropped and the router falls back to point-based exclusions. | Default `600000` (10 min) |
308
312
|`TRUST_PROXY_RANGES`| IP ranges trusted by Fastify for reverse-proxy headers. | Default `uniquelocal`|
309
313
|`OPENMAPX_API_NODE_OPTIONS`| Node.js memory options for the `app-api` container. | Default `--max-old-space-size=1536`|
310
314
@@ -325,7 +329,7 @@ Keys and overrides for the `app-api` traffic and tile proxies.
325
329
|`CYCLOSM_TILE_URL`| Override URL for the CyclOSM tile proxy. | Optional. Commented |
326
330
|`WAYMARKED_CYCLING_TILE_URL`| Override URL for the Waymarked Trails cycling layer. | Optional. Commented |
327
331
|`OPENTOPOMAP_TILE_URL`| Override URL for the OpenTopoMap layer. | Optional. Commented |
0 commit comments