Skip to content

Commit

Permalink
feat(circonus/check): Check tags are configurable in config file
Browse files Browse the repository at this point in the history
Add configuration key to CirconusConfig named "CheckTags"
Add logic to NewMetricDestination to add any user-configured check tags
to the existing array

issue #CIRC-8707

* Tags: check tag bundle conf
  • Loading branch information
aesca1er committed Jul 7, 2022
1 parent 18ee4b3 commit ccac328
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
7 changes: 7 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ type CirconusConfig struct {
Broker string `toml:"broker"`
Hostname string `toml:"-"`
CheckSearchTags []string `toml:"check_search_tags"`
CheckTags string `toml:"check_tags"`
DebugAPI bool `toml:"debug_api"`
CacheNoVerify bool `toml:"cache_no_verify"`
CacheConfigs bool `toml:"cache_configs"`
Expand Down Expand Up @@ -430,6 +431,12 @@ var agentConfig = `
## Note: cache_dir must be read/write for the user running the cua process
# cache_dir = "/opt/circonus/etc/cache.d"
## Check tags configurations
## Optional
## tags to add to the check bundle, in comma-deliminated namespace:tag pairs
## eg: "team:red,team:blue,env:dev,security:pci,security:sox"
# check_tags = "foo:bar,baz:buzz"
## Debug circonus api calls and trap submissions
## Optional
# debug_api = true
Expand Down
5 changes: 5 additions & 0 deletions internal/circonus/circonus.go
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,11 @@ func NewMetricDestination(opts *MetricDestConfig, logger cua.Logger) (*trapmetri
checkTags = append(checkTags, getOSCheckTags()...)
}

if ch.circCfg.CheckTags != "" {
confCheckTags := strings.Split(ch.circCfg.CheckTags, ":")
checkTags = append(checkTags, confCheckTags...)
}

checkTarget := hostname

instanceLogger := &Logshim{
Expand Down

0 comments on commit ccac328

Please sign in to comment.