timeseries

package
v0.0.0-...-80d82a4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 17, 2025 License: Apache-2.0 Imports: 8 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PanelConverter

func PanelConverter(input dashboard.Panel) string

PanelConverter accepts a `Panel` object and generates the Go code to build this object using builders.

func VariantConfig

func VariantConfig() variants.PanelcfgConfig

VariantConfig returns the configuration related to timeseries panels. This configuration describes how to unmarshal it, convert it to code, …

Types

type FieldConfig

type FieldConfig = common.GraphFieldConfig

func NewFieldConfig

func NewFieldConfig() *FieldConfig

NewFieldConfig creates a new FieldConfig object.

type Options

type Options struct {
	Timezone    []common.TimeZone        `json:"timezone,omitempty"`
	Legend      common.VizLegendOptions  `json:"legend"`
	Tooltip     common.VizTooltipOptions `json:"tooltip"`
	Orientation *common.VizOrientation   `json:"orientation,omitempty"`
}

func NewOptions

func NewOptions() *Options

NewOptions creates a new Options object.

func (Options) Equals

func (resource Options) Equals(other Options) bool

Equals tests the equality of two `Options` objects.

func (*Options) UnmarshalJSONStrict

func (resource *Options) UnmarshalJSONStrict(raw []byte) error

UnmarshalJSONStrict implements a custom JSON unmarshalling logic to decode `Options` from JSON. Note: the unmarshalling done by this function is strict. It will fail over required fields being absent from the input, fields having an incorrect type, unexpected fields being present, …

func (Options) Validate

func (resource Options) Validate() error

Validate checks all the validation constraints that may be defined on `Options` fields for violations and returns them.

type PanelBuilder

type PanelBuilder struct {
	// contains filtered or unexported fields
}

Dashboard panels are the basic visualization building blocks.

func NewPanelBuilder

func NewPanelBuilder() *PanelBuilder

func (*PanelBuilder) AxisBorderShow

func (builder *PanelBuilder) AxisBorderShow(axisBorderShow bool) *PanelBuilder

func (*PanelBuilder) AxisCenteredZero

func (builder *PanelBuilder) AxisCenteredZero(axisCenteredZero bool) *PanelBuilder

func (*PanelBuilder) AxisColorMode

func (builder *PanelBuilder) AxisColorMode(axisColorMode common.AxisColorMode) *PanelBuilder

func (*PanelBuilder) AxisGridShow

func (builder *PanelBuilder) AxisGridShow(axisGridShow bool) *PanelBuilder

func (*PanelBuilder) AxisLabel

func (builder *PanelBuilder) AxisLabel(axisLabel string) *PanelBuilder

func (*PanelBuilder) AxisPlacement

func (builder *PanelBuilder) AxisPlacement(axisPlacement common.AxisPlacement) *PanelBuilder

func (*PanelBuilder) AxisSoftMax

func (builder *PanelBuilder) AxisSoftMax(axisSoftMax float64) *PanelBuilder

func (*PanelBuilder) AxisSoftMin

func (builder *PanelBuilder) AxisSoftMin(axisSoftMin float64) *PanelBuilder

func (*PanelBuilder) AxisWidth

func (builder *PanelBuilder) AxisWidth(axisWidth float64) *PanelBuilder

func (*PanelBuilder) BarAlignment

func (builder *PanelBuilder) BarAlignment(barAlignment common.BarAlignment) *PanelBuilder

func (*PanelBuilder) BarMaxWidth

func (builder *PanelBuilder) BarMaxWidth(barMaxWidth float64) *PanelBuilder

func (*PanelBuilder) BarWidthFactor

func (builder *PanelBuilder) BarWidthFactor(barWidthFactor float64) *PanelBuilder

func (*PanelBuilder) Build

func (builder *PanelBuilder) Build() (dashboard.Panel, error)

func (*PanelBuilder) CacheTimeout

func (builder *PanelBuilder) CacheTimeout(cacheTimeout string) *PanelBuilder

Sets panel queries cache timeout.

func (*PanelBuilder) ColorScheme

func (builder *PanelBuilder) ColorScheme(color cog.Builder[dashboard.FieldColor]) *PanelBuilder

Panel color configuration

func (builder *PanelBuilder) DataLinks(links []cog.Builder[dashboard.DashboardLink]) *PanelBuilder

The behavior when clicking on a result

