@@ -28,9 +28,11 @@ import (
28
28
v1 "github.com/prometheus/client_golang/api/prometheus/v1"
29
29
)
30
30
31
+ const DemoPrometheusURL = "https://demo.prometheus.io:443"
32
+
31
33
func ExampleAPI_query () {
32
34
client , err := api .NewClient (api.Config {
33
- Address : "http://demo.robustperception.io:9090" ,
35
+ Address : DemoPrometheusURL ,
34
36
})
35
37
if err != nil {
36
38
fmt .Printf ("Error creating client: %v\n " , err )
@@ -53,7 +55,7 @@ func ExampleAPI_query() {
53
55
54
56
func ExampleAPI_queryRange () {
55
57
client , err := api .NewClient (api.Config {
56
- Address : "http://demo.robustperception.io:9090" ,
58
+ Address : DemoPrometheusURL ,
57
59
})
58
60
if err != nil {
59
61
fmt .Printf ("Error creating client: %v\n " , err )
@@ -104,7 +106,7 @@ func (u userAgentRoundTripper) RoundTrip(r *http.Request) (*http.Response, error
104
106
105
107
func ExampleAPI_queryRangeWithUserAgent () {
106
108
client , err := api .NewClient (api.Config {
107
- Address : "http://demo.robustperception.io:9090" ,
109
+ Address : DemoPrometheusURL ,
108
110
RoundTripper : userAgentRoundTripper {name : "Client-Golang" , rt : api .DefaultRoundTripper },
109
111
})
110
112
if err != nil {
@@ -133,7 +135,7 @@ func ExampleAPI_queryRangeWithUserAgent() {
133
135
134
136
func ExampleAPI_queryRangeWithBasicAuth () {
135
137
client , err := api .NewClient (api.Config {
136
- Address : "http://demo.robustperception.io:9090" ,
138
+ Address : DemoPrometheusURL ,
137
139
// We can use amazing github.com/prometheus/common/config helper!
138
140
RoundTripper : config .NewBasicAuthRoundTripper (
139
141
config .NewInlineSecret ("me" ),
@@ -167,7 +169,7 @@ func ExampleAPI_queryRangeWithBasicAuth() {
167
169
168
170
func ExampleAPI_queryRangeWithAuthBearerToken () {
169
171
client , err := api .NewClient (api.Config {
170
- Address : "http://demo.robustperception.io:9090" ,
172
+ Address : DemoPrometheusURL ,
171
173
// We can use amazing github.com/prometheus/common/config helper!
172
174
RoundTripper : config .NewAuthorizationCredentialsRoundTripper (
173
175
"Bearer" ,
@@ -201,7 +203,7 @@ func ExampleAPI_queryRangeWithAuthBearerToken() {
201
203
202
204
func ExampleAPI_queryRangeWithAuthBearerTokenHeadersRoundTripper () {
203
205
client , err := api .NewClient (api.Config {
204
- Address : "http://demo.robustperception.io:9090" ,
206
+ Address : DemoPrometheusURL ,
205
207
// We can use amazing github.com/prometheus/common/config helper!
206
208
RoundTripper : config .NewHeadersRoundTripper (
207
209
& config.Headers {
@@ -240,7 +242,7 @@ func ExampleAPI_queryRangeWithAuthBearerTokenHeadersRoundTripper() {
240
242
241
243
func ExampleAPI_series () {
242
244
client , err := api .NewClient (api.Config {
243
- Address : "http://demo.robustperception.io:9090" ,
245
+ Address : DemoPrometheusURL ,
244
246
})
245
247
if err != nil {
246
248
fmt .Printf ("Error creating client: %v\n " , err )
0 commit comments