applications

package module
v0.0.0-...-31263be Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2023 License: MIT Imports: 2 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DataType

type DataType int

DataType indicates a PromCommand is for table view or for graph view in data visualization platform like Grafana Basically,

  • TABLE_DATA is for raw table data query
  • GRAPH_DATA is for time-bounding graph data query
  • LABEL_VALUES_DATA is for label values data query like fetching data for label selector options at the top of Grafana dashboard
const (
	TABLE_DATA DataType = iota + 1
	GRAPH_DATA
	LABEL_VALUES_DATA
)

type IPromAdaptor

type IPromAdaptor interface {
	Query(ctx context.Context, cmd PromCommand) (RunResult, error)
}

type PromCommand

type PromCommand struct {
	Cmd      string
	Database string
	// Start and End attributes are mainly used for PromQL currently
	// as it doesn't support time-bounding query expression itself
	Start      *time.Time
	End        *time.Time
	Timezone   *time.Location
	Evaluation *time.Time
	// Step is evaluation step for PromQL.
	// As InfluxQL doesn't have the equivalent expression or concept,
	// we use it as interval parameter for InfluxQL GROUP BY time(interval)
	// if the raw query doesn't contain PromQL MatrixSelector expression.
	// If the raw query does contain PromQL parser.MatrixSelector expression,
	// its Range attribute will be used as the interval parameter.
	Step time.Duration

	DataType DataType
	// ValueFieldKey indicates which field will be used.
	// As matrix value field as measurement in InfluxDB may contain multiple fields that is different from Prometheus,
	// so we may need to set ValueFieldKey.
	//
	// Default is “`value“` field.
	ValueFieldKey string
	// LabelName is only used for label values query.
	LabelName string
}

PromCommand wraps a raw query expression with several related attributes

type RunResult

type RunResult struct {
	Result     interface{}
	ResultType string
	Error      error
}

RunResult wraps query result and possible error

Directories

Path Synopsis
prom module

Jump to

Keyboard shortcuts

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