Panel Builder#
Constructor#
import "github.com/perses/perses/go-sdk/panel"
var options []panel.Option
panel.New("My Super Panel", options...)
Need to provide the name of the panel and a list of options.
Default options#
- Title(): with the title provided in the constructor.
Available options#
Title#
Define the panel title.
Description#
Define the panel description.
AddQuery#
import "github.com/perses/perses/go-sdk/panel"
var queryOptions []query.Option
panel.AddQuery(queryOptions...)
Define the panel query. More info at Query.
Panel Plugin Options#
Bar Panel#
import "github.com/perses/perses/go-sdk/panel/bar"
var barOptions []bar.Option
bar.Chart(barOptions...)
Define the panel chart. More info at Bar Panel.
Gauge Panel#
import "github.com/perses/perses/go-sdk/panel/gauge"
var gaugeOptions []gauge.Option
gauge.Chart(gaugeOptions...)
Define the panel chart. More info at Gauge Panel.
Markdown Panel#
import "github.com/perses/perses/go-sdk/panel/markdown"
var markdownOptions []markdown.Option
markdown.Chart(markdownOptions...)
Define the panel chart. More info at Markdown Panel.
Stat Panel#
import "github.com/perses/perses/go-sdk/panel/stat"
var statOptions []stat.Option
stat.Chart(statOptions...)
Define the panel chart. More info at Stat Panel.
Time Series Panel#
import "github.com/perses/perses/go-sdk/panel/time-series"
var timeSeriesOptions []timeseries.Option
timeseries.Chart(timeSeriesOptions...)
Define the panel chart. More info at Time Series Panel.
Example#
package main
import (
"github.com/perses/perses/go-sdk/dashboard"
"github.com/perses/perses/go-sdk/panel"
panelgroup "github.com/perses/perses/go-sdk/panel-group"
timeseries "github.com/perses/perses/go-sdk/panel/time-series"
"github.com/perses/perses/go-sdk/prometheus/query"
)
func main() {
dashboard.New("Example Dashboard",
dashboard.AddPanelGroup("Resource usage",
panelgroup.AddPanel("Container memory",
panel.Description("This is a super panel"),
timeseries.Chart(),
panel.AddQuery(
query.PromQL("max by (container) (container_memory_rss{stack=\"$stack\",prometheus=\"$prometheus\",prometheus_namespace=\"$prometheus_namespace\",namespace=\"$namespace\",pod=\"$pod\",container=\"$container\"})"),
),
),
),
)
}