forked from mirror/client_golang
add missing fields to targets API
Signed-off-by: yeya24 <yb532204897@gmail.com>
This commit is contained in:
parent
17e98a7e4f
commit
45efe82b46
|
@ -380,12 +380,15 @@ type TargetsResult struct {
|
||||||
|
|
||||||
// ActiveTarget models an active Prometheus scrape target.
|
// ActiveTarget models an active Prometheus scrape target.
|
||||||
type ActiveTarget struct {
|
type ActiveTarget struct {
|
||||||
DiscoveredLabels map[string]string `json:"discoveredLabels"`
|
DiscoveredLabels map[string]string `json:"discoveredLabels"`
|
||||||
Labels model.LabelSet `json:"labels"`
|
Labels model.LabelSet `json:"labels"`
|
||||||
ScrapeURL string `json:"scrapeUrl"`
|
ScrapePool string `json:"scrapePool"`
|
||||||
LastError string `json:"lastError"`
|
ScrapeURL string `json:"scrapeUrl"`
|
||||||
LastScrape time.Time `json:"lastScrape"`
|
GlobalURL string `json:"globalUrl"`
|
||||||
Health HealthStatus `json:"health"`
|
LastError string `json:"lastError"`
|
||||||
|
LastScrape time.Time `json:"lastScrape"`
|
||||||
|
LastScrapeDuration float64 `json:"lastScrapeDuration"`
|
||||||
|
Health HealthStatus `json:"health"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// DroppedTarget models a dropped Prometheus scrape target.
|
// DroppedTarget models a dropped Prometheus scrape target.
|
||||||
|
|
|
@ -871,10 +871,13 @@ func TestAPIs(t *testing.T) {
|
||||||
"instance": "127.0.0.1:9090",
|
"instance": "127.0.0.1:9090",
|
||||||
"job": "prometheus",
|
"job": "prometheus",
|
||||||
},
|
},
|
||||||
"scrapeUrl": "http://127.0.0.1:9090",
|
"scrapePool": "prometheus",
|
||||||
"lastError": "error while scraping target",
|
"scrapeUrl": "http://127.0.0.1:9090",
|
||||||
"lastScrape": testTime.UTC().Format(time.RFC3339Nano),
|
"globalUrl": "http://127.0.0.1:9090",
|
||||||
"health": "up",
|
"lastError": "error while scraping target",
|
||||||
|
"lastScrape": testTime.UTC().Format(time.RFC3339Nano),
|
||||||
|
"lastScrapeDuration": 0.001146115,
|
||||||
|
"health": "up",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"droppedTargets": []map[string]interface{}{
|
"droppedTargets": []map[string]interface{}{
|
||||||
|
@ -901,10 +904,13 @@ func TestAPIs(t *testing.T) {
|
||||||
"instance": "127.0.0.1:9090",
|
"instance": "127.0.0.1:9090",
|
||||||
"job": "prometheus",
|
"job": "prometheus",
|
||||||
},
|
},
|
||||||
ScrapeURL: "http://127.0.0.1:9090",
|
ScrapePool: "prometheus",
|
||||||
LastError: "error while scraping target",
|
ScrapeURL: "http://127.0.0.1:9090",
|
||||||
LastScrape: testTime.UTC(),
|
GlobalURL: "http://127.0.0.1:9090",
|
||||||
Health: HealthGood,
|
LastError: "error while scraping target",
|
||||||
|
LastScrape: testTime.UTC(),
|
||||||
|
LastScrapeDuration: 0.001146115,
|
||||||
|
Health: HealthGood,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Dropped: []DroppedTarget{
|
Dropped: []DroppedTarget{
|
||||||
|
|
Loading…
Reference in New Issue