@@ -25,10 +25,11 @@ class FootprintForkedTest extends DDSpecification {
2525 setup :
2626 CountDownLatch latch = new CountDownLatch (1 )
2727 ValidatingSink sink = new ValidatingSink (latch)
28- DDAgentFeaturesDiscovery features = Mock (DDAgentFeaturesDiscovery )
29- features. supportsMetrics() >> true
30- features. spanKindsToComputedStats() >> []
31- features. peerTags() >> []
28+ DDAgentFeaturesDiscovery features = Stub (DDAgentFeaturesDiscovery ) {
29+ it. supportsMetrics() >> true
30+ it. spanKindsToComputedStats() >> []
31+ it. peerTags() >> []
32+ }
3233 ConflatingMetricsAggregator aggregator = new ConflatingMetricsAggregator (
3334 new WellKnownTags (" runtimeid" ," hostname" , " env" , " service" , " version" ," language" ),
3435 []. toSet() as Set<String > ,
@@ -37,8 +38,10 @@ class FootprintForkedTest extends DDSpecification {
3738 1000 ,
3839 1000 ,
3940 100 ,
40- SECONDS )
41- long baseline = footprint(aggregator)
41+ SECONDS
42+ )
43+ // Removing the 'features' as it's a mock, and mocks are heavyweight, e.g. around 22MiB
44+ def baseline = footprint(aggregator, features)
4245 aggregator. start()
4346
4447 when : " lots of traces are published"
@@ -72,7 +75,8 @@ class FootprintForkedTest extends DDSpecification {
7275 assert latch. await(30 , SECONDS )
7376
7477 then :
75- footprint(aggregator) - baseline <= 10 * 1024 * 1024
78+ def layout = footprint(aggregator, features)
79+ layout. totalSize() - baseline. totalSize() <= 10 * 1024 * 1024
7680
7781 cleanup :
7882 aggregator. close()
@@ -136,9 +140,14 @@ class FootprintForkedTest extends DDSpecification {
136140 }
137141
138142
139- static long footprint (Object o ) {
140- GraphLayout layout = GraphLayout . parseInstance(o)
141- System . err. println (layout. toFootprint())
142- return layout. totalSize()
143+ static GraphLayout footprint (Object root , Object ... excludedRootFieldInstance ) {
144+ GraphLayout layout = GraphLayout . parseInstance(root)
145+
146+ excludedRootFieldInstance. each {
147+ layout = layout. subtract(GraphLayout . parseInstance(it))
148+ }
149+
150+ println layout. toFootprint()
151+ return layout
143152 }
144153}
0 commit comments