Version: v0.8.5 Latest Latest

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

Go to latest
Published: Sep 1, 2022 License: MIT Imports: 6 Imported by: 0




This section is empty.


This section is empty.


This section is empty.


type Data

type Data struct {
	// for SDK.Metric
	MetricGroup string
	MetricType  string
	Labels      map[string]string

	// for SDK.Point
	Data      interface{} // required
	EndTime   time.Time   // required
	StartTime time.Time

	MetricKind      MetricKind
	ValueType       ValueType
	Resource        *Resource
	ForceSendFields []string
	NullFields      []string

Data is data struct for SDK.TimeSeries data.

func (*Data) TimeSeriesList

func (d *Data) TimeSeriesList(commonResource ...*Resource) ([]*SDK.TimeSeries, error)

TimeSeriesList converts Data to TimeSeries.

type MetricKind

type MetricKind string

MetricKind is wrapper struct for Monitoring MetricKind.

const (
	MetricKindDefault    MetricKind = "METRIC_KIND_UNSPECIFIED"
	MetricKindGauge      MetricKind = "GAUGE"
	MetricKindDelta      MetricKind = "DELTA"
	MetricKindCumulative MetricKind = "CUMULATIVE"

MetricKind list

type Monitor

type Monitor struct {
	// contains filtered or unexported fields

Monitor repesents stackdriver monitoring.

func NewMonitor

func NewMonitor(conf config.Config, projectID string) (*Monitor, error)

NewMonitor returns initialized *Monitor

func (*Monitor) Add

func (m *Monitor) Add(data Data) error

Add adds the timeseries to write spool.

func (*Monitor) Create

func (m *Monitor) Create(data Data) error

Create sends custom metric data to stackdriver.

func (*Monitor) CreateTimeSeriesRequest

func (m *Monitor) CreateTimeSeriesRequest(tsList []*SDK.TimeSeries) *SDK.CreateTimeSeriesRequest

CreateTimeSeriesRequest creates *SDK.TimeSeries from WriteData.

func (*Monitor) Errorf

func (m *Monitor) Errorf(format string, v ...interface{})

Errorf logging error information.

func (*Monitor) FlushAll

func (m *Monitor) FlushAll() error

FlushAll executes TimeSeries.Create operation from the write spool.

func (*Monitor) SetCommonForceFields

func (m *Monitor) SetCommonForceFields(fields []string)

SetCommonForceFields sets common FourceSendsFields.

func (*Monitor) SetCommonNullFields

func (m *Monitor) SetCommonNullFields(fields []string)

SetCommonNullFields sets common NullFields.

func (*Monitor) SetCommonResource

func (m *Monitor) SetCommonResource(r *Resource)

SetCommonResource sets common Resource.

func (*Monitor) SetLogger added in v0.5.0

func (m *Monitor) SetLogger(l log.Logger)

SetLogger sets internal API logger.

type Resource

type Resource struct {
	Labels          map[string]string `json:"labels,omitempty"`
	Type            string            `json:"type,omitempty"`
	ForceSendFields []string          `json:"-"`
	NullFields      []string          `json:"-"`

Resource is wrapper struct for SDK.MonitoredResource.

type ValueType

type ValueType string

ValueType is wrapper struct for Monitoring ValueType.

const (
	ValueTypeDefault      ValueType = "VALUE_TYPE_UNSPECIFIED"
	ValueTypeBool         ValueType = "BOOL" // for GAUGE
	ValueTypeInt64        ValueType = "INT64"
	ValueTypeDouble       ValueType = "DOUBLE"
	ValueTypeString       ValueType = "STRING" // for GAUGE
	ValueTypeDistribution ValueType = "DISTRIBUTION"
	ValueTypeMoney        ValueType = "MONEY"

ValueType list

Jump to

Keyboard shortcuts

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