loki

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: 7 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DataqueryConverter

func DataqueryConverter(input Dataquery) string

DataqueryConverter accepts a `Dataquery` object and generates the Go code to build this object using builders.

func VariantConfig

func VariantConfig() variants.DataqueryConfig

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

Types

type Dataquery

type Dataquery struct {
	// The LogQL query.
	Expr string `json:"expr"`
	// Used to override the name of the series.
	LegendFormat *string `json:"legendFormat,omitempty"`
	// Used to limit the number of log rows returned.
	MaxLines *int64 `json:"maxLines,omitempty"`
	// @deprecated, now use step.
	Resolution *int64           `json:"resolution,omitempty"`
	EditorMode *QueryEditorMode `json:"editorMode,omitempty"`
	// @deprecated, now use queryType.
	Range *bool `json:"range,omitempty"`
	// @deprecated, now use queryType.
	Instant *bool `json:"instant,omitempty"`
	// Used to set step value for range queries.
	Step *string `json:"step,omitempty"`
	// A unique identifier for the query within the list of targets.
	// In server side expressions, the refId is used as a variable name to identify results.
	// By default, the UI will assign A->Z; however setting meaningful names may be useful.
	RefId string `json:"refId"`
	// If hide is set to true, Grafana will filter out the response(s) associated with this query before returning it to the panel.
	Hide *bool `json:"hide,omitempty"`
	// Specify the query flavor
	// TODO make this required and give it a default
	QueryType *string `json:"queryType,omitempty"`
	// For mixed data sources the selected datasource is on the query level.
	// For non mixed scenarios this is undefined.
	// TODO find a better way to do this ^ that's friendly to schema
	// TODO this shouldn't be unknown but DataSourceRef | null
	Datasource *dashboard.DataSourceRef `json:"datasource,omitempty"`
}

func NewDataquery

func NewDataquery() *Dataquery

NewDataquery creates a new Dataquery object.

func (Dataquery) DataqueryType

func (resource Dataquery) DataqueryType() string

func (Dataquery) Equals

func (resource Dataquery) Equals(otherCandidate variants.Dataquery) bool

Equals tests the equality of two dataqueries.

func (Dataquery) ImplementsDataqueryVariant

func (resource Dataquery) ImplementsDataqueryVariant()

func (*Dataquery) UnmarshalJSONStrict

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

UnmarshalJSONStrict implements a custom JSON unmarshalling logic to decode `Dataquery` 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 (Dataquery) Validate

func (resource Dataquery) Validate() error

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

type DataqueryBuilder

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

func NewDataqueryBuilder

func NewDataqueryBuilder() *DataqueryBuilder

func (*DataqueryBuilder) Build

func (builder *DataqueryBuilder) Build() (variants.Dataquery, error)

func (*DataqueryBuilder) Datasource

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

For mixed data sources the selected datasource is on the query level. For non mixed scenarios this is undefined. TODO find a better way to do this ^ that's friendly to schema TODO this shouldn't be unknown but DataSourceRef | null

func (*DataqueryBuilder) EditorMode

func (builder *DataqueryBuilder) EditorMode(editorMode QueryEditorMode) *DataqueryBuilder

func (*DataqueryBuilder) Expr

func (builder *DataqueryBuilder) Expr(expr string) *DataqueryBuilder

The LogQL query.

func (*DataqueryBuilder) Hide

func (builder *DataqueryBuilder) Hide(hide bool) *DataqueryBuilder

If hide is set to true, Grafana will filter out the response(s) associated with this query before returning it to the panel.

func (*DataqueryBuilder) Instant

func (builder *DataqueryBuilder) Instant(instant bool) *DataqueryBuilder

@deprecated, now use queryType.

func (*DataqueryBuilder) LegendFormat

func (builder *DataqueryBuilder) LegendFormat(legendFormat string) *DataqueryBuilder

Used to override the name of the series.

func (*DataqueryBuilder) MaxLines

func (builder *DataqueryBuilder) MaxLines(maxLines int64) *DataqueryBuilder

Used to limit the number of log rows returned.

func (*DataqueryBuilder) QueryType

func (builder *DataqueryBuilder) QueryType(queryType string) *DataqueryBuilder

Specify the query flavor TODO make this required and give it a default

func (*DataqueryBuilder) Range

func (builder *DataqueryBuilder) Range(rangeArg bool) *DataqueryBuilder

@deprecated, now use queryType.

func (*DataqueryBuilder) RefId

func (builder *DataqueryBuilder) RefId(refId string) *DataqueryBuilder

A unique identifier for the query within the list of targets. In server side expressions, the refId is used as a variable name to identify results. By default, the UI will assign A->Z; however setting meaningful names may be useful.

func (*DataqueryBuilder) Resolution

func (builder *DataqueryBuilder) Resolution(resolution int64) *DataqueryBuilder

@deprecated, now use step.

func (*DataqueryBuilder) Step

func (builder *DataqueryBuilder) Step(step string) *DataqueryBuilder

Used to set step value for range queries.

type LokiQueryDirection

type LokiQueryDirection string
const (
	LokiQueryDirectionForward  LokiQueryDirection = "forward"
	LokiQueryDirectionBackward LokiQueryDirection = "backward"
)

type LokiQueryType

type LokiQueryType string
const (
	LokiQueryTypeRange   LokiQueryType = "range"
	LokiQueryTypeInstant LokiQueryType = "instant"
	LokiQueryTypeStream  LokiQueryType = "stream"
)

type QueryEditorMode

type QueryEditorMode string
const (
	QueryEditorModeCode    QueryEditorMode = "code"
	QueryEditorModeBuilder QueryEditorMode = "builder"
)

type SupportingQueryType

type SupportingQueryType string
const (
	SupportingQueryTypeLogsVolume     SupportingQueryType = "logsVolume"
	SupportingQueryTypeLogsSample     SupportingQueryType = "logsSample"
	SupportingQueryTypeDataSample     SupportingQueryType = "dataSample"
	SupportingQueryTypeInfiniteScroll SupportingQueryType = "infiniteScroll"
)

Jump to

Keyboard shortcuts

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