Skip to content

Fix telemetry aggregation and add lab-aware device health detection#708

Merged
nuclearcat merged 6 commits into
kernelci:mainfrom
nuclearcat:remove-cloudevents
Jul 21, 2026
Merged

Fix telemetry aggregation and add lab-aware device health detection#708
nuclearcat merged 6 commits into
kernelci:mainfrom
nuclearcat:remove-cloudevents

Conversation

@nuclearcat

Copy link
Copy Markdown
Member

This PR fixes broken telemetry aggregation after the PyMongo async migration and adds public API support for identifying physical devices that consistently fail to boot.

Device health is grouped by lab, device type, and physical device ID, ensuring that a successful boot in one lab does not hide failures in another.

Also we optimize HTML templates and add local tests.

PyMongo's native async collection methods return awaitables for index creation and aggregation. Calling them without await leaves indexes uncreated and makes aggregation endpoints fail when they try to consume a coroutine as a cursor.

Await both operations and add focused tests that verify the collection calls and cursor conversion are awaited.

Signed-off-by: Denys Fedoryshchenko <denys.f@collabora.com>
Device-type aggregation can hide a single dead board behind healthy peers, while mixing job and test events dilutes boot failures with many per-test results.

Add a physical-device anomaly scope backed only by job results, expose device_id in stats, and return constant-failure flags plus the latest error context. Document the public query and cover grouping, filtering, classification, and validation.

Signed-off-by: Denys Fedoryshchenko <denys.f@collabora.com>
LAVA runtime names currently identify labs, and device anomalies already use runtime as part of their grouping key. Exposing only the runtime field makes that isolation easy for API consumers to miss.

Add lab as an explicit stats filter and grouping alias, include it in anomaly rows, reject conflicting lab/runtime filters, and document that results from different labs remain separate.

Signed-off-by: Denys Fedoryshchenko <denys.f@collabora.com>
The HTML page handlers duplicate template path resolution, file reads, response construction, metrics, and cache headers. Some also use PlainTextResponse while manually overriding the content type.

Introduce an allowlisted template helper that consistently returns HTMLResponse, centralize the cache policy and template directory, and reuse it across public pages. Update the stale root test and cover page content types, cache headers, and rejection of non-allowlisted templates.

Signed-off-by: Denys Fedoryshchenko <denys.f@collabora.com>
Running the focused API checks currently requires manually creating isolated MongoDB and Redis services, assembling API and core dependencies in a disposable Python environment, and cleaning up each resource.

Add a configurable Docker-based runner that performs the targeted pytest suite and pinned Ruff checks with read-only source mounts and guaranteed cleanup. It accepts custom pytest arguments and supports alternate core checkout and image paths through environment variables.

Signed-off-by: Denys Fedoryshchenko <denys.f@collabora.com>
@nuclearcat
nuclearcat force-pushed the remove-cloudevents branch from 78fc20a to 35ef89e Compare July 21, 2026 04:40
MongoDB rejects creation when the same index definition already exists under a different name. Staging retains the event-history TTL definition as ttl_timestamp, so startup fails with IndexOptionsConflict when the API requests the generated timestamp_1 name.

Inspect existing index keys and behavior-affecting options before creation, reuse only equivalent definitions regardless of name, and recover from equivalent indexes created concurrently. Preserve startup failures for genuinely different TTL, uniqueness, or filter options.

Signed-off-by: Denys Fedoryshchenko <denys.f@collabora.com>
@nuclearcat
nuclearcat added this pull request to the merge queue Jul 21, 2026
Merged via the queue into kernelci:main with commit 95acafc Jul 21, 2026
3 checks passed
@nuclearcat
nuclearcat deleted the remove-cloudevents branch July 21, 2026 06:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant