TECH_DEBT: Add IG validation cost audit tool and cache observability - #1734
Draft
c-schuler wants to merge 3 commits into
Draft
TECH_DEBT: Add IG validation cost audit tool and cache observability#1734c-schuler wants to merge 3 commits into
c-schuler wants to merge 3 commits into
Conversation
Contributor
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
🛠️ Description of Changes
Adds two independent-but-related pieces of validation observability that emerged from team discussion about identifying computationally expensive checks in an IG:
Together these are "Phase 5a" of the validation-config roadmap discussion - deliberately separate from the SKIP/SUPPRESS categorization work on validation-config, since instrumentation and audit tooling are conceptually distinct from categorization rule migration.
Cache observability (ValidationCacheService)
@Cacheableproxy in favour of an explicit CacheManager.getCache(...).get(key) / put(key, value) path - necessary because the annotation proxy hides the lookup and gives us no way to observe hit vs. miss.Once this is deployed, hit / (hit + miss) in Grafana gives us a concrete answer to "how much is the cache actually saving us."
Validation cost audit tool (ValidationCostAudit)
Standalone main() class inside the validation module (no new Maven module - deliberate; adding a module was the original plan but the tool reuses production loader patterns cleanly enough that a co-located class is cheaper).
CLI:
--bundles --iterations 3 --report "mvn -pl validation exec:java
-Dexec.mainClass=com.lantanagroup.link.validation.audit.ValidationCostAudit
-Dexec.args="--ig <path.tgz> --deps
Isolation strategy. For each resource in each bundle, for each profile the resource declares, the tool deep-copies the resource, clears meta.profile, sets it back to the one profile under test, and times a FhirValidator.validateWithResult(...) call. First iteration is warmup and discarded; subsequent iterations are recorded. This attributes cost to a single profile rather than mixing all profiles that would normally fire together.
Terminology chain. In-memory only - DefaultProfileValidationSupport + PrePopulatedValidationSupport (loaded from the primary IG + all deps) + CommonCodeSystemsTerminologyService + InMemoryTerminologyServerValidaingValidationSupport, all wrapped in CachingValidationSupport. Noremote TS - the audit is about slice discrimination and FHIRPath invariants, not network latency, and production's remote-TS caching already flattens the network-cost dimension.
Report shape - JSON, ranked. Key sections:
Executive summary printed to stdout so runs give instant feedback without opening the JSON.
Log noise. Silences HAPI's INFO-level chatter (Fetching CodeSystem for..., Loading structure definitions from...) by default; --verbose / -v restores it. WARN/ERROR always get through.
Sample output
Ran against
gov.cdc.nhsn.measures.r4@2.0.0-cibuildwith 12 dependency IGs and both NHSN acute-care bundles (166 samples, ~4 s wall time):Top profiles by total time:
Top validation messages (normalized, deduped):
'http://hl7.org/fhir/expression-language#text/cql-identifier'Reading the numbers: Measure resources are the per-call hotspot (~180 by volume (146 samples). Much of the shareablevalueset cost is HAPIreporting the same missing-required-field errors — fix those in the IG and per-ValueSet mean should drop. The cohort-measure-cqfm per-call cost (192 ms) doesn't obviously trace to the top messages, which points at slice discriminas the next investigation.
Documentation
Java/validation/COST-AUDIT.md (228 lines) - invocation, CLI flags, iny, terminology chain rationale, JSON report shape, interpretationguide, explicit caveats (no per-invariant timing, warm-cache only, per-entry vs. bundle-level), NHSN case study with real numbers. README.md gets a one-line "Utilities" pointer.
What is NOT in this PR
Test plan
gov.cdc.nhsn.measures.r4@2.0.0-cibuildand produced coherent output🧪 Testing Performed
Audit tool ran end-to-end against
gov.cdc.nhsn.measures.r4@2.0.nt output🧑🔬 Unit Testing
📓 Documentation Updated
Java/validation/COST-AUDIT.md