@@ -28,9 +28,11 @@ import (
2828 v1 "github.com/prometheus/client_golang/api/prometheus/v1"
2929)
3030
31+ const DemoPrometheusURL = "https://demo.prometheus.io:443"
32+
3133func ExampleAPI_query () {
3234 client , err := api .NewClient (api.Config {
33- Address : "http://demo.robustperception.io:9090" ,
35+ Address : DemoPrometheusURL ,
3436 })
3537 if err != nil {
3638 fmt .Printf ("Error creating client: %v\n " , err )
@@ -53,7 +55,7 @@ func ExampleAPI_query() {
5355
5456func ExampleAPI_queryRange () {
5557 client , err := api .NewClient (api.Config {
56- Address : "http://demo.robustperception.io:9090" ,
58+ Address : DemoPrometheusURL ,
5759 })
5860 if err != nil {
5961 fmt .Printf ("Error creating client: %v\n " , err )
@@ -104,7 +106,7 @@ func (u userAgentRoundTripper) RoundTrip(r *http.Request) (*http.Response, error
104106
105107func ExampleAPI_queryRangeWithUserAgent () {
106108 client , err := api .NewClient (api.Config {
107- Address : "http://demo.robustperception.io:9090" ,
109+ Address : DemoPrometheusURL ,
108110 RoundTripper : userAgentRoundTripper {name : "Client-Golang" , rt : api .DefaultRoundTripper },
109111 })
110112 if err != nil {
@@ -133,7 +135,7 @@ func ExampleAPI_queryRangeWithUserAgent() {
133135
134136func ExampleAPI_queryRangeWithBasicAuth () {
135137 client , err := api .NewClient (api.Config {
136- Address : "http://demo.robustperception.io:9090" ,
138+ Address : DemoPrometheusURL ,
137139 // We can use amazing github.com/prometheus/common/config helper!
138140 RoundTripper : config .NewBasicAuthRoundTripper (
139141 config .NewInlineSecret ("me" ),
@@ -167,7 +169,7 @@ func ExampleAPI_queryRangeWithBasicAuth() {
167169
168170func ExampleAPI_queryRangeWithAuthBearerToken () {
169171 client , err := api .NewClient (api.Config {
170- Address : "http://demo.robustperception.io:9090" ,
172+ Address : DemoPrometheusURL ,
171173 // We can use amazing github.com/prometheus/common/config helper!
172174 RoundTripper : config .NewAuthorizationCredentialsRoundTripper (
173175 "Bearer" ,
@@ -201,7 +203,7 @@ func ExampleAPI_queryRangeWithAuthBearerToken() {
201203
202204func ExampleAPI_queryRangeWithAuthBearerTokenHeadersRoundTripper () {
203205 client , err := api .NewClient (api.Config {
204- Address : "http://demo.robustperception.io:9090" ,
206+ Address : DemoPrometheusURL ,
205207 // We can use amazing github.com/prometheus/common/config helper!
206208 RoundTripper : config .NewHeadersRoundTripper (
207209 & config.Headers {
@@ -240,7 +242,7 @@ func ExampleAPI_queryRangeWithAuthBearerTokenHeadersRoundTripper() {
240242
241243func ExampleAPI_series () {
242244 client , err := api .NewClient (api.Config {
243- Address : "http://demo.robustperception.io:9090" ,
245+ Address : DemoPrometheusURL ,
244246 })
245247 if err != nil {
246248 fmt .Printf ("Error creating client: %v\n " , err )
0 commit comments