@@ -25,10 +25,11 @@ class FootprintForkedTest extends DDSpecification {
25
25
setup :
26
26
CountDownLatch latch = new CountDownLatch (1 )
27
27
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
+ }
32
33
ConflatingMetricsAggregator aggregator = new ConflatingMetricsAggregator (
33
34
new WellKnownTags (" runtimeid" ," hostname" , " env" , " service" , " version" ," language" ),
34
35
[]. toSet() as Set<String > ,
@@ -37,8 +38,10 @@ class FootprintForkedTest extends DDSpecification {
37
38
1000 ,
38
39
1000 ,
39
40
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)
42
45
aggregator. start()
43
46
44
47
when : " lots of traces are published"
@@ -72,7 +75,8 @@ class FootprintForkedTest extends DDSpecification {
72
75
assert latch. await(30 , SECONDS )
73
76
74
77
then :
75
- footprint(aggregator) - baseline <= 10 * 1024 * 1024
78
+ def layout = footprint(aggregator, features)
79
+ layout. totalSize() - baseline. totalSize() <= 10 * 1024 * 1024
76
80
77
81
cleanup :
78
82
aggregator. close()
@@ -136,9 +140,14 @@ class FootprintForkedTest extends DDSpecification {
136
140
}
137
141
138
142
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
143
152
}
144
153
}
0 commit comments