func (*PanelBuilder) Datasource

func (builder *PanelBuilder) Datasource(datasource dashboard.DataSourceRef) *PanelBuilder

The datasource used in all targets.

func (*PanelBuilder) Decimals

func (builder *PanelBuilder) Decimals(decimals float64) *PanelBuilder

Specify the number of decimals Grafana includes in the rendered value. If you leave this field blank, Grafana automatically truncates the number of decimals based on the value. For example 1.1234 will display as 1.12 and 100.456 will display as 100. To display all decimals, set the unit to `String`.

func (*PanelBuilder) Description

func (builder *PanelBuilder) Description(description string) *PanelBuilder

Panel description.

func (*PanelBuilder) DisplayName

func (builder *PanelBuilder) DisplayName(displayName string) *PanelBuilder

The display value for this field. This supports template variables blank is auto

func (*PanelBuilder) DrawStyle

func (builder *PanelBuilder) DrawStyle(drawStyle common.GraphDrawStyle) *PanelBuilder

func (*PanelBuilder) FillBelowTo

func (builder *PanelBuilder) FillBelowTo(fillBelowTo string) *PanelBuilder

func (*PanelBuilder) FillColor

func (builder *PanelBuilder) FillColor(fillColor string) *PanelBuilder

func (*PanelBuilder) FillOpacity

func (builder *PanelBuilder) FillOpacity(fillOpacity float64) *PanelBuilder

func (*PanelBuilder) GradientMode

func (builder *PanelBuilder) GradientMode(gradientMode common.GraphGradientMode) *PanelBuilder

func (*PanelBuilder) GridPos

func (builder *PanelBuilder) GridPos(gridPos dashboard.GridPos) *PanelBuilder

Grid position.

func (*PanelBuilder) Height

func (builder *PanelBuilder) Height(h uint32) *PanelBuilder

Panel height. The height is the number of rows from the top edge of the panel.

func (*PanelBuilder) HideFrom

func (builder *PanelBuilder) HideFrom(hideFrom cog.Builder[common.HideSeriesConfig]) *PanelBuilder

func (*PanelBuilder) HideTimeOverride

func (builder *PanelBuilder) HideTimeOverride(hideTimeOverride bool) *PanelBuilder

Controls if the timeFrom or timeShift overrides are shown in the panel header

func (*PanelBuilder) Id

func (builder *PanelBuilder) Id(id uint32) *PanelBuilder

Unique identifier of the panel. Generated by Grafana when creating a new panel. It must be unique within a dashboard, but not globally.

func (*PanelBuilder) InsertNulls

func (builder *PanelBuilder) InsertNulls(insertNulls common.BoolOrFloat64) *PanelBuilder

func (*PanelBuilder) Interval

func (builder *PanelBuilder) Interval(interval string) *PanelBuilder

The min time interval setting defines a lower limit for the $__interval and $__interval_ms variables. This value must be formatted as a number followed by a valid time identifier like: "40s", "3d", etc. See: https://grafana.com/docs/grafana/latest/panels-visualizations/query-transform-data/#query-options

func (*PanelBuilder) Legend

func (builder *PanelBuilder) Legend(legend cog.Builder[common.VizLegendOptions]) *PanelBuilder

func (*PanelBuilder) LibraryPanel

func (builder *PanelBuilder) LibraryPanel(libraryPanel dashboard.LibraryPanelRef) *PanelBuilder

Dynamically load the panel

func (*PanelBuilder) LineColor

func (builder *PanelBuilder) LineColor(lineColor string) *PanelBuilder

func (*PanelBuilder) LineInterpolation

func (builder *PanelBuilder) LineInterpolation(lineInterpolation common.LineInterpolation) *PanelBuilder

func (*PanelBuilder) LineStyle

func (builder *PanelBuilder) LineStyle(lineStyle cog.Builder[common.LineStyle]) *PanelBuilder

func (*PanelBuilder) LineWidth

func (builder *PanelBuilder) LineWidth(lineWidth float64) *PanelBuilder
func (builder *PanelBuilder) Links(links []cog.Builder[dashboard.DashboardLink]) *PanelBuilder

Panel links.

func (*PanelBuilder) Mappings

func (builder *PanelBuilder) Mappings(mappings []dashboard.ValueMapping) *PanelBuilder

Convert input values into a display string

func (*PanelBuilder) Max

