stats

package
v0.0.0-...-010cea5 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2019 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// OCReportInterval is the interval for OpenCensus to send stats data to
	// Stackdriver Monitoring via its exporter.
	// NOTE: this value should not be no less than 1 minute. Detailes are in the doc.
	// https://cloud.google.com/monitoring/custom-metrics/creating-metrics#writing-ts
	OCReportInterval = 60 * time.Second

	// Measure namess for respecitive OpenCensus Measure
	LogSize     = "logsize"
	RedisStatus = "redis-status"

	// Units are used to define Measures of OpenCensus.
	ByteSizeUnit = "byte"
	StatusUnit   = "count"

	// ResouceNamespace is used for the exporter to have resource labels.
	ResourceNamespace = "sinmetal"
)

Variables

View Source
var (
	// Measure variables
	MLogSize     = stats.Int64(LogSize, "logSize", ByteSizeUnit)
	MStatusCount = stats.Int64(RedisStatus, "redis status", StatusUnit)

	RedisStatusCountView = &view.View{
		Name:        RedisStatus,
		Description: "status count",
		TagKeys:     []tag.Key{KeySource},
		Measure:     MStatusCount,
		Aggregation: view.Count(),
	}

	LogSizeView = &view.View{
		Name:        LogSize,
		Measure:     MLogSize,
		TagKeys:     []tag.Key{KeySource},
		Description: "log size",
		Aggregation: view.Sum(),
	}

	LogSizeViews = []*view.View{
		LogSizeView,
	}

	StatusViews = []*view.View{
		RedisStatusCountView,
	}

	// KeySource is the key for label in "generic_node",
	KeySource, _ = tag.NewKey("source")
)

Functions

func CountRedisStatus

func CountRedisStatus(ctx context.Context, id string) error

func GetMetricType

func GetMetricType(v *view.View) string

func InitExporter

func InitExporter(project string) *stackdriver.Exporter

func InitOpenCensusStats

func InitOpenCensusStats(exporter *stackdriver.Exporter)

func RecordMeasurement

func RecordMeasurement(id string, logSize int64) error

Types

type GenericNodeMonitoredResource

type GenericNodeMonitoredResource struct {
	Location    string
	NamespaceId string
	NodeId      string
}

func NewGenericNodeMonitoredResource

func NewGenericNodeMonitoredResource(location, namespace, node string) *GenericNodeMonitoredResource

func (*GenericNodeMonitoredResource) MonitoredResource

func (mr *GenericNodeMonitoredResource) MonitoredResource() (string, map[string]string)

Jump to

Keyboard shortcuts

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