Skip to content

Commit

Permalink
[AMLII-1994] Improve expected_tags_duration for metrics (#29634)
Browse files Browse the repository at this point in the history
Co-authored-by: Esther Kim <[email protected]>
  • Loading branch information
andrewqian2001datadog and estherk15 authored Oct 23, 2024
1 parent 1ec4e30 commit 86dab7c
Show file tree
Hide file tree
Showing 17 changed files with 170 additions and 286 deletions.
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 @@ -298,17 +296,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())
}
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())
}
tagsetTlm.updateHugeSketchesTelemetry(sketch)
}, flushAndSerializeInParallel.BufferSize, flushAndSerializeInParallel.ChannelSize)
}
Expand Down
Loading

0 comments on commit 86dab7c

Please sign in to comment.