logs

package
v0.0.0-...-83e2e3a Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2025 License: Apache-2.0 Imports: 9 Imported by: 6

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 logs panels. This configuration describes how to unmarshal it, convert it to code, …

Types

type Options

type Options struct {
	ShowLabels           bool                     `json:"showLabels"`
	ShowCommonLabels     bool                     `json:"showCommonLabels"`
	ShowTime             bool                     `json:"showTime"`
	ShowLogContextToggle bool                     `json:"showLogContextToggle"`
	WrapLogMessage       bool                     `json:"wrapLogMessage"`
	PrettifyLogMessage   bool                     `json:"prettifyLogMessage"`
	EnableLogDetails     bool                     `json:"enableLogDetails"`
	SortOrder            common.LogsSortOrder     `json:"sortOrder"`
	DedupStrategy        common.LogsDedupStrategy `json:"dedupStrategy"`
	// TODO: figure out how to define callbacks
	OnClickFilterLabel     any      `json:"onClickFilterLabel,omitempty"`
	OnClickFilterOutLabel  any      `json:"onClickFilterOutLabel,omitempty"`
	IsFilterLabelActive    any      `json:"isFilterLabelActive,omitempty"`
	OnClickFilterString    any      `json:"onClickFilterString,omitempty"`
	OnClickFilterOutString any      `json:"onClickFilterOutString,omitempty"`
	OnClickShowField       any      `json:"onClickShowField,omitempty"`
	OnClickHideField       any      `json:"onClickHideField,omitempty"`
	DisplayedFields        []string `json:"displayedFields,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) 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) DedupStrategy

func (builder *PanelBuilder) DedupStrategy(dedupStrategy common.LogsDedupStrategy) *PanelBuilder

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) DisplayedFields

func (builder *PanelBuilder) DisplayedFields(displayedFields []string) *PanelBuilder

func (*PanelBuilder) EnableLogDetails

func (builder *PanelBuilder) EnableLogDetails(enableLogDetails bool) *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) 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) 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) IsFilterLabelActive

func (builder *PanelBuilder) IsFilterLabelActive(isFilterLabelActive any) *PanelBuilder

func (*PanelBuilder) LibraryPanel

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

Dynamically load the panel

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) OnClickFilterLabel

func (builder *PanelBuilder) OnClickFilterLabel(onClickFilterLabel any) *PanelBuilder

TODO: figure out how to define callbacks

func (*PanelBuilder) OnClickFilterOutLabel

func (builder *PanelBuilder) OnClickFilterOutLabel(onClickFilterOutLabel any) *PanelBuilder

func (*PanelBuilder) OnClickFilterOutString

func (builder *PanelBuilder) OnClickFilterOutString(onClickFilterOutString any) *PanelBuilder

func (*PanelBuilder) OnClickFilterString

func (builder *PanelBuilder) OnClickFilterString(onClickFilterString any) *PanelBuilder

func (*PanelBuilder) OnClickHideField

func (builder *PanelBuilder) OnClickHideField(onClickHideField any) *PanelBuilder

func (*PanelBuilder) OnClickShowField

func (builder *PanelBuilder) OnClickShowField(onClickShowField any) *PanelBuilder

func (*PanelBuilder) Overrides

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

func (*PanelBuilder) PrettifyLogMessage

func (builder *PanelBuilder) PrettifyLogMessage(prettifyLogMessage bool) *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) ShowCommonLabels

func (builder *PanelBuilder) ShowCommonLabels(showCommonLabels bool) *PanelBuilder

func (*PanelBuilder) ShowLabels

func (builder *PanelBuilder) ShowLabels(showLabels bool) *PanelBuilder

func (*PanelBuilder) ShowLogContextToggle

func (builder *PanelBuilder) ShowLogContextToggle(showLogContextToggle bool) *PanelBuilder

func (*PanelBuilder) ShowTime

func (builder *PanelBuilder) ShowTime(showTime bool) *PanelBuilder

func (*PanelBuilder) SortOrder

func (builder *PanelBuilder) SortOrder(sortOrder common.LogsSortOrder) *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) 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) 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) Title

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

Panel title.

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.

func (*PanelBuilder) WrapLogMessage

func (builder *PanelBuilder) WrapLogMessage(wrapLogMessage bool) *PanelBuilder

Jump to

Keyboard shortcuts

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