@@ -11,8 +11,6 @@ import (
1111 "slices"
1212 "strconv"
1313
14- "github.com/google/uuid"
15-
1614 "github.com/DataDog/datadog-agent/comp/forwarder/defaultforwarder/resolver"
1715 "github.com/DataDog/datadog-agent/comp/forwarder/defaultforwarder/transaction"
1816)
@@ -75,21 +73,16 @@ type PipelineConfig struct {
7573
7674// PipelineDestination describes how to deliver a payload to the intake.
7775type PipelineDestination struct {
78- Resolver resolver.DomainResolver
79- Endpoint transaction.Endpoint
80- AddValidationHeaders bool
76+ Resolver resolver.DomainResolver
77+ Endpoint transaction.Endpoint
78+ ValidationBatchID string
8179}
8280
8381type forwarder interface {
8482 SubmitTransaction (* transaction.HTTPTransaction ) error
8583}
8684
8785func (dest * PipelineDestination ) send (payloads transaction.BytesPayloads , forwarder forwarder , headers http.Header ) error {
88- batchID , err := dest .maybeMakeBatchID ()
89- if err != nil {
90- return err
91- }
92-
9386 domain := dest .Resolver .Resolve (dest .Endpoint )
9487 for _ , auth := range dest .Resolver .GetAuthorizers () {
9588 for seq , payload := range payloads {
@@ -100,8 +93,8 @@ func (dest *PipelineDestination) send(payloads transaction.BytesPayloads, forwar
10093 for key := range headers {
10194 txn .Headers .Set (key , headers .Get (key ))
10295 }
103- if dest .AddValidationHeaders {
104- txn .Headers .Set ("X-Metrics-Request-ID" , batchID )
96+ if dest .ValidationBatchID != "" {
97+ txn .Headers .Set ("X-Metrics-Request-ID" , dest . ValidationBatchID )
10598 txn .Headers .Set ("X-Metrics-Request-Seq" , strconv .Itoa (seq ))
10699 txn .Headers .Set ("X-Metrics-Request-Len" , strconv .Itoa (len (payloads )))
107100 }
@@ -116,17 +109,6 @@ func (dest *PipelineDestination) send(payloads transaction.BytesPayloads, forwar
116109 return nil
117110}
118111
119- func (dest * PipelineDestination ) maybeMakeBatchID () (string , error ) {
120- if dest .AddValidationHeaders {
121- uuid , err := uuid .NewV7 ()
122- if err != nil {
123- return "" , err
124- }
125- return uuid .String (), nil
126- }
127- return "" , nil
128- }
129-
130112// PipelineContext holds information needed during and after pipeline execution.
131113type PipelineContext struct {
132114 Destinations []PipelineDestination
0 commit comments