func (builder *PanelBuilder) Max(max float64) *PanelBuilder

The maximum value used in percentage threshold calculations. Leave blank for auto calculation based on all series and fields.

func (*PanelBuilder) MaxDataPoints

func (builder *PanelBuilder) MaxDataPoints(maxDataPoints float64) *PanelBuilder

The maximum number of data points that the panel queries are retrieving.

func (*PanelBuilder) MaxPerRow

func (builder *PanelBuilder) MaxPerRow(maxPerRow float64) *PanelBuilder

Option for repeated panels that controls max items per row Only relevant for horizontally repeated panels

func (*PanelBuilder) Min

func (builder *PanelBuilder) Min(min float64) *PanelBuilder

The minimum value used in percentage threshold calculations. Leave blank for auto calculation based on all series and fields.

func (*PanelBuilder) NoValue

func (builder *PanelBuilder) NoValue(noValue string) *PanelBuilder

Alternative to empty string

func (*PanelBuilder) Orientation

func (builder *PanelBuilder) Orientation(orientation common.VizOrientation) *PanelBuilder

func (*PanelBuilder) OverrideByFieldType

func (builder *PanelBuilder) OverrideByFieldType(fieldType string, properties []dashboard.DynamicConfigValue) *PanelBuilder

Adds override rules for all the fields of the given type.

func (*PanelBuilder) OverrideByName

func (builder *PanelBuilder) OverrideByName(name string, properties []dashboard.DynamicConfigValue) *PanelBuilder

Adds override rules for a specific field, referred to by its name.

func (*PanelBuilder) OverrideByQuery

func (builder *PanelBuilder) OverrideByQuery(queryRefId string, properties []dashboard.DynamicConfigValue) *PanelBuilder

func (*PanelBuilder) OverrideByRegexp

func (builder *PanelBuilder) OverrideByRegexp(regexp string, properties []dashboard.DynamicConfigValue) *PanelBuilder

Adds override rules for the fields whose name match the given regexp.

func (*PanelBuilder) Overrides

Overrides are the options applied to specific fields overriding the defaults.

func (*PanelBuilder) PointColor

func (builder *PanelBuilder) PointColor(pointColor string) *PanelBuilder

func (*PanelBuilder) PointSize

func (builder *PanelBuilder) PointSize(pointSize float64) *PanelBuilder

func (*PanelBuilder) PointSymbol

func (builder *PanelBuilder) PointSymbol(pointSymbol string) *PanelBuilder

func (*PanelBuilder) QueryCachingTTL

func (builder *PanelBuilder) QueryCachingTTL(queryCachingTTL float64) *PanelBuilder

Overrides the data source configured time-to-live for a query cache item in milliseconds

func (*PanelBuilder) Repeat

func (builder *PanelBuilder) Repeat(repeat string) *PanelBuilder

Name of template variable to repeat for.

func (*PanelBuilder) RepeatDirection

func (builder *PanelBuilder) RepeatDirection(repeatDirection dashboard.PanelRepeatDirection) *PanelBuilder

Direction to repeat in if 'repeat' is set. `h` for horizontal, `v` for vertical.

func (*PanelBuilder) ScaleDistribution

func (builder *PanelBuilder) ScaleDistribution(scaleDistribution cog.Builder[common.ScaleDistributionConfig]) *PanelBuilder

func (*PanelBuilder) ShowPoints

func (builder *PanelBuilder) ShowPoints(showPoints common.VisibilityMode) *PanelBuilder

func (*PanelBuilder) Span

func (builder *PanelBuilder) Span(w uint32) *PanelBuilder

Panel width. The width is the number of columns from the left edge of the panel.

func (*PanelBuilder) SpanNulls

func (builder *PanelBuilder) SpanNulls(spanNulls common.BoolOrFloat64) *PanelBuilder

Indicate if null values should be treated as gaps or connected. When the value is a number, it represents the maximum delta in the X axis that should be considered connected. For timeseries, this is milliseconds

func (*PanelBuilder) Stacking

func (builder *PanelBuilder) Stacking(stacking cog.Builder[common.StackingConfig]) *PanelBuilder

func (*PanelBuilder) Targets

func (builder *PanelBuilder) Targets(targets []cog.Builder[variants.Dataquery]) *PanelBuilder

Depends on the panel plugin. See the plugin documentation for details.

func (*PanelBuilder) Thresholds

