Documentation ¶
Index ¶
Constants ¶
const ( // StatusCountMetric is the name of the custom cumulative metric // to which status counts are written. StatusCountMetric = "custom.googleapis.com/http_response_count" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CounterMetricT ¶
type CounterMetricT interface { Create() error Increment(map[string]int64) error ResetTime() time.Time }
CounterMetricT provides an interface implemented by all cumulative counter metrics. Can be used, for example, to implement mock counters for tests.
type CreateMetricCallbackT ¶
type StatusCounter ¶
type StatusCounter struct { // Public for injection from unit tests: CreateMetricCallback CreateMetricCallbackT CreateTimeSeriesCallback CreateTimeSeriesCallbackT // contains filtered or unexported fields }
StatusCounter implements CounterMetricT for HTTP respone status code counts.
func NewStatusCounter ¶
func NewStatusCounter(project string, resource *monitoring.MonitoredResource, service *monitoring.Service) *StatusCounter
NewStatusCounter creats a StatusCounter associated with the provided project and MonitoredResource, which will write timeseries values via the provided service.
func (*StatusCounter) Create ¶
func (c *StatusCounter) Create() error
Create will create the custom HTTP response status count metric in Stackdriver.
func (*StatusCounter) Increment ¶
func (c *StatusCounter) Increment(counts map[string]int64) error
Increment will accumulate status code count deltas from the supplied map and write a new timeseries point.
func (*StatusCounter) ResetTime ¶
func (c *StatusCounter) ResetTime() time.Time
ResetTime returns the reset time of the counter metric (i.e. time since which counts have been accumulated).