Repository navigation
feat(overview-metrics): asset_composition routine (subtype tree, two count scopes) - #534
Merged
Merged
Conversation
…nd two count scopes Adds asset_subtype_tree() and asset_composition() to pyegeria.view.overview_metrics (RS-W1-4 PR-A): the subtype tree under a root (default Asset) to a depth, each type counted in viewer and/or repository scope, an `other` row per parent, and not_visible = repository - viewer. All counts in both scopes share one ThreadPoolExecutor (default 3 workers, hard cap 5, below Egeria's pool of 10). A 0 is nothing_found; a failed count is not_measured with its reason, never 0. Each cell names its population under `population` (viewer | repository). Registered as `asset_composition` with the first built-in AnalyticDeclaration (distribution; repository_count, viewer_count, not_visible in elements). The absence sentences use measured_nothing, because RS-W1-1 PR-2 has not landed. Signed-off-by: Dan Wolfson <dan.wolfson@pdr-associates.com>
This was referenced Nov 7, 2026
Merged
dwolfson
added a commit
that referenced
this pull request
Nov 7, 2026
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
RS-W1-4 PR-A: the
asset_compositionroutine inpyegeria/view/overview_metrics.py, registered inanalytic_registry.pywith anAnalyticDeclaration. PR-B (egeria-workspaces, the Overview endpoint and histogram) waits for a release that contains this.asset_subtype_tree(vm, root="Asset", depth=2)walks the tree breadth-first withValidMetadataManager.get_sub_types, one call per expanded node. The root is level 0. A null result means "no subtypes". A call that raises setssubtypes_erroron the node, and that node gets nootherrow. After each parent's children comes anotherrow:type_name = parent,exact_type = True, at the children's level.asset_composition(mgr, vm=None, root="Asset", depth=2, as_of=None, scopes=("viewer", "repository"), concurrency=3, strict=True)counts each distinct type once per scope withcount_elements(mgr, t, as_of, strict=True, scope=s). All counts in both scopes run in oneThreadPoolExecutor(max_workers=concurrency), so the cap applies to everything in flight. The default is 3. Anything above 5 is lowered to 5, because Egeria's database pool is 10 connections.strict=Falseis refused.nothing_found. A failure (None or an exception) isnot_measuredwith the failure's words inreason, and is never 0. Anothercell is parent − sum(children), but only when the parent and every child are established in that scope. Otherwise it isnot_measuredwith "a child count is missing" (or "the parent count is missing").not_visibleneeds both scopes established. If only one scope was requested, it isnot_measuredwith "needs both scopes". A negative difference is alsonot_measured, never shown as a number.population(viewer|repository), the owner's choice for RS-W1-1 §5. The routine's keyword staysscopes=, andcount_elementskeepsscope=.measured_nothing, because RS-W1-1 PR-2 (thenothing_foundrename in the declaration) has not landed. pyegeria'sAbsenceSentencesstill requires that field.vmis optional and defaults tomgr. AnEgeriaTechserves both. The report-spec executor binds only clients namedmgr/ce/expert/client, so a requiredvmcould not be run from a report spec.typedefsproducer, two per-rowderives (viewer count, repository count) and adifference. Today it is one opaque routine.Cell shape (
CompositionCell)Result shape (
AssetComposition, TypedDicts inoverview_metrics)The envelope is
measuredwhen any cell is measured. It isnothing_foundwhen every established cell is 0, andnot_establishedotherwise.state/state_reasonare the keysformat_set_executor._result_envelopereads.Declaration
pyegeria's
AnalyticDeclarationhas no out-shape field. The declared out shape is therefore theAssetComposition/AssetCompositionRow/CompositionCellTypedDicts, and the spec'sreturnsnames them. This is the first built-in that carries a declaration, sotest_existing_specs_load_without_a_declarationnow exempts the declared built-ins and checks they really declare one.Tests
tests/micro-tests/test_overview_metrics.pyuse a fakevmwith a three-level tree and a fake counter that fails one type in one scope and raises on another. They cover:otherrows, depth 3, and skipping non-direct subtypes;nothing_found;not_measuredwith the exception's words, and the effect onotherandnot_visible;as_ofpassthrough,vmdefaulting tomgr, and bad arguments;push_downper scope;pytest tests/micro-tests: 1835 collected, 0 failed.Live check (read-only, local platform, repository scope only, depth 2)
Level 1 plus
otheradds up to theAssettotal (2,997 + 210 + 58,102 + 0 + 6 = 61,315). Viewer scope was not run live; the viewerProcesscount takes about 120 s.No release, version bump or tag in this PR.
🤖 Generated with Claude Code