From 1bbc6a66e6c7be576d452288e923fd58c2e5c150 Mon Sep 17 00:00:00 2001 From: Minyi Zhu Date: Wed, 9 Oct 2024 10:50:14 -0400 Subject: [PATCH] add getTagsWithCardinality --- .../autodiscoveryimpl/common_test.go | 5 +++ .../autodiscovery/common/utils/annotations.go | 11 +++-- .../common/utils/annotations_test.go | 45 ++++++++++++++++--- .../common/utils/pod_annotations.go | 3 ++ .../common/utils/pod_annotations_test.go | 26 +++++++++++ .../configresolver/configresolver.go | 8 +++- .../configresolver/configresolver_test.go | 5 +++ comp/core/autodiscovery/integration/config.go | 3 ++ .../autodiscovery/listeners/cloudfoundry.go | 5 +++ .../autodiscovery/listeners/dbm_aurora.go | 5 +++ .../autodiscovery/listeners/environment.go | 5 +++ .../autodiscovery/listeners/kube_endpoints.go | 5 +++ .../autodiscovery/listeners/kube_services.go | 5 +++ comp/core/autodiscovery/listeners/service.go | 11 +++++ comp/core/autodiscovery/listeners/snmp.go | 5 +++ .../autodiscovery/listeners/staticconfig.go | 5 +++ comp/core/autodiscovery/listeners/types.go | 23 +++++----- .../autodiscovery/providers/config_reader.go | 4 ++ comp/core/autodiscovery/providers/consul.go | 2 +- comp/core/autodiscovery/providers/etcd.go | 2 +- .../providers/kube_endpoints_file.go | 1 + .../core/autodiscovery/providers/zookeeper.go | 2 +- 22 files changed, 161 insertions(+), 25 deletions(-) diff --git a/comp/core/autodiscovery/autodiscoveryimpl/common_test.go b/comp/core/autodiscovery/autodiscoveryimpl/common_test.go index b6cdf32759ef38..277abef2c23086 100644 --- a/comp/core/autodiscovery/autodiscoveryimpl/common_test.go +++ b/comp/core/autodiscovery/autodiscoveryimpl/common_test.go @@ -54,6 +54,11 @@ func (s *dummyService) GetTags() ([]string, error) { return nil, nil } +// GetTagsWithCardinality returns the tags for this service +func (s *dummyService) GetTagsWithCardinality(_ string) ([]string, error) { + return s.GetTags() +} + // GetPid return a dummy pid func (s *dummyService) GetPid(context.Context) (int, error) { return s.Pid, nil diff --git a/comp/core/autodiscovery/common/utils/annotations.go b/comp/core/autodiscovery/common/utils/annotations.go index 0dabffa498f6d3..606e7264c16fc4 100644 --- a/comp/core/autodiscovery/common/utils/annotations.go +++ b/comp/core/autodiscovery/common/utils/annotations.go @@ -23,6 +23,7 @@ const ( logsConfigPath = "logs" checksPath = "checks" checkIDPath = "check.id" + checkTagCardinality = "check_tag_cardinality" ) // ExtractTemplatesFromMap looks for autodiscovery configurations in a given @@ -76,7 +77,10 @@ func extractCheckTemplatesFromMap(key string, input map[string]string, prefix st } // ParseBool returns `true` only on success cases ignoreAdTags, _ := strconv.ParseBool(input[prefix+ignoreAutodiscoveryTags]) - return BuildTemplates(key, checkNames, initConfigs, instances, ignoreAdTags), nil + + cardinality := input[prefix+checkTagCardinality] + + return BuildTemplates(key, checkNames, initConfigs, instances, ignoreAdTags, cardinality), nil } // extractLogsTemplatesFromMap returns the logs configuration from a given map, @@ -166,8 +170,8 @@ func ParseJSONValue(value string) ([][]integration.Data, error) { // BuildTemplates returns check configurations configured according to the // passed in AD identifier, check names, init, instance configs and their -// `ignoreAutoDiscoveryTags` field. -func BuildTemplates(adID string, checkNames []string, initConfigs, instances [][]integration.Data, ignoreAutodiscoveryTags bool) []integration.Config { +// `ignoreAutoDiscoveryTags`, `CheckTagCardinality` fields. +func BuildTemplates(adID string, checkNames []string, initConfigs, instances [][]integration.Data, ignoreAutodiscoveryTags bool, checkCard string) []integration.Config { templates := make([]integration.Config, 0) // sanity checks @@ -192,6 +196,7 @@ func BuildTemplates(adID string, checkNames []string, initConfigs, instances [][ Instances: []integration.Data{instance}, ADIdentifiers: []string{adID}, IgnoreAutodiscoveryTags: ignoreAutodiscoveryTags, + CheckTagCardinality: checkCard, }) } } diff --git a/comp/core/autodiscovery/common/utils/annotations_test.go b/comp/core/autodiscovery/common/utils/annotations_test.go index 9d554dc8824444..985a848335f9e0 100644 --- a/comp/core/autodiscovery/common/utils/annotations_test.go +++ b/comp/core/autodiscovery/common/utils/annotations_test.go @@ -344,12 +344,13 @@ func TestParseCheckNames(t *testing.T) { func TestBuildTemplates(t *testing.T) { key := "id" tests := []struct { - name string - inputCheckNames []string - inputInitConfig [][]integration.Data - inputInstances [][]integration.Data - expectedConfigs []integration.Config - ignoreAdTags bool + name string + inputCheckNames []string + inputInitConfig [][]integration.Data + inputInstances [][]integration.Data + expectedConfigs []integration.Config + ignoreAdTags bool + checkTagCardinality string }{ { name: "wrong number of checkNames", @@ -434,10 +435,40 @@ func TestBuildTemplates(t *testing.T) { }, }, }, + { + name: "valid inputs with list and checkCardinality", + inputCheckNames: []string{"a", "b"}, + inputInitConfig: [][]integration.Data{{integration.Data("{\"test\": 1}")}, {integration.Data("{}")}}, + inputInstances: [][]integration.Data{{integration.Data("{\"foo\": 1}"), integration.Data("{\"foo\": 2}")}, {integration.Data("{1:2}")}}, + checkTagCardinality: "low", + expectedConfigs: []integration.Config{ + { + Name: "a", + ADIdentifiers: []string{key}, + InitConfig: integration.Data("{\"test\": 1}"), + Instances: []integration.Data{integration.Data("{\"foo\": 1}")}, + CheckTagCardinality: "low", + }, + { + Name: "a", + ADIdentifiers: []string{key}, + InitConfig: integration.Data("{\"test\": 1}"), + Instances: []integration.Data{integration.Data("{\"foo\": 2}")}, + CheckTagCardinality: "low", + }, + { + Name: "b", + ADIdentifiers: []string{key}, + InitConfig: integration.Data("{}"), + Instances: []integration.Data{integration.Data("{1:2}")}, + CheckTagCardinality: "low", + }, + }, + }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - assert.Equal(t, tt.expectedConfigs, BuildTemplates(key, tt.inputCheckNames, tt.inputInitConfig, tt.inputInstances, tt.ignoreAdTags)) + assert.Equal(t, tt.expectedConfigs, BuildTemplates(key, tt.inputCheckNames, tt.inputInitConfig, tt.inputInstances, tt.ignoreAdTags, tt.checkTagCardinality)) }) } } diff --git a/comp/core/autodiscovery/common/utils/pod_annotations.go b/comp/core/autodiscovery/common/utils/pod_annotations.go index 2db5b0c3233053..6b1fc5233bf22b 100644 --- a/comp/core/autodiscovery/common/utils/pod_annotations.go +++ b/comp/core/autodiscovery/common/utils/pod_annotations.go @@ -60,6 +60,7 @@ func parseChecksJSON(adIdentifier string, checksJSON string) ([]integration.Conf Instances []interface{} `json:"instances"` Logs json.RawMessage `json:"logs"` IgnoreAutodiscoveryTags bool `json:"ignore_autodiscovery_tags"` + CheckTagCardinality string `json:"check_tag_cardinality"` } err := json.Unmarshal([]byte(checksJSON), &namedChecks) @@ -84,6 +85,8 @@ func parseChecksJSON(adIdentifier string, checksJSON string) ([]integration.Conf IgnoreAutodiscoveryTags: config.IgnoreAutodiscoveryTags, } + c.CheckTagCardinality = config.CheckTagCardinality + if len(config.Logs) > 0 { c.LogsConfig = integration.Data(config.Logs) } diff --git a/comp/core/autodiscovery/common/utils/pod_annotations_test.go b/comp/core/autodiscovery/common/utils/pod_annotations_test.go index 7043e7c19e3014..f044409ecb4925 100644 --- a/comp/core/autodiscovery/common/utils/pod_annotations_test.go +++ b/comp/core/autodiscovery/common/utils/pod_annotations_test.go @@ -137,6 +137,32 @@ func TestExtractTemplatesFromAnnotations(t *testing.T) { }, }, }, + { + name: "Nominal case with two templates and check tag cardinality", + annotations: map[string]string{ + "ad.datadoghq.com/foobar.check_names": "[\"apache\",\"http_check\"]", + "ad.datadoghq.com/foobar.init_configs": "[{},{}]", + "ad.datadoghq.com/foobar.instances": "[{\"apache_status_url\":\"http://%%host%%/server-status?auto\"},{\"name\":\"My service\",\"timeout\":1,\"url\":\"http://%%host%%\"}]", + "ad.datadoghq.com/foobar.check_tag_cardinality": "low", + }, + adIdentifier: "foobar", + output: []integration.Config{ + { + Name: "apache", + Instances: []integration.Data{integration.Data("{\"apache_status_url\":\"http://%%host%%/server-status?auto\"}")}, + InitConfig: integration.Data("{}"), + ADIdentifiers: []string{adID}, + CheckTagCardinality: "low", + }, + { + Name: "http_check", + Instances: []integration.Data{integration.Data("{\"name\":\"My service\",\"timeout\":1,\"url\":\"http://%%host%%\"}")}, + InitConfig: integration.Data("{}"), + ADIdentifiers: []string{adID}, + CheckTagCardinality: "low", + }, + }, + }, { name: "Take one, ignore one", annotations: map[string]string{ diff --git a/comp/core/autodiscovery/configresolver/configresolver.go b/comp/core/autodiscovery/configresolver/configresolver.go index 41a97f90e44d73..27579bc7c2db95 100644 --- a/comp/core/autodiscovery/configresolver/configresolver.go +++ b/comp/core/autodiscovery/configresolver/configresolver.go @@ -93,7 +93,13 @@ func Resolve(tpl integration.Config, svc listeners.Service) (integration.Config, return resolvedConfig, errors.New("unable to resolve, service not ready") } - tags, err := svc.GetTags() + var tags []string + var err error + if tpl.CheckTagCardinality != "" { + tags, err = svc.GetTagsWithCardinality(tpl.CheckTagCardinality) + } else { + tags, err = svc.GetTags() + } if err != nil { return resolvedConfig, fmt.Errorf("couldn't get tags for service '%s', err: %w", svc.GetServiceID(), err) } diff --git a/comp/core/autodiscovery/configresolver/configresolver_test.go b/comp/core/autodiscovery/configresolver/configresolver_test.go index a19ab496428a72..6f4ab6ac75e68f 100644 --- a/comp/core/autodiscovery/configresolver/configresolver_test.go +++ b/comp/core/autodiscovery/configresolver/configresolver_test.go @@ -62,6 +62,11 @@ func (s *dummyService) GetTags() ([]string, error) { return []string{"foo:bar"}, nil } +// GetTagsWithCardinality returns the tags for this service +func (s *dummyService) GetTagsWithCardinality(_ string) ([]string, error) { + return s.GetTags() +} + // GetPid return a dummy pid func (s *dummyService) GetPid(context.Context) (int, error) { return s.Pid, nil diff --git a/comp/core/autodiscovery/integration/config.go b/comp/core/autodiscovery/integration/config.go index 8b7276c7dbbaed..d4cca33c9d0e7d 100644 --- a/comp/core/autodiscovery/integration/config.go +++ b/comp/core/autodiscovery/integration/config.go @@ -97,6 +97,9 @@ type Config struct { // IgnoreAutodiscoveryTags is used to ignore tags coming from autodiscovery IgnoreAutodiscoveryTags bool `json:"ignore_autodiscovery_tags"` // (include in digest: true) + // CheckTagCardinality is used to override the default tag cardinality in the agent configuration + CheckTagCardinality string `json:"check_tag_cardinality"` // (include in digest: false) + // MetricsExcluded is whether metrics collection is disabled (set by // container listeners only) MetricsExcluded bool `json:"metrics_excluded"` // (include in digest: false) diff --git a/comp/core/autodiscovery/listeners/cloudfoundry.go b/comp/core/autodiscovery/listeners/cloudfoundry.go index 99f8e1806ce709..d82436fba67bb8 100644 --- a/comp/core/autodiscovery/listeners/cloudfoundry.go +++ b/comp/core/autodiscovery/listeners/cloudfoundry.go @@ -234,6 +234,11 @@ func (s *CloudFoundryService) GetTags() ([]string, error) { return s.tags, nil } +// GetTagsWithCardinality returns the tags with given cardinality. Not supported in CF +func (s *CloudFoundryService) GetTagsWithCardinality(cardinality string) ([]string, error) { + return s.GetTags() +} + // GetPid returns nil and an error because pids are currently not supported in CF func (s *CloudFoundryService) GetPid(context.Context) (int, error) { return -1, ErrNotSupported diff --git a/comp/core/autodiscovery/listeners/dbm_aurora.go b/comp/core/autodiscovery/listeners/dbm_aurora.go index f29727a9dc6eff..ca49f44aa0e1ee 100644 --- a/comp/core/autodiscovery/listeners/dbm_aurora.go +++ b/comp/core/autodiscovery/listeners/dbm_aurora.go @@ -239,6 +239,11 @@ func (d *DBMAuroraService) GetTags() ([]string, error) { return []string{}, nil } +// GetTagsWithCardinality returns the tags with given cardinality. Not supported in DBMAuroraService +func (d *DBMAuroraService) GetTagsWithCardinality(_ string) ([]string, error) { + return s.GetTags() +} + // GetPid returns nil and an error because pids are currently not supported func (d *DBMAuroraService) GetPid(context.Context) (int, error) { return -1, ErrNotSupported diff --git a/comp/core/autodiscovery/listeners/environment.go b/comp/core/autodiscovery/listeners/environment.go index a63d7430e6a25e..f49152d95b1069 100644 --- a/comp/core/autodiscovery/listeners/environment.go +++ b/comp/core/autodiscovery/listeners/environment.go @@ -109,6 +109,11 @@ func (s *EnvironmentService) GetTags() ([]string, error) { return nil, nil } +// GetTagsWithCardinality returns the tags with given cardinality. Not supported in EnvironmentService +func (s *EnvironmentService) GetTagsWithCardinality(_ string) ([]string, error) { + return s.GetTags() +} + // GetPid inspect the container and return its pid // Not relevant in this listener func (s *EnvironmentService) GetPid(context.Context) (int, error) { diff --git a/comp/core/autodiscovery/listeners/kube_endpoints.go b/comp/core/autodiscovery/listeners/kube_endpoints.go index a0ef296d318f79..c3ac90d6ea2088 100644 --- a/comp/core/autodiscovery/listeners/kube_endpoints.go +++ b/comp/core/autodiscovery/listeners/kube_endpoints.go @@ -487,6 +487,11 @@ func (s *KubeEndpointService) GetTags() ([]string, error) { return s.tags, nil } +// GetTagsWithCardinality returns the tags with given cardinality. +func (s *KubeEndpointService) GetTagsWithCardinality(_ string) ([]string, error) { + return s.GetTags() +} + // GetHostname returns nil and an error because port is not supported in Kubelet func (s *KubeEndpointService) GetHostname(context.Context) (string, error) { return "", ErrNotSupported diff --git a/comp/core/autodiscovery/listeners/kube_services.go b/comp/core/autodiscovery/listeners/kube_services.go index 7119870471e99f..c9019e21b8b302 100644 --- a/comp/core/autodiscovery/listeners/kube_services.go +++ b/comp/core/autodiscovery/listeners/kube_services.go @@ -368,6 +368,11 @@ func (s *KubeServiceService) GetTags() ([]string, error) { return s.tags, nil } +// GetTagsWithCardinality returns the tags with given cardinality. +func (s *KubeServiceService) GetTagsWithCardinality(_ string) ([]string, error) { + return s.GetTags() +} + // GetHostname returns nil and an error because port is not supported in Kubelet func (s *KubeServiceService) GetHostname(context.Context) (string, error) { return "", ErrNotSupported diff --git a/comp/core/autodiscovery/listeners/service.go b/comp/core/autodiscovery/listeners/service.go index 841af2456caa82..92c8d85f6ea582 100644 --- a/comp/core/autodiscovery/listeners/service.go +++ b/comp/core/autodiscovery/listeners/service.go @@ -14,6 +14,7 @@ import ( "github.com/DataDog/datadog-agent/comp/core/autodiscovery/providers/names" "github.com/DataDog/datadog-agent/comp/core/tagger" taggercommon "github.com/DataDog/datadog-agent/comp/core/tagger/common" + "github.com/DataDog/datadog-agent/comp/core/tagger/types" workloadmeta "github.com/DataDog/datadog-agent/comp/core/workloadmeta/def" pkgconfigsetup "github.com/DataDog/datadog-agent/pkg/config/setup" "github.com/DataDog/datadog-agent/pkg/util/containers" @@ -92,6 +93,16 @@ func (s *service) GetTags() ([]string, error) { return tagger.Tag(taggercommon.BuildTaggerEntityID(s.entity.GetID()).String(), tagger.ChecksCardinality()) } +// GetTagsWithCardinality returns the tags with given cardinality. +func (s *service) GetTagsWithCardinality(cardinality string) ([]string, error) { + checkCard, err := types.StringToTagCardinality(cardinality) + if err == nil { + return tagger.Tag(taggercommon.BuildTaggerEntityID(s.entity.GetID()).String(), checkCard) + } + log.Warnf("error converting cardinality %s to TagCardinality: %v", cardinality, err) + return s.GetTags() +} + // GetPid returns the process ID of the service. func (s *service) GetPid(_ context.Context) (int, error) { return s.pid, nil diff --git a/comp/core/autodiscovery/listeners/snmp.go b/comp/core/autodiscovery/listeners/snmp.go index fa5fd2937bccc2..dbc12b7ac4a1dd 100644 --- a/comp/core/autodiscovery/listeners/snmp.go +++ b/comp/core/autodiscovery/listeners/snmp.go @@ -357,6 +357,11 @@ func (s *SNMPService) GetTags() ([]string, error) { return []string{}, nil } +// GetTagsWithCardinality returns the tags with given cardinality. +func (s *SNMPService) GetTagsWithCardinality(_ string) ([]string, error) { + return s.GetTags() +} + // GetPid returns nil and an error because pids are currently not supported func (s *SNMPService) GetPid(context.Context) (int, error) { return -1, ErrNotSupported diff --git a/comp/core/autodiscovery/listeners/staticconfig.go b/comp/core/autodiscovery/listeners/staticconfig.go index 0e537c49bf189f..ad06ab28eb49fb 100644 --- a/comp/core/autodiscovery/listeners/staticconfig.go +++ b/comp/core/autodiscovery/listeners/staticconfig.go @@ -92,6 +92,11 @@ func (s *StaticConfigService) GetTags() ([]string, error) { return nil, nil } +// GetTagsWithCardinality returns the tags with given cardinality. +func (s *StaticConfigService) GetTagsWithCardinality(_ string) ([]string, error) { + return s.GetTags() +} + // GetPid inspect the container and return its pid // Not relevant in this listener func (s *StaticConfigService) GetPid(context.Context) (int, error) { diff --git a/comp/core/autodiscovery/listeners/types.go b/comp/core/autodiscovery/listeners/types.go index 8718b46b72c85e..bcdbe1aeebaeb0 100644 --- a/comp/core/autodiscovery/listeners/types.go +++ b/comp/core/autodiscovery/listeners/types.go @@ -25,17 +25,18 @@ type ContainerPort struct { // It should be matched with a check template by the ConfigResolver using the // ADIdentifiers field. type Service interface { - Equal(Service) bool // compare two services - GetServiceID() string // unique service name - GetADIdentifiers(context.Context) ([]string, error) // identifiers on which templates will be matched - GetHosts(context.Context) (map[string]string, error) // network --> IP address - GetPorts(context.Context) ([]ContainerPort, error) // network ports - GetTags() ([]string, error) // tags - GetPid(context.Context) (int, error) // process identifier - GetHostname(context.Context) (string, error) // hostname.domainname for the entity - IsReady(context.Context) bool // is the service ready - HasFilter(containers.FilterType) bool // whether the service is excluded by metrics or logs exclusion config - GetExtraConfig(string) (string, error) // Extra configuration values + Equal(Service) bool // compare two services + GetServiceID() string // unique service name + GetADIdentifiers(context.Context) ([]string, error) // identifiers on which templates will be matched + GetHosts(context.Context) (map[string]string, error) // network --> IP address + GetPorts(context.Context) ([]ContainerPort, error) // network ports + GetTags() ([]string, error) // tags + GetTagsWithCardinality(cardinality string) ([]string, error) // tags with given cardinality + GetPid(context.Context) (int, error) // process identifier + GetHostname(context.Context) (string, error) // hostname.domainname for the entity + IsReady(context.Context) bool // is the service ready + HasFilter(containers.FilterType) bool // whether the service is excluded by metrics or logs exclusion config + GetExtraConfig(string) (string, error) // Extra configuration values // FilterTemplates filters the templates which will be resolved against // this service, in a map keyed by template digest. diff --git a/comp/core/autodiscovery/providers/config_reader.go b/comp/core/autodiscovery/providers/config_reader.go index 9f7b8cd13f8fda..f048953469884f 100644 --- a/comp/core/autodiscovery/providers/config_reader.go +++ b/comp/core/autodiscovery/providers/config_reader.go @@ -35,6 +35,7 @@ type configFormat struct { Instances []integration.RawMap DockerImages []string `yaml:"docker_images"` // Only imported for deprecation warning IgnoreAutodiscoveryTags bool `yaml:"ignore_autodiscovery_tags"` // Use to ignore tags coming from autodiscovery + CheckTagCardinality string `yaml:"check_tag_cardinality"` // Use to set the tag cardinality override for the check } type configPkg struct { @@ -430,6 +431,9 @@ func GetIntegrationConfigFromFile(name, fpath string) (integration.Config, error // Copy ignore_autodiscovery_tags parameter conf.IgnoreAutodiscoveryTags = cf.IgnoreAutodiscoveryTags + // Copy check_tag_cardinality parameter + conf.CheckTagCardinality = cf.CheckTagCardinality + // DockerImages entry was found: we ignore it if no ADIdentifiers has been found if len(cf.DockerImages) > 0 && len(cf.ADIdentifiers) == 0 { return conf, errors.New("the 'docker_images' section is deprecated, please use 'ad_identifiers' instead") diff --git a/comp/core/autodiscovery/providers/consul.go b/comp/core/autodiscovery/providers/consul.go index 107694e975c59f..a6b3816f7aba10 100644 --- a/comp/core/autodiscovery/providers/consul.go +++ b/comp/core/autodiscovery/providers/consul.go @@ -237,7 +237,7 @@ func (p *ConsulConfigProvider) getTemplates(ctx context.Context, key string) []i log.Errorf("Failed to retrieve instances at %s. Error: %s", instanceKey, err) return templates } - return utils.BuildTemplates(key, checkNames, initConfigs, instances, false) + return utils.BuildTemplates(key, checkNames, initConfigs, instances, false, "") } // getValue returns value, error diff --git a/comp/core/autodiscovery/providers/etcd.go b/comp/core/autodiscovery/providers/etcd.go index bb08f9306f9d42..e985fe31a9ed94 100644 --- a/comp/core/autodiscovery/providers/etcd.go +++ b/comp/core/autodiscovery/providers/etcd.go @@ -124,7 +124,7 @@ func (p *EtcdConfigProvider) getTemplates(ctx context.Context, key string) []int return nil } - return utils.BuildTemplates(key, checkNames, initConfigs, instances, false) + return utils.BuildTemplates(key, checkNames, initConfigs, instances, false, "") } // getEtcdValue retrieves content from etcd diff --git a/comp/core/autodiscovery/providers/kube_endpoints_file.go b/comp/core/autodiscovery/providers/kube_endpoints_file.go index c9d1ceb5688004..469882c7af1ce7 100644 --- a/comp/core/autodiscovery/providers/kube_endpoints_file.go +++ b/comp/core/autodiscovery/providers/kube_endpoints_file.go @@ -297,6 +297,7 @@ func endpointChecksFromTemplate(tpl integration.Config, ep *v1.Endpoints) []inte Provider: names.KubeEndpointsFile, Source: tpl.Source, IgnoreAutodiscoveryTags: tpl.IgnoreAutodiscoveryTags, + CheckTagCardinality: tpl.CheckTagCardinality, } utils.ResolveEndpointConfigAuto(config, ep.Subsets[i].Addresses[j]) diff --git a/comp/core/autodiscovery/providers/zookeeper.go b/comp/core/autodiscovery/providers/zookeeper.go index 7815bcd9011aa8..999a5eadf041a0 100644 --- a/comp/core/autodiscovery/providers/zookeeper.go +++ b/comp/core/autodiscovery/providers/zookeeper.go @@ -198,7 +198,7 @@ func (z *ZookeeperConfigProvider) getTemplates(key string) []integration.Config return nil } - return utils.BuildTemplates(key, checkNames, initConfigs, instances, false) + return utils.BuildTemplates(key, checkNames, initConfigs, instances, false, "") } func (z *ZookeeperConfigProvider) getJSONValue(key string) ([][]integration.Data, error) {