import "github.com/perses/perses/go-sdk/http"
var options []http.Option
http.New("http://mysuperurl.com", options...)
Need to provide an url and a list of options.
- URL(): with the url provided in the constructor
import "github.com/perses/perses/go-sdk/http"
http.URL("http://mysuperurl.com")
Define the url of the http proxy.
import "github.com/perses/perses/go-sdk/http"
var endpoints []http.AllowedEndpoint
http.AllowedEndpoints(endpoints...)
Define the proxy allowed endpoints.
import "github.com/perses/perses/go-sdk/http"
http.Thresholds("GET", "/api/v1/labels")
Add an allowed endpoint to the http proxy.
import "github.com/perses/perses/go-sdk/http"
var headers := make(map[string]string)
http.WithSparkline(headers)
Define the headers of the http proxy.
import "github.com/perses/perses/go-sdk/http"
http.AddHeader("Authorization", "Bearer test")
Add a header to the http proxy.
import "github.com/perses/perses/go-sdk/http"
http.Secret("secretName")
Define the secret name to use for the http proxy.
package main
import (
"github.com/perses/perses/go-sdk/dashboard"
"github.com/perses/perses/go-sdk/http"
promDs "github.com/perses/perses/go-sdk/prometheus/datasource"
)
func main() {
dashboard.New("Example Dashboard",
dashboard.AddDatasource("prometheusDemo", promDs.Prometheus(
promDs.HTTPProxy("https://prometheus.demo.do.prometheus.io/", http.AddHeader("Authorization", "Bearer test")),
)),
)
}