Use a map to describe discovered labels, as they are not validated by the server (#529)
Signed-off-by: Oleksandr Kushchenko <okushchenko@palantir.com>
This commit is contained in:
parent
26e258bb9c
commit
d5f63107bf
|
@ -231,17 +231,17 @@ type TargetsResult struct {
|
|||
|
||||
// ActiveTarget models an active Prometheus scrape target.
|
||||
type ActiveTarget struct {
|
||||
DiscoveredLabels model.LabelSet `json:"discoveredLabels"`
|
||||
Labels model.LabelSet `json:"labels"`
|
||||
ScrapeURL string `json:"scrapeUrl"`
|
||||
LastError string `json:"lastError"`
|
||||
LastScrape time.Time `json:"lastScrape"`
|
||||
Health HealthStatus `json:"health"`
|
||||
DiscoveredLabels map[string]string `json:"discoveredLabels"`
|
||||
Labels model.LabelSet `json:"labels"`
|
||||
ScrapeURL string `json:"scrapeUrl"`
|
||||
LastError string `json:"lastError"`
|
||||
LastScrape time.Time `json:"lastScrape"`
|
||||
Health HealthStatus `json:"health"`
|
||||
}
|
||||
|
||||
// DroppedTarget models a dropped Prometheus scrape target.
|
||||
type DroppedTarget struct {
|
||||
DiscoveredLabels model.LabelSet `json:"discoveredLabels"`
|
||||
DiscoveredLabels map[string]string `json:"discoveredLabels"`
|
||||
}
|
||||
|
||||
// queryResult contains result data for a query.
|
||||
|
|
|
@ -605,7 +605,7 @@ func TestAPIs(t *testing.T) {
|
|||
res: TargetsResult{
|
||||
Active: []ActiveTarget{
|
||||
{
|
||||
DiscoveredLabels: model.LabelSet{
|
||||
DiscoveredLabels: map[string]string{
|
||||
"__address__": "127.0.0.1:9090",
|
||||
"__metrics_path__": "/metrics",
|
||||
"__scheme__": "http",
|
||||
|
@ -623,7 +623,7 @@ func TestAPIs(t *testing.T) {
|
|||
},
|
||||
Dropped: []DroppedTarget{
|
||||
{
|
||||
DiscoveredLabels: model.LabelSet{
|
||||
DiscoveredLabels: map[string]string{
|
||||
"__address__": "127.0.0.1:9100",
|
||||
"__metrics_path__": "/metrics",
|
||||
"__scheme__": "http",
|
||||
|
|
Loading…
Reference in New Issue