cloudmonitoring

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: May 8, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package cloudmonitoring provides functionality to interact with the Cloud Monitoring API.

Index

Constants

View Source
const (
	DefaultLongExponentialBackOffInterval = 2 * time.Second
	DefaultShortConstantBackOffInterval   = 5 * time.Second
)

Defaults for the different back off intervals.

Variables

This section is empty.

Functions

func CreateTimeSeriesWithRetry

func CreateTimeSeriesWithRetry(ctx context.Context, client TimeSeriesCreator, req *monitoringpb.CreateTimeSeriesRequest, bo *BackOffIntervals) error

CreateTimeSeriesWithRetry decorates TimeSeriesCreator.CreateTimeSeries with a retry mechanism.

func QueryTimeSeriesWithRetry

func QueryTimeSeriesWithRetry(ctx context.Context, client TimeSeriesQuerier, req *monitoringpb.QueryTimeSeriesRequest, bo *BackOffIntervals) ([]*mrpb.TimeSeriesData, error)

QueryTimeSeriesWithRetry decorates TimeSeriesQuerier.QueryTimeSeries with a retry mechanism.

func SendTimeSeries

func SendTimeSeries(ctx context.Context, timeSeries []*mrpb.TimeSeries, timeSeriesCreator TimeSeriesCreator, bo *BackOffIntervals, projectID string) (sent, batchCount int, err error)

SendTimeSeries sends all the time series objects to cloud monitoring. maxTSPerRequest is used as an upper limit to batch send time series values per request. If a cloud monitoring API call fails even after retries, the remaining measurements are discarded.

Types

type BackOffIntervals

type BackOffIntervals struct {
	LongExponential, ShortConstant time.Duration
}

BackOffIntervals holds the initial intervals for the different back off mechanisms.

func NewBackOffIntervals

func NewBackOffIntervals(longExponential, shortConstant time.Duration) *BackOffIntervals

NewBackOffIntervals is a constructor for the back off intervals.

func NewDefaultBackOffIntervals

func NewDefaultBackOffIntervals() *BackOffIntervals

NewDefaultBackOffIntervals is a default constructor, utilizing the default back off intervals.

type TimeSeriesCreator

type TimeSeriesCreator interface {
	CreateTimeSeries(ctx context.Context, req *monitoringpb.CreateTimeSeriesRequest, opts ...gax.CallOption) error
}

TimeSeriesCreator provides an easily testable translation to the cloud monitoring API.

type TimeSeriesQuerier

type TimeSeriesQuerier interface {
	QueryTimeSeries(ctx context.Context, req *monitoringpb.QueryTimeSeriesRequest, opts ...gax.CallOption) ([]*mrpb.TimeSeriesData, error)
}

TimeSeriesQuerier provides an easily testable translation to the cloud monitoring API.

Directories

Path Synopsis
Package fake implements test fakes for the cloudmonitoring wrappers.
Package fake implements test fakes for the cloudmonitoring wrappers.

Jump to

Keyboard shortcuts

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