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,7 +231,7 @@ type TargetsResult struct {
|
||||||
|
|
||||||
// ActiveTarget models an active Prometheus scrape target.
|
// ActiveTarget models an active Prometheus scrape target.
|
||||||
type ActiveTarget struct {
|
type ActiveTarget struct {
|
||||||
DiscoveredLabels model.LabelSet `json:"discoveredLabels"`
|
DiscoveredLabels map[string]string `json:"discoveredLabels"`
|
||||||
Labels model.LabelSet `json:"labels"`
|
Labels model.LabelSet `json:"labels"`
|
||||||
ScrapeURL string `json:"scrapeUrl"`
|
ScrapeURL string `json:"scrapeUrl"`
|
||||||
LastError string `json:"lastError"`
|
LastError string `json:"lastError"`
|
||||||
|
@ -241,7 +241,7 @@ type ActiveTarget struct {
|
||||||
|
|
||||||
// DroppedTarget models a dropped Prometheus scrape target.
|
// DroppedTarget models a dropped Prometheus scrape target.
|
||||||
type DroppedTarget struct {
|
type DroppedTarget struct {
|
||||||
DiscoveredLabels model.LabelSet `json:"discoveredLabels"`
|
DiscoveredLabels map[string]string `json:"discoveredLabels"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// queryResult contains result data for a query.
|
// queryResult contains result data for a query.
|
||||||
|
|
|
@ -605,7 +605,7 @@ func TestAPIs(t *testing.T) {
|
||||||
res: TargetsResult{
|
res: TargetsResult{
|
||||||
Active: []ActiveTarget{
|
Active: []ActiveTarget{
|
||||||
{
|
{
|
||||||
DiscoveredLabels: model.LabelSet{
|
DiscoveredLabels: map[string]string{
|
||||||
"__address__": "127.0.0.1:9090",
|
"__address__": "127.0.0.1:9090",
|
||||||
"__metrics_path__": "/metrics",
|
"__metrics_path__": "/metrics",
|
||||||
"__scheme__": "http",
|
"__scheme__": "http",
|
||||||
|
@ -623,7 +623,7 @@ func TestAPIs(t *testing.T) {
|
||||||
},
|
},
|
||||||
Dropped: []DroppedTarget{
|
Dropped: []DroppedTarget{
|
||||||
{
|
{
|
||||||
DiscoveredLabels: model.LabelSet{
|
DiscoveredLabels: map[string]string{
|
||||||
"__address__": "127.0.0.1:9100",
|
"__address__": "127.0.0.1:9100",
|
||||||
"__metrics_path__": "/metrics",
|
"__metrics_path__": "/metrics",
|
||||||
"__scheme__": "http",
|
"__scheme__": "http",
|
||||||
|
|
Loading…
Reference in New Issue