metrics

package
v0.0.0-...-e560ebb Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2021 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Overview

Package metrics provides functions to emit ts_mon and bq metrics.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RecordBatchSize

func RecordBatchSize(ctx context.Context, numRequests int, schedulerID string, success bool)

RecordBatchSize records a metric about the number of requests handled within a batch.

func RecordProtoSize

func RecordProtoSize(ctx context.Context, bytes int, schedulerID string, protoType string)

RecordProtoSize records a metric about a given proto's size.

func RecordStateGaugeMetrics

func RecordStateGaugeMetrics(ctx context.Context, s *scheduler.Scheduler, schedulerID string)

RecordStateGaugeMetrics records general gauge metrics about the given state.

As new metrics are added, gauge metrics about a state should be emitted here. Because none of the metrics emitted herein are cumulative, it doesn't matter if this is called within a datastore transaction or not, or whether the transaction that called it succeeds.

Types

type Buffer

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

Buffer implements scheduler.EventSink.

Metrics are buffered so that they can be sent to bigquery and tsmon upon successful datastore transaction.

func NewBuffer

func NewBuffer(schedulerID string) *Buffer

NewBuffer creates a metrics sink for the given scheduler.

func (*Buffer) AddEvent

func (e *Buffer) AddEvent(event *metrics.TaskEvent)

AddEvent implements scheduler.EventSink.

func (*Buffer) FlushToBQ

func (e *Buffer) FlushToBQ(ctx context.Context) error

FlushToBQ flushes events to bigquery.

This can be called inside of a datastore transaction, in which case events will only be flushed if the transaction succeeds.

func (*Buffer) FlushToTsMon

func (e *Buffer) FlushToTsMon(ctx context.Context) error

FlushToTsMon flushes events to ts_mon.

func (*Buffer) WithFields

func (e *Buffer) WithFields(isCallback bool) scheduler.EventSink

WithFields implements scheduler.EventSink.

Jump to

Keyboard shortcuts

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