Skip to content

Commit

Permalink
[stretch] add evp headers
Browse files Browse the repository at this point in the history
  • Loading branch information
nam committed Feb 18, 2022
1 parent ae314f5 commit 4cb5ced
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cmd/process-agent/collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import (
"github.com/DataDog/datadog-agent/pkg/process/util/api/headers"
"github.com/DataDog/datadog-agent/pkg/util/kubernetes/clustername"
"github.com/DataDog/datadog-agent/pkg/util/log"
"github.com/DataDog/datadog-agent/pkg/version"
)

type checkResult struct {
Expand Down Expand Up @@ -231,6 +232,8 @@ func (l *Collector) messagesToResults(start time.Time, name string, messages []m
if cid, err := clustername.GetClusterID(); err == nil && cid != "" {
extraHeaders.Set(headers.ClusterIDHeader, cid)
}
extraHeaders.Set(headers.EVPOriginHeader, "process-agent")
extraHeaders.Set(headers.EVPOriginVersionHeader, version.AgentVersion)
}

payloads = append(payloads, checkPayload{
Expand Down
4 changes: 4 additions & 0 deletions pkg/process/util/api/headers/headers.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,8 @@ const (
ClusterIDHeader = "X-Dd-Orchestrator-ClusterID"
// TimestampHeader contains the timestamp that the check data was created
TimestampHeader = "X-DD-Agent-Timestamp"
// EVPOriginHeader is the source/origin sending a request to the intake. This field should be filled with the name of the library sending profiles.
EVPOriginHeader = "DD-EVP-ORIGIN"
// EVPOriginVersionHeader is the version of above origin
EVPOriginVersionHeader = "DD-EVP-ORIGIN-VERSION"
)
3 changes: 3 additions & 0 deletions pkg/serializer/serializer.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"github.com/DataDog/datadog-agent/pkg/serializer/stream"
"github.com/DataDog/datadog-agent/pkg/util/compression"
"github.com/DataDog/datadog-agent/pkg/util/log"
"github.com/DataDog/datadog-agent/pkg/version"

"github.com/gogo/protobuf/proto"
)
Expand Down Expand Up @@ -461,6 +462,8 @@ func (s *Serializer) SendOrchestratorMetadata(msgs []ProcessMessageBody, hostNam
extraHeaders.Set(headers.HostHeader, hostName)
extraHeaders.Set(headers.ClusterIDHeader, clusterID)
extraHeaders.Set(headers.TimestampHeader, strconv.Itoa(int(time.Now().Unix())))
extraHeaders.Set(headers.EVPOriginHeader, "datadog-cluster-agent")
extraHeaders.Set(headers.EVPOriginVersionHeader, version.AgentVersion)

body, err := processPayloadEncoder(m)
if err != nil {
Expand Down

0 comments on commit 4cb5ced

Please sign in to comment.