add missing fields to targets API

Signed-off-by: yeya24 <yb532204897@gmail.com>
This commit is contained in:
yeya24 2021-04-11 11:50:23 -04:00
parent 17e98a7e4f
commit 45efe82b46
2 changed files with 23 additions and 14 deletions

View File

@ -382,9 +382,12 @@ type TargetsResult struct {
type ActiveTarget struct {
DiscoveredLabels map[string]string `json:"discoveredLabels"`
Labels model.LabelSet `json:"labels"`
ScrapePool string `json:"scrapePool"`
ScrapeURL string `json:"scrapeUrl"`
GlobalURL string `json:"globalUrl"`
LastError string `json:"lastError"`
LastScrape time.Time `json:"lastScrape"`
LastScrapeDuration float64 `json:"lastScrapeDuration"`
Health HealthStatus `json:"health"`
}

View File

@ -871,9 +871,12 @@ func TestAPIs(t *testing.T) {
"instance": "127.0.0.1:9090",
"job": "prometheus",
},
"scrapePool": "prometheus",
"scrapeUrl": "http://127.0.0.1:9090",
"globalUrl": "http://127.0.0.1:9090",
"lastError": "error while scraping target",
"lastScrape": testTime.UTC().Format(time.RFC3339Nano),
"lastScrapeDuration": 0.001146115,
"health": "up",
},
},
@ -901,9 +904,12 @@ func TestAPIs(t *testing.T) {
"instance": "127.0.0.1:9090",
"job": "prometheus",
},
ScrapePool: "prometheus",
ScrapeURL: "http://127.0.0.1:9090",
GlobalURL: "http://127.0.0.1:9090",
LastError: "error while scraping target",
LastScrape: testTime.UTC(),
LastScrapeDuration: 0.001146115,
Health: HealthGood,
},
},