Documentation ¶
Overview ¶
Package cloudmonitoring provides functionality to interact with the Cloud Monitoring API.
Index ¶
- Constants
- func CreateTimeSeriesWithRetry(ctx context.Context, client TimeSeriesCreator, ...) error
- func QueryTimeSeriesWithRetry(ctx context.Context, client TimeSeriesQuerier, ...) ([]*mrpb.TimeSeriesData, error)
- func SendTimeSeries(ctx context.Context, timeSeries []*mrpb.TimeSeries, ...) (sent, batchCount int, err error)
- type BackOffIntervals
- type TimeSeriesCreator
- type TimeSeriesQuerier
Constants ¶
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 ¶
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.