Skip to content

Commit

Permalink
Add tagger tags to pod manifests (#31565)
Browse files Browse the repository at this point in the history
  • Loading branch information
aureleoules authored Dec 11, 2024
1 parent f238a89 commit 623bea0
Show file tree
Hide file tree
Showing 30 changed files with 68 additions and 39 deletions.
2 changes: 1 addition & 1 deletion comp/otelcol/ddflareextension/impl/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ require (
github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect
github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 // indirect
github.com/Code-Hex/go-generics-cache v1.5.1 // indirect
github.com/DataDog/agent-payload/v5 v5.0.137 // indirect
github.com/DataDog/agent-payload/v5 v5.0.138 // indirect
github.com/DataDog/datadog-agent/comp/core/config v0.59.0 // indirect
github.com/DataDog/datadog-agent/comp/core/flare/builder v0.59.0 // indirect
github.com/DataDog/datadog-agent/comp/core/flare/types v0.59.0 // indirect
Expand Down
4 changes: 2 additions & 2 deletions comp/otelcol/ddflareextension/impl/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion comp/otelcol/logsagentpipeline/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ replace (
require github.com/DataDog/datadog-agent/pkg/logs/pipeline v0.56.0-rc.3

require (
github.com/DataDog/agent-payload/v5 v5.0.137 // indirect
github.com/DataDog/agent-payload/v5 v5.0.138 // indirect
github.com/DataDog/datadog-agent/comp/core/hostname/hostnameinterface v0.56.0-rc.3 // indirect
github.com/DataDog/datadog-agent/comp/core/secrets v0.59.0 // indirect
github.com/DataDog/datadog-agent/comp/core/telemetry v0.56.0-rc.3 // indirect
Expand Down
4 changes: 2 additions & 2 deletions comp/otelcol/logsagentpipeline/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ require (
)

require (
github.com/DataDog/agent-payload/v5 v5.0.137 // indirect
github.com/DataDog/agent-payload/v5 v5.0.138 // indirect
github.com/DataDog/datadog-agent/comp/core/flare/builder v0.56.0-rc.3 // indirect
github.com/DataDog/datadog-agent/comp/core/flare/types v0.56.0-rc.3 // indirect
github.com/DataDog/datadog-agent/comp/core/secrets v0.59.0 // indirect
Expand Down
4 changes: 2 additions & 2 deletions comp/otelcol/logsagentpipeline/logsagentpipelineimpl/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ require (
)

require (
github.com/DataDog/agent-payload/v5 v5.0.137 // indirect
github.com/DataDog/agent-payload/v5 v5.0.138 // indirect
github.com/DataDog/datadog-agent/comp/core/config v0.57.1 // indirect
github.com/DataDog/datadog-agent/comp/core/flare/builder v0.57.1 // indirect
github.com/DataDog/datadog-agent/comp/core/flare/types v0.57.1 // indirect
Expand Down
4 changes: 2 additions & 2 deletions comp/otelcol/otlp/components/exporter/datadogexporter/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ require (
)

require (
github.com/DataDog/agent-payload/v5 v5.0.137 // indirect
github.com/DataDog/agent-payload/v5 v5.0.138 // indirect
github.com/DataDog/datadog-agent/comp/core/config v0.57.1 // indirect
github.com/DataDog/datadog-agent/comp/core/flare/builder v0.57.1 // indirect
github.com/DataDog/datadog-agent/comp/core/flare/types v0.57.1 // indirect
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,7 @@ require (

require (
github.com/DATA-DOG/go-sqlmock v1.5.2
github.com/DataDog/agent-payload/v5 v5.0.137
github.com/DataDog/agent-payload/v5 v5.0.138
github.com/DataDog/datadog-agent/comp/api/api/def v0.56.0-rc.3
github.com/DataDog/datadog-agent/comp/core/config v0.59.0
github.com/DataDog/datadog-agent/comp/core/flare/types v0.59.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ func (BaseHandlers) BuildManifestMessageBody(ctx processors.ProcessorContext, re
return ExtractModelManifests(ctx, resourceManifests, groupSize)
}

//nolint:revive // TODO(CAPP) Fix revive linter
func (BaseHandlers) ResourceTaggerTags(ctx processors.ProcessorContext, resource interface{}) []string {
return nil
}

// ExtractModelManifests creates the model manifest from the given manifests
func ExtractModelManifests(ctx processors.ProcessorContext, resourceManifests []interface{}, groupSize int) *model.CollectorManifest {
pctx := ctx.(*processors.K8sProcessorContext)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,23 @@ func (h *PodHandlers) ResourceVersion(ctx processors.ProcessorContext, resource,
return resourceModel.(*model.Pod).Metadata.ResourceVersion
}

// ResourceTaggerTags is a handler called to retrieve tags for a resource from the tagger.
//
//nolint:revive // TODO(CAPP) Fix revive linter
func (h *PodHandlers) ResourceTaggerTags(ctx processors.ProcessorContext, resource interface{}) []string {
r, ok := resource.(*corev1.Pod)
if !ok {
log.Debugf("Could not cast resource to pod")
return nil
}
tags, err := h.tagProvider.GetTags(r, taggertypes.HighCardinality)
if err != nil {
log.Debugf("Could not retrieve tags for pod: %s", err.Error())
return nil
}
return tags
}

// ScrubBeforeExtraction is a handler called to redact the raw resource before
// it is extracted as an internal resource model.
//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@ type Handlers interface {
// ResourceVersion returns the resource Version.
ResourceVersion(ctx ProcessorContext, resource, resourceModel interface{}) string

// ResourceTaggerTags returns the resource tags.
ResourceTaggerTags(ctx ProcessorContext, resource interface{}) []string

// ScrubBeforeExtraction replaces sensitive information in the resource
// before resource extraction.
ScrubBeforeExtraction(ctx ProcessorContext, resource interface{})
Expand Down Expand Up @@ -231,6 +234,7 @@ func (p *Processor) Process(ctx ProcessorContext, list interface{}) (processResu
Content: yaml,
Version: "v1",
ContentType: "json",
Tags: p.h.ResourceTaggerTags(ctx, resource),
})
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/logs/pipeline/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ require (
)

require (
github.com/DataDog/agent-payload/v5 v5.0.137 // indirect
github.com/DataDog/agent-payload/v5 v5.0.138 // indirect
github.com/DataDog/datadog-agent/comp/core/secrets v0.59.0 // indirect
github.com/DataDog/datadog-agent/comp/core/telemetry v0.56.0-rc.3 // indirect
github.com/DataDog/datadog-agent/comp/def v0.56.0-rc.3 // indirect
Expand Down
4 changes: 2 additions & 2 deletions pkg/logs/pipeline/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/logs/processor/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ replace (
)

require (
github.com/DataDog/agent-payload/v5 v5.0.137
github.com/DataDog/agent-payload/v5 v5.0.138
github.com/DataDog/datadog-agent/comp/core/hostname/hostnameinterface v0.56.0-rc.3
github.com/DataDog/datadog-agent/comp/logs/agent/config v0.56.0-rc.3
github.com/DataDog/datadog-agent/pkg/config/model v0.59.0
Expand Down
4 changes: 2 additions & 2 deletions pkg/logs/processor/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/process/util/api/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ replace (
)

require (
github.com/DataDog/agent-payload/v5 v5.0.137
github.com/DataDog/agent-payload/v5 v5.0.138
github.com/DataDog/datadog-agent/pkg/telemetry v0.56.0-rc.3
github.com/gogo/protobuf v1.3.2
github.com/stretchr/testify v1.10.0
Expand Down
4 changes: 2 additions & 2 deletions pkg/process/util/api/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/serializer/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ replace (
)

require (
github.com/DataDog/agent-payload/v5 v5.0.137
github.com/DataDog/agent-payload/v5 v5.0.138
github.com/DataDog/datadog-agent/comp/core/config v0.57.1
github.com/DataDog/datadog-agent/comp/forwarder/defaultforwarder v0.56.0-rc.3
github.com/DataDog/datadog-agent/comp/forwarder/orchestrator/orchestratorinterface v0.56.0-rc.3
Expand Down
4 changes: 2 additions & 2 deletions pkg/serializer/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
enhancements:
- |
Adds tagger tags to pod manifests.
2 changes: 1 addition & 1 deletion test/fakeintake/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ replace (
)

require (
github.com/DataDog/agent-payload/v5 v5.0.137
github.com/DataDog/agent-payload/v5 v5.0.138
github.com/DataDog/datadog-agent/comp/netflow/payload v0.56.0-rc.3
github.com/DataDog/datadog-agent/pkg/proto v0.56.0-rc.3
github.com/DataDog/zstd v1.5.6
Expand Down
4 changes: 2 additions & 2 deletions test/fakeintake/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion test/new-e2e/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ replace (
)

require (
github.com/DataDog/agent-payload/v5 v5.0.137
github.com/DataDog/agent-payload/v5 v5.0.138
github.com/DataDog/datadog-agent/comp/otelcol/ddflareextension/def v0.56.2
github.com/DataDog/datadog-agent/pkg/util/optional v0.59.0
github.com/DataDog/datadog-agent/pkg/util/pointer v0.59.0
Expand Down
4 changes: 2 additions & 2 deletions test/new-e2e/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion test/otel/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ require (
)

require (
github.com/DataDog/agent-payload/v5 v5.0.137 // indirect
github.com/DataDog/agent-payload/v5 v5.0.138 // indirect
github.com/DataDog/datadog-agent/comp/core/flare/builder v0.56.0-rc.3 // indirect
github.com/DataDog/datadog-agent/comp/core/flare/types v0.56.0-rc.3 // indirect
github.com/DataDog/datadog-agent/comp/core/secrets v0.59.0 // indirect
Expand Down
4 changes: 2 additions & 2 deletions test/otel/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 623bea0

Please sign in to comment.