Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AMLII-1994] Improve expected_tags_duration for metrics #29634

Merged
merged 36 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
435fc9e
add configurable host tags WIP
andrewqian2001datadog Sep 28, 2024
f27cb9f
testing
andrewqian2001datadog Sep 28, 2024
32fdbab
WIP
andrewqian2001datadog Sep 29, 2024
796b765
Merge branch 'main' into refactor-configurable-host-tags
andrewqian2001datadog Sep 30, 2024
8ac3dae
change variable
andrewqian2001datadog Sep 30, 2024
761c205
pass in hostTagProvider as a variable so that the duration of the exp…
andrewqian2001datadog Sep 30, 2024
d2a5ddd
add release note
andrewqian2001datadog Sep 30, 2024
625a32d
fix missing parameter in tests
andrewqian2001datadog Sep 30, 2024
a7d3d9f
fix error when host tags are empty
andrewqian2001datadog Oct 1, 2024
786aa34
Merge branch 'main' into refactor-configurable-host-tags
andrewqian2001datadog Oct 1, 2024
b10a177
Merge branch 'main' into refactor-configurable-host-tags
andrewqian2001datadog Oct 7, 2024
e8baaf5
move adding host tag logic outside of iterable_series
andrewqian2001datadog Oct 7, 2024
c75fab5
remove unecessary code
andrewqian2001datadog Oct 7, 2024
24733d0
remove unecessary comments
andrewqian2001datadog Oct 7, 2024
2235c10
Revert consumer.go
andrewqian2001datadog Oct 7, 2024
53d33d6
move host_tag_provider to aggregator package
andrewqian2001datadog Oct 7, 2024
c681728
testing
andrewqian2001datadog Oct 8, 2024
8ef6f79
Merge branch 'main' into refactor-configurable-host-tags
andrewqian2001datadog Oct 9, 2024
07a84ee
remove host tags when expected_tag_duration is not set
andrewqian2001datadog Oct 9, 2024
7547794
remove redundant logic
andrewqian2001datadog Oct 9, 2024
a84f814
add copy right?
andrewqian2001datadog Oct 9, 2024
228596f
remove prints
andrewqian2001datadog Oct 9, 2024
f406ab5
rerun tests
andrewqian2001datadog Oct 9, 2024
6a7e12b
rerun tests x2
andrewqian2001datadog Oct 9, 2024
45215f8
Update releasenotes/notes/fix-configurable-host-tags-c71fb5597d20bffe…
andrewqian2001datadog Oct 11, 2024
06a1bcb
Merge branch 'main' into refactor-configurable-host-tags
andrewqian2001datadog Oct 11, 2024
ff6bf2f
Merge branch 'refactor-configurable-host-tags' of github.com:DataDog/…
andrewqian2001datadog Oct 11, 2024
d993b61
Merge branch 'main' into refactor-configurable-host-tags
andrewqian2001datadog Oct 14, 2024
9b2148b
rerun tests
andrewqian2001datadog Oct 14, 2024
436191a
rerun tests x2
andrewqian2001datadog Oct 15, 2024
39363a1
third times the charm
andrewqian2001datadog Oct 15, 2024
1ef8fcd
Merge branch 'main' into refactor-configurable-host-tags
andrewqian2001datadog Oct 15, 2024
a540d95
Merge branch 'main' into refactor-configurable-host-tags
andrewqian2001datadog Oct 16, 2024
8d425d4
add logging messages for when host tags are added/expire
andrewqian2001datadog Oct 16, 2024
26698da
remove redundant code
andrewqian2001datadog Oct 16, 2024
35be39e
remove redundant function call
andrewqian2001datadog Oct 16, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion comp/core/tagger/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ Tagger entities are identified by a string-typed ID, with one of the following f
| workloadmeta.KindContainer | `container_id://<sha>` |
| workloadmeta.KindContainerImageMetadata | `container_image_metadata://<sha>` |
| workloadmeta.KindECSTask | `ecs_task://<task-id>` |
| workloadmeta.KindHost | `host://` |
| workloadmeta.KindKubernetesDeployment | `deployment://<namespace>/<name>` |
| workloadmeta.KindKubernetesMetadata | `kubernetes_metadata://<group>/<resourceType>/<namespace>/<name>` (`<namespace>` is empty in cluster-scoped objects) |
| workloadmeta.KindKubernetesPod | `kubernetes_pod_uid://<uid>` |
Expand Down
2 changes: 0 additions & 2 deletions comp/core/tagger/common/entity_id_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ func BuildTaggerEntityID(entityID workloadmeta.EntityID) types.EntityID {
return types.NewEntityID(types.Process, entityID.ID)
case workloadmeta.KindKubernetesDeployment:
return types.NewEntityID(types.KubernetesDeployment, entityID.ID)
case workloadmeta.KindHost:
return types.NewEntityID(types.Host, entityID.ID)
case workloadmeta.KindKubernetesMetadata:
return types.NewEntityID(types.KubernetesMetadata, entityID.ID)
default:
Expand Down
13 changes: 0 additions & 13 deletions comp/core/tagger/taggerimpl/collectors/workloadmeta_extract.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,6 @@ func (c *WorkloadMetaCollector) processEvents(evBundle workloadmeta.EventBundle)
tagInfos = append(tagInfos, c.handleECSTask(ev)...)
case workloadmeta.KindContainerImageMetadata:
tagInfos = append(tagInfos, c.handleContainerImage(ev)...)
case workloadmeta.KindHost:
tagInfos = append(tagInfos, c.handleHostTags(ev)...)
case workloadmeta.KindKubernetesMetadata:
tagInfos = append(tagInfos, c.handleKubeMetadata(ev)...)
case workloadmeta.KindProcess:
Expand Down Expand Up @@ -294,17 +292,6 @@ func (c *WorkloadMetaCollector) handleContainerImage(ev workloadmeta.Event) []*t
}
}

