Skip to content

Commit 2cd7c6b

Browse files
committed
add comments to test
1 parent 0893fe6 commit 2cd7c6b

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

dd-trace-core/src/test/groovy/datadog/trace/core/datastreams/DefaultDataStreamsMonitoringTest.groovy

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,17 @@ class DefaultDataStreamsMonitoringTest extends DDCoreSpecification {
7777
def dataStreams = new DefaultDataStreamsMonitoring(sink, features, timeSource, { traceConfig }, wellKnownTags, payloadWriter, DEFAULT_BUCKET_DURATION_NANOS)
7878

7979
then:
80+
// the first received schema is sampled, with a weight of one.
8081
dataStreams.canSampleSchema("schema1")
8182
dataStreams.trySampleSchema("schema1") == 1
83+
// the sampling is done by topic, so a schema on a different topic will also be sampled at once, also with a weight of one.
8284
dataStreams.canSampleSchema("schema2")
8385
dataStreams.trySampleSchema("schema2") == 1
86+
// no time has passed from the last sampling, so the same schema is not sampled again (two times in a row).
8487
!dataStreams.canSampleSchema("schema1")
8588
!dataStreams.canSampleSchema("schema1")
8689
timeSource.advance(30*1e9 as long)
90+
// now, 30 seconds have passed, so the schema is sampled again, with a weight of 3 (so it includes the two times the schema was not sampled).
8791
dataStreams.canSampleSchema("schema1")
8892
dataStreams.trySampleSchema("schema1") == 3
8993
}

0 commit comments

Comments
 (0)