Datasource Builder#
Constructor#
import "github.com/perses/perses/go-sdk/datasource"
var options []datasource.Option
datasource.New("My Super Datasource", options...)
Need to provide the name of the datasource and a list of options.
Default options#
- Name(): with the name provided in the constructor.
Available options#
Name#
Define the datasource metadata name + display name.
ProjectName#
Define the datasource project name in metadata.
Default#
Set if datasource is a default datasource.
Datasource Plugin Options#
Prometheus Datasource#
import promDs "github.com/perses/perses/go-sdk/prometheus/datasource"
promDs.Prometheus(promDsOptions...)
Set Prometheus plugin for the datasource. More info at Prometheus Datasource.
Example#
package main
import (
"github.com/perses/perses/go-sdk/dashboard"
promDs "github.com/perses/perses/go-sdk/prometheus/datasource"
)
func main() {
dashboard.New("ExampleDashboard",
dashboard.AddDatasource("prometheusDemo", promDs.Prometheus(promDs.DirectURL("https://prometheus.demo.do.prometheus.io/"))),
)
}