plugin

package
v1.3.8 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2025 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddPassTroughTokenToContext added in v1.3.8

func AddPassTroughTokenToContext(ctx context.Context, token string) context.Context

AddPassTroughTokenToContext adds the pass through token to the context

func NewSampleDatasource

func NewSampleDatasource(ctx context.Context, settings backend.DataSourceInstanceSettings) (instancemgmt.Instance, error)

NewSampleDatasource creates a new datasource instance.

func SetDatasourceSettings added in v1.3.2

func SetDatasourceSettings(db *sql.DB, connectionSettings ConnectionSettings)

SetDatasourceSettings is a helper function to set the connection settings for the DB

Types

type ConnectionSettings added in v1.3.2

type ConnectionSettings struct {
	MaxOpenConns     int
	MaxIdleConns     int
	ConnMaxLifetime  time.Duration
	ConnMaxIdleTime  time.Duration
	Retries          int
	RetryBackoff     time.Duration
	MaxRetryDuration time.Duration
	Timeout          time.Duration
	MaxRows          int
}

type ConnectionSettingsRawJson added in v1.3.2

type ConnectionSettingsRawJson struct {
	MaxOpenConns     string `json:"maxOpenConns"`
	MaxIdleConns     string `json:"maxIdleConns"`
	ConnMaxLifetime  string `json:"connMaxLifetime"`
	ConnMaxIdleTime  string `json:"connMaxIdleTime"`
	Retries          string `json:"retries"`
	RetryBackoff     string `json:"retryBackoff"`
	MaxRetryDuration string `json:"maxRetryDuration"`
	Timeout          string `json:"timeout"`
	MaxRows          string `json:"maxRows"`
}

type Datasource added in v1.2.0

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

Datasource is an example datasource which can respond to data queries, reports its health and has streaming skills.

func (*Datasource) CallResource added in v1.2.0

CallResource handles resource calls sent from Grafana to the plugin.

func (*Datasource) CheckHealth added in v1.2.0

CheckHealth handles health checks sent from Grafana to the plugin. The main use case for these health checks is the test button on the datasource configuration page which allows users to verify that a datasource is working as expected.

func (*Datasource) Dispose added in v1.2.0

func (d *Datasource) Dispose()

Dispose here tells plugin SDK that plugin wants to clean up resources when a new instance created. As soon as datasource settings change detected by SDK old datasource instance will be disposed and a new one will be created using NewSampleDatasource factory function.

func (*Datasource) ExecContext added in v1.3.1

func (d *Datasource) ExecContext(ctx context.Context, queryString string) error

ExecContext is a helper function to execute a query on the Databricks SQL DB without returning any rows and handling session expiration

func (*Datasource) QueryContext added in v1.3.1

func (d *Datasource) QueryContext(ctx context.Context, queryString string) (*sql.Rows, error)

QueryContext is a helper function to query the Databricks SQL DB returning the rows and handling session expiration

func (*Datasource) QueryData added in v1.2.0

QueryData handles multiple queries and returns multiple responses. req contains the queries []DataQuery (where each query contains RefID as a unique identifier). The QueryDataResponse contains a map of RefID to the response for each query, and each response contains Frames ([]*Frame).

func (*Datasource) RefreshDBConnection added in v1.2.3

func (d *Datasource) RefreshDBConnection() error

RefreshDBConnection is a helper function which initializes a new DB connection

type DatasourceSettings added in v1.0.0

type DatasourceSettings struct {
	Path                   string `json:"path"`
	Hostname               string `json:"hostname"`
	Port                   string `json:"port"`
	AuthenticationMethod   string `json:"authenticationMethod"`
	ClientId               string `json:"clientId"`
	ExternalCredentialsUrl string `json:"externalCredentialsUrl"`
	OAuthScopes            string `json:"oauthScopes"`
}

Jump to

Keyboard shortcuts

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