monitoring

package
v0.0.0-...-8b49249 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2023 License: Apache-2.0 Imports: 13 Imported by: 15

Documentation

Overview

Package monitoring implements the functionality to export timeseries data to the Cloud Monitoring service.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	IncCounter(name string)
	NewCounter(name, desc string)
	AddLatency(name string, value float64)
	NewLatency(name, desc string)
}

Client interface provides basic functionality to create, record and retrieve metric values

type ExportingClient

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

ExportingClient represents a client that exports to Cloud Monitoring

func NewExportingClient

func NewExportingClient() *ExportingClient

NewExportingClient returns a client that can export to metrics to Cloud Monitoring.

func (*ExportingClient) AddLatency

func (m *ExportingClient) AddLatency(name string, value float64)

AddLatency adds a latency metric or does nothing if the client is nil.

func (*ExportingClient) EndExport

func (m *ExportingClient) EndExport(ctx context.Context)

EndExport must be called to ensure all metrics are exported

func (*ExportingClient) IncCounter

func (m *ExportingClient) IncCounter(name string)

IncCounter increases a counter metric or does nothing if the client is nil.

func (*ExportingClient) NewCounter

func (m *ExportingClient) NewCounter(name, description string)

NewCounter creates a new counter metrics or does nothing if the client is nil.

func (*ExportingClient) NewLatency

func (m *ExportingClient) NewLatency(name, description string)

NewLatency creates a new latency metrics or does nothing if the client is nil.

func (*ExportingClient) StartExport

func (m *ExportingClient) StartExport(ctx context.Context, cred string) error

StartExport metrics to the monitoring service roughly once a minute. It fetches metadata about the GCP environment and fails if not running on GCE or GKE.

Jump to

Keyboard shortcuts

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