func (c *WorkloadMetaCollector) handleHostTags(ev workloadmeta.Event) []*types.TagInfo {
hostTags := ev.Entity.(*workloadmeta.HostTags)
return []*types.TagInfo{
{
Source: hostSource,
EntityID: types.NewEntityID("internal", "global-entity-id"),
LowCardTags: hostTags.HostTags,
},
}
}

func (c *WorkloadMetaCollector) labelsToTags(labels map[string]string, tags *taglist.TagList) {
// standard tags from labels
c.extractFromMapWithFn(labels, standardDockerLabels, tags.AddStandard)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ const (
containerSource = workloadmetaCollectorName + "-" + string(workloadmeta.KindContainer)
containerImageSource = workloadmetaCollectorName + "-" + string(workloadmeta.KindContainerImageMetadata)
processSource = workloadmetaCollectorName + "-" + string(workloadmeta.KindProcess)
hostSource = workloadmetaCollectorName + "-" + string(workloadmeta.KindHost)
kubeMetadataSource = workloadmetaCollectorName + "-" + string(workloadmeta.KindKubernetesMetadata)
deploymentSource = workloadmetaCollectorName + "-" + string(workloadmeta.KindKubernetesDeployment)

Expand Down
2 changes: 0 additions & 2 deletions comp/core/workloadmeta/collectors/catalog-core/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import (
"github.com/DataDog/datadog-agent/comp/core/workloadmeta/collectors/internal/docker"
"github.com/DataDog/datadog-agent/comp/core/workloadmeta/collectors/internal/ecs"
"github.com/DataDog/datadog-agent/comp/core/workloadmeta/collectors/internal/ecsfargate"
"github.com/DataDog/datadog-agent/comp/core/workloadmeta/collectors/internal/host"
"github.com/DataDog/datadog-agent/comp/core/workloadmeta/collectors/internal/kubeapiserver"
"github.com/DataDog/datadog-agent/comp/core/workloadmeta/collectors/internal/kubelet"
"github.com/DataDog/datadog-agent/comp/core/workloadmeta/collectors/internal/kubemetadata"
Expand All @@ -39,7 +38,6 @@ func getCollectorOptions() []fx.Option {
kubemetadata.GetFxOptions(),
podman.GetFxOptions(),
remoteprocesscollector.GetFxOptions(),
host.GetFxOptions(),
process.GetFxOptions(),
}
}
2 changes: 0 additions & 2 deletions comp/core/workloadmeta/collectors/catalog-less/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import (
"github.com/DataDog/datadog-agent/comp/core/workloadmeta/collectors/internal/docker"
"github.com/DataDog/datadog-agent/comp/core/workloadmeta/collectors/internal/ecs"
"github.com/DataDog/datadog-agent/comp/core/workloadmeta/collectors/internal/ecsfargate"
"github.com/DataDog/datadog-agent/comp/core/workloadmeta/collectors/internal/host"
"github.com/DataDog/datadog-agent/comp/core/workloadmeta/collectors/internal/kubeapiserver"
"github.com/DataDog/datadog-agent/comp/core/workloadmeta/collectors/internal/kubelet"
"github.com/DataDog/datadog-agent/comp/core/workloadmeta/collectors/internal/kubemetadata"
Expand All @@ -41,6 +40,5 @@ func getCollectorOptions() []fx.Option {
remoteworkloadmeta.GetFxOptions(),
fx.Supply(remoteworkloadmeta.Params{}),
processcollector.GetFxOptions(),
host.GetFxOptions(),
}
}
2 changes: 0 additions & 2 deletions comp/core/workloadmeta/collectors/catalog/all_options.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (
"github.com/DataDog/datadog-agent/comp/core/workloadmeta/collectors/internal/docker"
"github.com/DataDog/datadog-agent/comp/core/workloadmeta/collectors/internal/ecs"
"github.com/DataDog/datadog-agent/comp/core/workloadmeta/collectors/internal/ecsfargate"
"github.com/DataDog/datadog-agent/comp/core/workloadmeta/collectors/internal/host"
"github.com/DataDog/datadog-agent/comp/core/workloadmeta/collectors/internal/kubeapiserver"
"github.com/DataDog/datadog-agent/comp/core/workloadmeta/collectors/internal/kubelet"
"github.com/DataDog/datadog-agent/comp/core/workloadmeta/collectors/internal/kubemetadata"
Expand All @@ -46,6 +45,5 @@ func getCollectorOptions() []fx.Option {
remoteworkloadmeta.GetFxOptions(),
remoteWorkloadmetaParams(),
processcollector.GetFxOptions(),
host.GetFxOptions(),
}
}
116 changes: 0 additions & 116 deletions comp/core/workloadmeta/collectors/internal/host/host.go

This file was deleted.

128 changes: 0 additions & 128 deletions comp/core/workloadmeta/collectors/internal/host/host_test.go

This file was deleted.

1 change: 0 additions & 1 deletion comp/core/workloadmeta/def/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ const (
KindECSTask Kind = "ecs_task"
KindContainerImageMetadata Kind = "container_image_metadata"
KindProcess Kind = "process"
KindHost Kind = "host"
)

// Source is the source name of an entity.
Expand Down
12 changes: 10 additions & 2 deletions pkg/aggregator/demultiplexer.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (

pkgconfigsetup "github.com/DataDog/datadog-agent/pkg/config/setup"
"github.com/DataDog/datadog-agent/pkg/metrics"
"github.com/DataDog/datadog-agent/pkg/tagset"

"github.com/DataDog/datadog-agent/pkg/aggregator/sender"
agentruntime "github.com/DataDog/datadog-agent/pkg/runtime"
Expand Down Expand Up @@ -94,19 +95,23 @@ func createIterableMetrics(
serializer serializer.MetricSerializer,
logPayloads bool,
isServerless bool,
hostTagProvider *HostTagProvider,
) (*metrics.IterableSeries, *metrics.IterableSketches) {
var series *metrics.IterableSeries
var sketches *metrics.IterableSketches

hostTags := hostTagProvider.GetHostTags()
if serializer.AreSeriesEnabled() {
series = metrics.NewIterableSeries(func(se *metrics.Serie) {
if logPayloads {
log.Debugf("Flushing serie: %s", se)
}

if hostTags != nil {
se.Tags = tagset.CombineCompositeTagsAndSlice(se.Tags, hostTagProvider.GetHostTags())
andrewqian2001datadog marked this conversation as resolved.
Show resolved Hide resolved
}
tagsetTlm.updateHugeSerieTelemetry(se)
}, flushAndSerializeInParallel.BufferSize, flushAndSerializeInParallel.ChannelSize)
}

if serializer.AreSketchesEnabled() {
sketches = metrics.NewIterableSketches(func(sketch *metrics.SketchSeries) {
if logPayloads {
Expand All @@ -115,6 +120,9 @@ func createIterableMetrics(
if isServerless {
log.DebugfServerless("Sending sketches payload : %s", sketch.String())
}
if hostTags != nil {
sketch.Tags = tagset.CombineCompositeTagsAndSlice(sketch.Tags, hostTagProvider.GetHostTags())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
sketch.Tags = tagset.CombineCompositeTagsAndSlice(sketch.Tags, hostTagProvider.GetHostTags())
sketch.Tags = tagset.CombineCompositeTagsAndSlice(sketch.Tags, hostTags)

NIT: to avoid calling GetHostTags twice.
(same for line 109 above)

}
tagsetTlm.updateHugeSketchesTelemetry(sketch)
}, flushAndSerializeInParallel.BufferSize, flushAndSerializeInParallel.ChannelSize)
}
Expand Down
Loading
Loading