-
Story
-
Resolution: Unresolved
-
Undefined
-
None
-
None
-
False
-
-
False
-
subs-swatch-thunder
-
-
Description
As a swatch developer, I need to remove the re-normalization logic from Product Usage Collectors so that they only perform categorization and "in the box" logic, trusting the already-normalized values from FactNormalizer.
Currently, collectors re-apply normalization rules:
- cloudProvider != null -> sockets = 1
- isMarketplace -> sockets = 0
- unmappedGuest -> sockets = 1
This is redundant since FactNormalizer already applies these rules before storing to instance_measurements.
Technical Details
Files:
- swatch-tally/src/main/java/.../collector/DefaultProductUsageCollector.java
- swatch-tally/src/main/java/.../collector/RHELProductUsageCollector.java
Before (DefaultProductUsageCollector):
if (normalizedFacts.getCloudProviderType() != null) { appliedSockets = normalizedFacts.isMarketplace() ? 0 : 1; // RE-NORMALIZING! appliedType = normalizedFacts.getCloudProviderType(); }
After:
if (normalizedFacts.getCloudProviderType() != null) { appliedSockets = normalizedFacts.getSockets(); // Trust normalized value appliedType = normalizedFacts.getCloudProviderType(); }
What Collectors Should Do (After)
1. Determine HardwareMeasurementType:
- PHYSICAL, VIRTUAL, HYPERVISOR, AWS, AZURE, GCP, ALIBABA
2. Apply "In the Box" Logic:
- Decide if host contributes to tallies based on hypervisor mapping
3. Use Normalized Values AS-IS:
- cores from NormalizedFacts.getCores()
- sockets from NormalizedFacts.getSockets()
Acceptance Criteria
- DefaultProductUsageCollector.buildBucket() uses normalized values directly
- RHELProductUsageCollector.buildBucket() uses normalized values directly
- No re-normalization logic remains in collectors
- host_tally_buckets values match instance_measurements for cores/sockets
- All existing collector tests pass (may need updates to reflect new behavior)
- Collectors still correctly determine HardwareMeasurementType
- Hypervisor-guest mapping logic unchanged
- is blocked by
-
SWATCH-4319 Migrate swatch-tally FactNormalizer to use CoreSocketNormalizer
-
- New
-
-
SWATCH-4320 Migrate swatch-metrics-hbi MeasurementNormalizer to use CoreSocketNormalizer
-
- New
-
- is related to
-
SWATCH-4318 Create CoreSocketNormalizer in swatch-common-instances
-
- New
-