azuremonitor

package
v0.0.0-test Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2021 License: AGPL-3.0 Imports: 34 Imported by: 66

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InsightsMetricsResultToFrame

func InsightsMetricsResultToFrame(mr MetricsResult, metric, agg string, dimensions []string) (*data.Frame, error)

InsightsMetricsResultToFrame converts a MetricsResult (an Application Insights metrics query response) to a dataframe. Due to the dynamic nature of the MetricsResult object, the name of the metric, aggregation, and requested dimensions are used to determine the expected shape of the object. This builds all series into a single data.Frame with one time index (a wide formatted time series frame).

func KqlInterpolate

func KqlInterpolate(query backend.DataQuery, dsInfo datasourceInfo, kql string, defaultTimeField ...string) (string, error)

KqlInterpolate interpolates macros for Kusto Query Language (KQL) queries

func NewInstanceSettings

func NewInstanceSettings(cfg *setting.Cfg, clientProvider httpclient.Provider, executors map[string]azDatasourceExecutor) datasource.InstanceFactoryFunc

func ResponseTableToFrame

func ResponseTableToFrame(table *AzureResponseTable) (*data.Frame, error)

ResponseTableToFrame converts an AzureResponseTable to a data.Frame.

Types

type ApplicationInsightsDatasource

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

ApplicationInsightsDatasource calls the application insights query API.

type ApplicationInsightsQuery

type ApplicationInsightsQuery struct {
	RefID     string
	TimeRange backend.TimeRange

	// Text based raw query options.
	ApiURL string
	Params url.Values
	Alias  string
	Target string
	// contains filtered or unexported fields
}

ApplicationInsightsQuery is the model that holds the information needed to make a metrics query to Application Insights, and the information used to parse the response.

type AzureLogAnalyticsDatasource

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

AzureLogAnalyticsDatasource calls the Azure Log Analytics API's

type AzureLogAnalyticsQuery

type AzureLogAnalyticsQuery struct {
	RefID        string
	ResultFormat string
	URL          string
	JSON         json.RawMessage
	Params       url.Values
	Target       string
	TimeRange    backend.TimeRange
}

AzureLogAnalyticsQuery is the query request that is built from the saved values for from the UI

type AzureLogAnalyticsResponse

type AzureLogAnalyticsResponse struct {
	Tables []AzureResponseTable `json:"tables"`
}

AzureLogAnalyticsResponse is the json response object from the Azure Log Analytics API.

func (*AzureLogAnalyticsResponse) GetPrimaryResultTable

func (ar *AzureLogAnalyticsResponse) GetPrimaryResultTable() (*AzureResponseTable, error)

GetPrimaryResultTable returns the first table in the response named "PrimaryResult", or an error if there is no table by that name.

type AzureMonitorDatasource

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

AzureMonitorDatasource calls the Azure Monitor API - one of the four API's supported

type AzureMonitorQuery

type AzureMonitorQuery struct {
	URL           string
	UrlComponents map[string]string
	Target        string
	Params        url.Values
	RefID         string
	Alias         string
	TimeRange     backend.TimeRange
}

AzureMonitorQuery is the query for all the services as they have similar queries with a url, a querystring and an alias field

type AzureMonitorResponse

type AzureMonitorResponse struct {
	Cost     int    `json:"cost"`
	Timespan string `json:"timespan"`
	Interval string `json:"interval"`
	Value    []struct {
		ID   string `json:"id"`
		Type string `json:"type"`
		Name struct {
			Value          string `json:"value"`
			LocalizedValue string `json:"localizedValue"`
		} `json:"name"`
		Unit       string `json:"unit"`
		Timeseries []struct {
			Metadatavalues []struct {
				Name struct {
					Value          string `json:"value"`
					LocalizedValue string `json:"localizedValue"`
				} `json:"name"`
				Value string `json:"value"`
			} `json:"metadatavalues"`
			Data []struct {
				TimeStamp time.Time `json:"timeStamp"`
				Average   *float64  `json:"average,omitempty"`
				Total     *float64  `json:"total,omitempty"`
				Count     *float64  `json:"count,omitempty"`
				Maximum   *float64  `json:"maximum,omitempty"`
				Minimum   *float64  `json:"minimum,omitempty"`
			} `json:"data"`
		} `json:"timeseries"`
	} `json:"value"`
	Namespace      string `json:"namespace"`
	Resourceregion string `json:"resourceregion"`
}

AzureMonitorResponse is the json response from the Azure Monitor API

type AzureResourceGraphDatasource

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

AzureResourceGraphDatasource calls the Azure Resource Graph API's

type AzureResourceGraphQuery

