cloudmonitoring

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package cloudmonitoring provides an in-memory mock implementation of GCP Cloud Monitoring.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Mock

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

Mock is an in-memory mock implementation of the GCP Cloud Monitoring service.

func New

func New(opts *config.Options) *Mock

New creates a new Cloud Monitoring mock with the given configuration options.

func (*Mock) CreateAlarm

func (m *Mock) CreateAlarm(_ context.Context, cfg driver.AlarmConfig) error

CreateAlarm creates or updates an alert policy with the given configuration.

func (*Mock) DeleteAlarm

func (m *Mock) DeleteAlarm(_ context.Context, name string) error

DeleteAlarm deletes the alert policy with the given name.

func (*Mock) DescribeAlarms

func (m *Mock) DescribeAlarms(_ context.Context, names []string) ([]driver.AlarmInfo, error)

DescribeAlarms returns alert policies matching the given names, or all policies if names is empty.

func (*Mock) GetMetricData

func (m *Mock) GetMetricData(_ context.Context, input driver.GetMetricInput) (*driver.MetricDataResult, error)

GetMetricData retrieves metric data for the given query, filtering by time range and computing the requested statistic (aligner).

func (*Mock) ListMetrics

func (m *Mock) ListMetrics(_ context.Context, namespace string) ([]string, error)

ListMetrics returns unique metric names (metric descriptors) for the given namespace (project/metric type prefix).

func (*Mock) PutMetricData

func (m *Mock) PutMetricData(_ context.Context, data []driver.MetricDatum) error

PutMetricData stores metric data points (time series data) and evaluates any matching alarms.

func (*Mock) SetAlarmState

func (m *Mock) SetAlarmState(_ context.Context, name, state, reason string) error

SetAlarmState manually sets the state of an alert policy.

Jump to

Keyboard shortcuts

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