feat(reporting): add OEM/platform distribution breakdown (backend) - #1590
Open
shouryapratap132006 wants to merge 1 commit into
Open
feat(reporting): add OEM/platform distribution breakdown (backend)#1590shouryapratap132006 wants to merge 1 commit into
shouryapratap132006 wants to merge 1 commit into
Conversation
Implements the DB aggregation query, OpenAPI route, handler, and unit tests for OEM/platform distribution — part of the Nebraska Reporting & Metrics Uplift effort. Note: codegen files were manually updated since oapi-codegen wasn't available locally; should be regenerated via 'make codegen' for correctness. Signed-off-by: Shourya Pratap <shouryapuja130406@gmail.com>
shouryapratap132006
force-pushed
the
feat/oem-distribution-breakdown
branch
from
August 15, 2026 09:59
fc9685b to
7d2de13
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds an end-to-end backend implementation of an OEM/platform distribution
breakdown for groups — surfacing which hardware/cloud platform (AWS, Azure,
VMware, GCP, etc.) each instance in a group is running on. This is data
Nebraska already collects (the
oemcolumn oninstance, added inmigration
0021_add_instance_oem.sql) but never aggregates or exposes.This follows the exact pattern of the existing
GetGroupVersionBreakdownfeature, reusing its query shape, handler structure, and test style.
Related to #2239 (Nebraska reporting and metrics uplift).
Changes
GetGroupOEMBreakdowninbackend/pkg/api/internal/dbreads/groups.go— joinsinstance_applicationwith
instance(sinceoemlives oninstancewhile group filteringand check-in window live on
instance_application), grouped byoem,with instance count and percentage.
OEMBreakdownEntryinbackend/pkg/api/types/group.go.GET /api/apps/{appIDorProductID}/groups/{groupID}/oem_breakdownadded to
backend/api/spec.yaml, withoemBreakdownEntryandgroupOEMBreakdownschemas.GetGroupOEMBreakdowninbackend/pkg/handler/groups.go,mirroring
GetGroupVersionBreakdown's handler (including theempty-array-not-null JSON quirk).
TestOEMBreakDownandTestOEMBreakDownEmptyinbackend/pkg/api/groups_test.go, covering populated and empty-group cases,and confirming fake/test instances are excluded.
Note on codegen
I didn't have
oapi-codegen/the Go toolchain available to runmake codegenin my dev environment, so the generated files (
backend/pkg/codegen/server.gen.goand
types.gen.go) were hand-edited to match whatoapi-codegenwouldnormally produce from the updated
spec.yaml. This should be verified byregenerating properly via
make codegen— flagging this explicitly sincehand-edited generated code is the riskiest part of this PR and I'd want a
maintainer to confirm it before this is considered mergeable as-is.
Status
Opening as a draft — this covers the backend slice only (query, API,
tests). Not yet included: the frontend chart component and the Prometheus
metric, which I'd propose as natural follow-ups once the backend shape is
confirmed as correct.
Testing
TestOEMBreakDownandTestOEMBreakDownEmptyadded and run locally.make check-backend-with-containersuite in this environment — will confirm and update before requesting
full review.
Related work
#1481 adds a Prometheus gauge (
nebraska_application_instances_by_oem)for the same underlying OEM data — that's the metrics layer of the distribution
reporting work described in flatcar/Flatcar#2239. This PR is complementary: it
adds the DB query, REST API endpoint, and OpenAPI schema needed to serve OEM
breakdown data to the dashboard/API consumers, which #1481 doesn't cover.
Together they'd close out three of the four layers mentioned in #2239
(DB, API, metric) — the dashboard chart component remains open.
Feedback very welcome, especially on the codegen approach and whether the
join strategy in the aggregation query matches Nebraska's conventions
elsewhere in the codebase.****