type AzureResourceGraphQuery struct {
	RefID             string
	ResultFormat      string
	URL               string
	JSON              json.RawMessage
	InterpolatedQuery string
	TimeRange         backend.TimeRange
}

AzureResourceGraphQuery is the query request that is built from the saved values for from the UI

type AzureResourceGraphResponse

type AzureResourceGraphResponse struct {
	Data AzureResponseTable `json:"data"`
}

AzureResourceGraphResponse is the json response object from the Azure Resource Graph Analytics API.

type AzureResponseTable

type AzureResponseTable struct {
	Name    string `json:"name"`
	Columns []struct {
		Name string `json:"name"`
		Type string `json:"type"`
	} `json:"columns"`
	Rows [][]interface{} `json:"rows"`
}

AzureResponseTable is the table format for Azure responses

type InsightsAnalyticsDatasource

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

type InsightsAnalyticsQuery

type InsightsAnalyticsQuery struct {
	RefID string

	RawQuery          string
	InterpolatedQuery string

	ResultFormat string

	Params url.Values
	Target string
}

type InsightsDimensions

type InsightsDimensions []string

InsightsDimensions will unmarshal from a JSON string, or an array of strings, into a string array. This exists to support an older query format which is updated when a user saves the query or it is sent from the front end, but may not be when alerting fetches the model.

func (*InsightsDimensions) UnmarshalJSON

func (s *InsightsDimensions) UnmarshalJSON(data []byte) error

UnmarshalJSON fulfills the json.Unmarshaler interface type.

type LogAnalyticsMeta

type LogAnalyticsMeta struct {
	ColumnTypes  []string `json:"azureColumnTypes"`
	Subscription string   `json:"subscription"`
	Workspace    string   `json:"workspace"`
	EncodedQuery []byte   `json:"encodedQuery"` // EncodedQuery is used for deep links.
}

LogAnalyticsMeta is a type for the a Frame's Meta's Custom property.

type MetricsResult

type MetricsResult struct {
	Value *MetricsResultInfo `json:"value,omitempty"`
}

MetricsResult a metric result. This is copied from azure-sdk-for-go/services/preview/appinsights/v1/insights.

type MetricsResultInfo

type MetricsResultInfo struct {
	// AdditionalProperties - Unmatched properties from the message are deserialized this collection
	AdditionalProperties map[string]interface{} `json:""`
	// Start - Start time of the metric.
	Start time.Time `json:"start,omitempty"`
	// End - Start time of the metric.
	End time.Time `json:"end,omitempty"`
	// Interval - The interval used to segment the metric data.
	Interval *string `json:"interval,omitempty"`
	// Segments - Segmented metric data (if segmented).
	Segments *[]MetricsSegmentInfo `json:"segments,omitempty"`
}

MetricsResultInfo a metric result data. This is copied from azure-sdk-for-go/services/preview/appinsights/v1/insights (except time Type is changed).

func (*MetricsResultInfo) UnmarshalJSON

func (mri *MetricsResultInfo) UnmarshalJSON(body []byte) error

UnmarshalJSON is the custom unmarshaler for MetricsResultInfo struct. This is copied from azure-sdk-for-go/services/preview/appinsights/v1/insights (except time Type is changed).

type MetricsSegmentInfo

type MetricsSegmentInfo struct {
	// AdditionalProperties - Unmatched properties from the message are deserialized this collection
	AdditionalProperties map[string]interface{} `json:""`
	// Start - Start time of the metric segment (only when an interval was specified).
	Start time.Time `json:"start,omitempty"`
	// End - Start time of the metric segment (only when an interval was specified).
	End time.Time `json:"end,omitempty"`
	// Segments - Segmented metric data (if further segmented).
	Segments *[]MetricsSegmentInfo `json:"segments,omitempty"`
}

MetricsSegmentInfo is a metric segment. This is copied from azure-sdk-for-go/services/preview/appinsights/v1/insights (except time Type is changed).

func (*MetricsSegmentInfo) UnmarshalJSON

func (mri *MetricsSegmentInfo) UnmarshalJSON(body []byte) error

UnmarshalJSON is the custom unmarshaler for MetricsSegmentInfo struct. This is copied from azure-sdk-for-go/services/preview/appinsights/v1/insights (except time Type is changed).

type Service

type Service struct {
	Cfg *setting.Cfg
	// contains filtered or unexported fields
}

func ProvideService

func ProvideService(cfg *setting.Cfg, httpClientProvider *httpclient.Provider, registrar plugins.CoreBackendRegistrar) *Service

type TimeGrain

type TimeGrain struct{}

TimeGrain handles conversions between the ISO 8601 Duration format (PT1H), Kbn units (1h) and Time Grains (1 hour) Also handles using the automatic Grafana interval to calculate a ISO 8601 Duration.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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