File tree Expand file tree Collapse file tree 2 files changed +32
-0
lines changed
main/java/datadog/trace/core/datastreams
test/groovy/datadog/trace/core/datastreams Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change 77import com .datadoghq .sketch .ddsketch .encoding .ByteArrayInput ;
88import com .datadoghq .sketch .ddsketch .encoding .GrowingByteArrayOutput ;
99import com .datadoghq .sketch .ddsketch .encoding .VarEncodingHelper ;
10+ import datadog .common .container .ContainerInfo ;
1011import datadog .context .propagation .CarrierVisitor ;
1112import datadog .trace .api .Config ;
1213import datadog .trace .api .ProcessTags ;
@@ -280,6 +281,10 @@ public static long getBaseHash(WellKnownTags wellKnownTags) {
280281 CharSequence processTags = ProcessTags .getTagsForSerialization ();
281282 if (processTags != null ) {
282283 builder .append (processTags );
284+ String containerTagsHash = ContainerInfo .get ().getContainerTagsHash ();
285+ if (containerTagsHash != null && !containerTagsHash .isEmpty ()) {
286+ builder .append (containerTagsHash );
287+ }
283288 }
284289 return FNV64Hash .generateHash (builder .toString (), FNV64Hash .Version .v1 );
285290 }
Original file line number Diff line number Diff line change 11package datadog.trace.core.datastreams
22
3+ import datadog.common.container.ContainerInfo
34import datadog.communication.ddagent.DDAgentFeaturesDiscovery
45import datadog.trace.api.Config
56import datadog.trace.api.DDTraceId
@@ -481,6 +482,32 @@ class DefaultPathwayContextTest extends DDCoreSpecification {
481482 ProcessTags.reset()
482483 }
483484
485+ def " ContainerTagsHash used in hash calculation when enabled propagateTagsEnabled= #propagateTagsEnabled" () {
486+ when:
487+ injectSysConfig(EXPERIMENTAL_PROPAGATE_PROCESS_TAGS_ENABLED, propagateTagsEnabled.toString())
488+ ProcessTags.reset()
489+ ProcessTags.addTag(" 000 " , " first" )
490+ def firstBaseHash = DefaultPathwayContext.getBaseHash(wellKnownTags)
491+
492+ then:
493+ ContainerInfo.get().setContainerTagsHash(" < test- container- tags- hash> " )
494+ def secondBaseHash = DefaultPathwayContext.getBaseHash(wellKnownTags)
495+
496+ expect:
497+ if (propagateTagsEnabled) {
498+ assert secondBaseHash != firstBaseHash
499+ } else {
500+ assert secondBaseHash == firstBaseHash
501+ }
502+
503+ cleanup:
504+ injectSysConfig(EXPERIMENTAL_PROPAGATE_PROCESS_TAGS_ENABLED, " false " )
505+ ProcessTags.reset()
506+
507+ where:
508+ propagateTagsEnabled << [true, false]
509+ }
510+
484511 def " Check context extractor decorator behavior" () {
485512 given:
486513 def sink = Mock(Sink)
You can’t perform that action at this time.
0 commit comments