plugin

package
v0.0.0-...-4440402 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Plugin

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

Plugin represents grafana datasource plugin.

func New

func New(repo repository) *Plugin

New returns configured Plugin.

func (*Plugin) CheckHealth

func (p *Plugin) CheckHealth(ctx context.Context) error

CheckHealth executes repository Ping method to check database health.

func (*Plugin) Dispose

func (p *Plugin) Dispose()

Dispose closes all connections to Cassandra cluster.

func (*Plugin) ExecQuery

func (p *Plugin) ExecQuery(ctx context.Context, q *Query) (data.Frames, error)

ExecQuery executes metric query based on provided query type.

func (*Plugin) GetColumns

func (p *Plugin) GetColumns(keyspace, table, needType string) ([]string, error)

GetColumns fetches and returns Cassandra's list of columns of given type for provided keyspace and table.

func (*Plugin) GetKeyspaces

func (p *Plugin) GetKeyspaces(ctx context.Context) ([]string, error)

GetKeyspaces fetches and returns Cassandra's list of keyspaces.

func (*Plugin) GetTables

func (p *Plugin) GetTables(keyspace string) ([]string, error)

GetTables fetches and returns Cassandra's list of tables for provided keyspace.

func (*Plugin) GetVariables

func (p *Plugin) GetVariables(ctx context.Context, query string) ([]Variable, error)

GetVariables fetches and returns data to create variables.

type Query

type Query struct {
	RawQuery       bool
	Target         string
	Keyspace       string
	Table          string
	ColumnValue    string
	ColumnID       string
	ValueID        string
	AliasID        string
	ColumnTime     string
	TimeFrom       time.Time
	TimeTo         time.Time
	AllowFiltering bool
	Instant        bool
	IsAlertQuery   bool
}

func (*Query) BuildStatement

func (q *Query) BuildStatement() string

BuildStatement builds cassandra query statement with positional parameters.

type Variable

type Variable struct {
	Value string `json:"value"`
	Label string `json:"text"`
}

Variable is a type to transfer variable data from backend to frontend, where it will be put into MetricFindValue type. https://github.com/grafana/grafana/blob/main/packages/grafana-data/src/types/datasource.ts#L595

Jump to

Keyboard shortcuts

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