stackdriver

package
v6.0.0-beta1+incompatible Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2019 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewStackdriverExecutor

func NewStackdriverExecutor(dsInfo *models.DataSource) (tsdb.TsdbQueryEndpoint, error)

NewStackdriverExecutor initializes a http client

Types

type StackdriverBucketOptions

type StackdriverBucketOptions struct {
	LinearBuckets *struct {
		NumFiniteBuckets int64 `json:"numFiniteBuckets"`
		Width            int64 `json:"width"`
		Offset           int64 `json:"offset"`
	} `json:"linearBuckets"`
	ExponentialBuckets *struct {
		NumFiniteBuckets int64   `json:"numFiniteBuckets"`
		GrowthFactor     float64 `json:"growthFactor"`
		Scale            float64 `json:"scale"`
	} `json:"exponentialBuckets"`
	ExplicitBuckets *struct {
		Bounds []int64 `json:"bounds"`
	} `json:"explicitBuckets"`
}

type StackdriverExecutor

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

StackdriverExecutor executes queries for the Stackdriver datasource

func (*StackdriverExecutor) Query

func (e *StackdriverExecutor) Query(ctx context.Context, dsInfo *models.DataSource, tsdbQuery *tsdb.TsdbQuery) (*tsdb.Response, error)

Query takes in the frontend queries, parses them into the Stackdriver query format executes the queries against the Stackdriver API and parses the response into the time series or table format

type StackdriverQuery

type StackdriverQuery struct {
	Target   string
	Params   url.Values
	RefID    string
	GroupBys []string
	AliasBy  string
}

StackdriverQuery is the query that Grafana sends from the frontend

type StackdriverResponse

type StackdriverResponse struct {
	TimeSeries []struct {
		Metric struct {
			Labels map[string]string `json:"labels"`
			Type   string            `json:"type"`
		} `json:"metric"`
		Resource struct {
			Type   string            `json:"type"`
			Labels map[string]string `json:"labels"`
		} `json:"resource"`
		MetricKind string `json:"metricKind"`
		ValueType  string `json:"valueType"`
		Points     []struct {
			Interval struct {
				StartTime time.Time `json:"startTime"`
				EndTime   time.Time `json:"endTime"`
			} `json:"interval"`
			Value struct {
				DoubleValue       float64 `json:"doubleValue"`
				StringValue       string  `json:"stringValue"`
				BoolValue         bool    `json:"boolValue"`
				IntValue          string  `json:"int64Value"`
				DistributionValue struct {
					Count                 string  `json:"count"`
					Mean                  float64 `json:"mean"`
					SumOfSquaredDeviation float64 `json:"sumOfSquaredDeviation"`
					Range                 struct {
						Min int `json:"min"`
						Max int `json:"max"`
					} `json:"range"`
					BucketOptions StackdriverBucketOptions `json:"bucketOptions"`
					BucketCounts  []string                 `json:"bucketCounts"`
					Examplars     []struct {
						Value     float64 `json:"value"`
						Timestamp string  `json:"timestamp"`
					} `json:"examplars"`
				} `json:"distributionValue"`
			} `json:"value"`
		} `json:"points"`
	} `json:"timeSeries"`
}

StackdriverResponse is the data returned from the external Google Stackdriver API

Jump to

Keyboard shortcuts

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