Skip to content

Commit 8d6efac

Browse files
committed
Rename agentpool env var/parametrer
Signed-off-by: Markus Blaschke <mblaschke82@gmail.com>
1 parent 94ba550 commit 8d6efac

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

config/opts.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,12 @@ type (
4242
Organisation string `long:"azuredevops.organisation" env:"AZURE_DEVOPS_ORGANISATION" description:"Azure DevOps organization" required:"true"`
4343
ApiVersion string `long:"azuredevops.apiversion" env:"AZURE_DEVOPS_APIVERSION" description:"Azure DevOps API version" default:"5.1"`
4444

45+
// agentpool
46+
AgentPoolIdList []int64 `long:"azuredevops.agentpool" env:"AZURE_DEVOPS_AGENTPOOL" env-delim:" " description:"Enable scrape metrics for agent pool (IDs)"`
47+
4548
// ignore settings
4649
FilterProjects []string `long:"whitelist.project" env:"AZURE_DEVOPS_FILTER_PROJECT" env-delim:" " description:"Filter projects (UUIDs)"`
4750
BlacklistProjects []string `long:"blacklist.project" env:"AZURE_DEVOPS_BLACKLIST_PROJECT" env-delim:" " description:"Filter projects (UUIDs)"`
48-
FilterAgentPoolId []int64 `long:"whitelist.agentpool" env:"AZURE_DEVOPS_FILTER_AGENTPOOL" env-delim:" " description:"Filter of agent pool (IDs)"`
4951

5052
// query settings
5153
QueriesWithProjects []string `long:"list.query" env:"AZURE_DEVOPS_QUERIES" env-delim:" " description:"Pairs of query and project UUIDs in the form: '<queryId>@<projectId>'"`

main.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,10 @@ func initArgparser() {
152152
if opts.Scrape.TimeQuery == nil {
153153
opts.Scrape.TimeQuery = &opts.Scrape.Time
154154
}
155+
156+
if v := os.Getenv("AZURE_DEVOPS_FILTER_AGENTPOOL"); v != "" {
157+
log.Panic("deprecated env var AZURE_DEVOPS_FILTER_AGENTPOOL detected, please use AZURE_DEVOPS_AGENTPOOL")
158+
}
155159
}
156160

157161
// Init and build Azure authorzier
@@ -248,7 +252,7 @@ func initMetricCollector() {
248252
if opts.Scrape.TimeLive.Seconds() > 0 {
249253
collectorAgentPoolList[collectorName] = NewCollectorAgentPool(collectorName, &MetricsCollectorAgentPool{})
250254
collectorAgentPoolList[collectorName].SetAzureProjects(&projectList)
251-
collectorAgentPoolList[collectorName].AgentPoolIdList = opts.AzureDevops.FilterAgentPoolId
255+
collectorAgentPoolList[collectorName].AgentPoolIdList = opts.AzureDevops.AgentPoolIdList
252256
collectorAgentPoolList[collectorName].SetScrapeTime(*opts.Scrape.TimeLive)
253257
} else {
254258
log.Infof("collector[%s]: disabled", collectorName)

0 commit comments

Comments
 (0)