func (builder *PanelBuilder) Thresholds(thresholds cog.Builder[dashboard.ThresholdsConfig]) *PanelBuilder

Map numeric values to states

func (*PanelBuilder) ThresholdsStyle

func (builder *PanelBuilder) ThresholdsStyle(thresholdsStyle cog.Builder[common.GraphThresholdsStyleConfig]) *PanelBuilder

func (*PanelBuilder) TimeFrom

func (builder *PanelBuilder) TimeFrom(timeFrom string) *PanelBuilder

Overrides the relative time range for individual panels, which causes them to be different than what is selected in the dashboard time picker in the top-right corner of the dashboard. You can use this to show metrics from different time periods or days on the same dashboard. The value is formatted as time operation like: `now-5m` (Last 5 minutes), `now/d` (the day so far), `now-5d/d`(Last 5 days), `now/w` (This week so far), `now-2y/y` (Last 2 years). Note: Panel time overrides have no effect when the dashboard’s time range is absolute. See: https://grafana.com/docs/grafana/latest/panels-visualizations/query-transform-data/#query-options

func (*PanelBuilder) TimeShift

func (builder *PanelBuilder) TimeShift(timeShift string) *PanelBuilder

Overrides the time range for individual panels by shifting its start and end relative to the time picker. For example, you can shift the time range for the panel to be two hours earlier than the dashboard time picker setting `2h`. Note: Panel time overrides have no effect when the dashboard’s time range is absolute. See: https://grafana.com/docs/grafana/latest/panels-visualizations/query-transform-data/#query-options

func (*PanelBuilder) Timezone

func (builder *PanelBuilder) Timezone(timezone []common.TimeZone) *PanelBuilder

func (*PanelBuilder) Title

func (builder *PanelBuilder) Title(title string) *PanelBuilder

Panel title.

func (*PanelBuilder) Tooltip

func (builder *PanelBuilder) Tooltip(tooltip cog.Builder[common.VizTooltipOptions]) *PanelBuilder

func (*PanelBuilder) Transform

func (builder *PanelBuilder) Transform(transform common.GraphTransform) *PanelBuilder

func (*PanelBuilder) Transformations

func (builder *PanelBuilder) Transformations(transformations []dashboard.DataTransformerConfig) *PanelBuilder

List of transformations that are applied to the panel data before rendering. When there are multiple transformations, Grafana applies them in the order they are listed. Each transformation creates a result set that then passes on to the next transformation in the processing pipeline.

func (*PanelBuilder) Transparent

func (builder *PanelBuilder) Transparent(transparent bool) *PanelBuilder

Whether to display the panel without a background.

func (*PanelBuilder) Unit

func (builder *PanelBuilder) Unit(unit string) *PanelBuilder

Unit a field should use. The unit you select is applied to all fields except time. You can use the units ID availables in Grafana or a custom unit. Available units in Grafana: https://github.com/grafana/grafana/blob/main/packages/grafana-data/src/valueFormats/categories.ts As custom unit, you can use the following formats: `suffix:<suffix>` for custom unit that should go after value. `prefix:<prefix>` for custom unit that should go before value. `time:<format>` For custom date time formats type for example `time:YYYY-MM-DD`. `si:<base scale><unit characters>` for custom SI units. For example: `si: mF`. This one is a bit more advanced as you can specify both a unit and the source data scale. So if your source data is represented as milli (thousands of) something prefix the unit with that SI scale character. `count:<unit>` for a custom count unit. `currency:<unit>` for custom a currency unit.

func (*PanelBuilder) WithOverride

func (builder *PanelBuilder) WithOverride(matcher dashboard.MatcherConfig, properties []dashboard.DynamicConfigValue) *PanelBuilder

Overrides are the options applied to specific fields overriding the defaults.

func (*PanelBuilder) WithTarget

func (builder *PanelBuilder) WithTarget(target cog.Builder[variants.Dataquery]) *PanelBuilder

Depends on the panel plugin. See the plugin documentation for details.

func (*PanelBuilder) WithTransformation

func (builder *PanelBuilder) WithTransformation(transformation dashboard.DataTransformerConfig) *PanelBuilder

List of transformations that are applied to the panel data before rendering. When there are multiple transformations, Grafana applies them in the order they are listed. Each transformation creates a result set that then passes on to the next transformation in the processing pipeline.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL