models

package
v0.0.0-...-f3ab686 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToADXTimeSeries

func ToADXTimeSeries(in *data.Frame) (*data.Frame, error)

ToADXTimeSeries returns Time series for a query that returns an ADX series type. This done by having a query with make_series as the returned type. The time column must be named "Timestamp". Each Row has: - N Columns for group by items, where each Group by item is a column individual string column - An Array of Values per Aggregation Column - Timestamp column

From the ADX documentation, I believe all series will share the same time index, so we create a wide frame.

Types

type ARGRequestPayload

type ARGRequestPayload struct {
	Query string `json:"query"`
}

type AzureFrameMD

type AzureFrameMD struct {
	ColumnTypes []string
}

AzureFrameMD is a type to populate a Frame's Custom metadata property.

type CacheSettings

type CacheSettings struct {
	CacheMaxAge string
	TimeRange   *backend.TimeRange
}

CacheSettings is use to enable caching on a per query basis

func NewCacheSettings

func NewCacheSettings(s *DatasourceSettings, q *backend.DataQuery, qm *QueryModel) *CacheSettings

NewCacheSettings is used to detect what cache settings is applicable for the current query.

type ClusterOption

type ClusterOption struct {
	Name string `json:"name,omitempty"`
	Uri  string `json:"uri,omitempty"`
}

type Column

type Column struct {
	ColumnName string
	DataType   string
	ColumnType string
}

Column is a descriptor within a TableResponse

type DatasourceSettings

type DatasourceSettings struct {
	ClusterURL         string `json:"clusterUrl"`
	DefaultDatabase    string `json:"defaultDatabase"`
	DataConsistency    string `json:"dataConsistency"`
	CacheMaxAge        string `json:"cacheMaxAge"`
	DynamicCaching     bool   `json:"dynamicCaching"`
	EnableUserTracking bool   `json:"enableUserTracking"`

	// QueryTimeoutRaw is a duration string set in the datasource settings and corresponds
	// to the server execution timeout.
	QueryTimeoutRaw string `json:"queryTimeout"`

	// QueryTimeout the parsed duration of QueryTimeoutRaw.
	QueryTimeout time.Duration `json:"-"`

	// ServerTimeoutValue is the QueryTimeout formatted as a MS Timespan
	// which is used as a connection property option.
	ServerTimeoutValue string `json:"-"`
	OpenAIAPIKey       string

	EnforceTrustedEndpoints bool `json:"-"`
}

DatasourceSettings holds the datasource configuration information for Azure Data Explorer's API that is needed to execute a request against Azure's Data Explorer API.

func (*DatasourceSettings) Load

newDataSourceData creates a dataSourceData from the plugin API's DatasourceInfo's JSONData and Encrypted JSONData which contains the information needed to connected to the datasource. It also sets the QueryTimeout and ServerTimeoutValues by parsing QueryTimeoutRaw.

type ErrorResponse

type ErrorResponse struct {
	Error struct {
		Message string `json:"message"`
	} `json:"error"`
}

errorResponse is a minimal structure of Azure Data Explorer's JSON error body,

type HttpError

type HttpError struct {
	Message    string
	Error      string
	StatusCode int
}

func NewHttpError

func NewHttpError(message string, statusCode int, err error) *HttpError

type KeyValue

type KeyValue struct {
	Value interface{} `json:"value"`
	Key   string      `json:"key"`
}

type MacroData

type MacroData struct {
	*backend.TimeRange
	// contains filtered or unexported fields
}

MacroData contains the information needed for macro expansion.

func NewMacroData

func NewMacroData(tr *backend.TimeRange, intervalMS int64) MacroData

NewMacroData creates a MacroData object from the arguments that can be used to interpolate macros with the Interpolate method.

func (MacroData) Interpolate

func (md MacroData) Interpolate(query string) (string, error)

Interpolate replaces macros with their values for the given query.

type Properties

type Properties struct {
	Options *options `json:"options,omitempty"`
}

Properties is a property bag of connection string options.

func NewConnectionProperties

func NewConnectionProperties(s *DatasourceSettings, cs *CacheSettings) *Properties

NewConnectionProperties creates ADX connection properties based on datasource settings.

type QueryModel

type QueryModel struct {
	Format      string `json:"resultFormat"`
	QueryType   string `json:"queryType"`
	Query       string `json:"query"`
	Database    string `json:"database"`
	QuerySource string `json:"querySource"` // used to identify if query came from getSchema, raw mode, etc
	ClusterUri  string `json:"clusterUri,omitempty"`
	MacroData   MacroData
}

QueryModel contains the query information from the API call that we use to make a query.

func (*QueryModel) Interpolate

func (qm *QueryModel) Interpolate() (err error)

Interpolate applies macro expansion on the QueryModel's Payload's Query string

type RequestPayload

type RequestPayload struct {
	DB          string      `json:"db"`
	CSL         string      `json:"csl"`
	QuerySource string      `json:"querySource"`
	Properties  *Properties `json:"properties,omitempty"`
}

RequestPayload is the information that makes up a Kusto query for Azure's Data Explorer API.

type Row

type Row interface{}

Row Represents a row within a TableResponse

type Table

type Table struct {
	TableName string
	Columns   []Column
	Rows      []Row
}

Table is a member of TableResponse

type TableResponse

type TableResponse struct {
	Tables     []Table
	Exceptions []string
}

TableResponse represents the response struct from Azure's Data Explorer REST API.

func TableFromJSON

func TableFromJSON(rc io.Reader) (*TableResponse, error)

func (*TableResponse) ToDataFrames

func (tr *TableResponse) ToDataFrames(executedQueryString string, format string) (data.Frames, error)

type TraceLog

type TraceLog struct {
	Timestamp int64      `json:"timestamp"`
	Fields    []KeyValue `json:"fields"`
}

Jump to

Keyboard shortcuts

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