@@ -34,10 +34,10 @@ func ExampleAPI_query() {
34
34
os .Exit (1 )
35
35
}
36
36
37
- api := v1 .NewAPI (client )
37
+ v1api := v1 .NewAPI (client )
38
38
ctx , cancel := context .WithTimeout (context .Background (), 10 * time .Second )
39
39
defer cancel ()
40
- result , warnings , err := api .Query (ctx , "up" , time .Now ())
40
+ result , warnings , err := v1api .Query (ctx , "up" , time .Now ())
41
41
if err != nil {
42
42
fmt .Printf ("Error querying Prometheus: %v\n " , err )
43
43
os .Exit (1 )
@@ -57,15 +57,15 @@ func ExampleAPI_queryRange() {
57
57
os .Exit (1 )
58
58
}
59
59
60
- api := v1 .NewAPI (client )
60
+ v1api := v1 .NewAPI (client )
61
61
ctx , cancel := context .WithTimeout (context .Background (), 10 * time .Second )
62
62
defer cancel ()
63
63
r := v1.Range {
64
64
Start : time .Now ().Add (- time .Hour ),
65
65
End : time .Now (),
66
66
Step : time .Minute ,
67
67
}
68
- result , warnings , err := api .QueryRange (ctx , "rate(prometheus_tsdb_head_samples_appended_total[5m])" , r )
68
+ result , warnings , err := v1api .QueryRange (ctx , "rate(prometheus_tsdb_head_samples_appended_total[5m])" , r )
69
69
if err != nil {
70
70
fmt .Printf ("Error querying Prometheus: %v\n " , err )
71
71
os .Exit (1 )
@@ -85,10 +85,10 @@ func ExampleAPI_series() {
85
85
os .Exit (1 )
86
86
}
87
87
88
- api := v1 .NewAPI (client )
88
+ v1api := v1 .NewAPI (client )
89
89
ctx , cancel := context .WithTimeout (context .Background (), 10 * time .Second )
90
90
defer cancel ()
91
- lbls , warnings , err := api .Series (ctx , []string {
91
+ lbls , warnings , err := v1api .Series (ctx , []string {
92
92
"{__name__=~\" scrape_.+\" ,job=\" node\" }" ,
93
93
"{__name__=~\" scrape_.+\" ,job=\" prometheus\" }" ,
94
94
}, time .Now ().Add (- time .Hour ), time .Now ())
0 commit comments