Documentation ¶
Index ¶
- Constants
- Variables
- func CountRedisStatus(ctx context.Context, id string) error
- func CountSpannerStatus(ctx context.Context, id string) error
- func GetMetricType(v *view.View) string
- func InitExporter(project string, location string, namespace string, node string, ...) *stackdriver.Exporter
- func InitOpenCensusStats(exporter *stackdriver.Exporter) error
- func RecordMeasurement(id string, logSize int64) error
- type GenericNodeMonitoredResource
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" SpannerStatus = "spanner-status" // Units are used to define Measures of OpenCensus. ByteSizeUnit = "byte" CountUnit = "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) MRedisStatusCount = stats.Int64(RedisStatus, "redis status", CountUnit) MSpannerStatusCount = stats.Int64(SpannerStatus, "spanner status", CountUnit) RedisStatusCountView = &view.View{ Name: RedisStatus, Description: "redis status count", TagKeys: []tag.Key{KeySource}, Measure: MRedisStatusCount, Aggregation: view.Count(), } SpannerStatusCountView = &view.View{ Name: SpannerStatus, Description: "spanner status count", TagKeys: []tag.Key{KeySource}, Measure: MSpannerStatusCount, 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, SpannerStatusCountView, } // KeySource is the key for label in "generic_node", KeySource, _ = tag.NewKey("source") )
Functions ¶
func GetMetricType ¶
func InitExporter ¶
func InitExporter(project string, location string, namespace string, node string, labels *stackdriver.Labels) *stackdriver.Exporter
func InitOpenCensusStats ¶
func InitOpenCensusStats(exporter *stackdriver.Exporter) error
func RecordMeasurement ¶
Types ¶
type GenericNodeMonitoredResource ¶
func NewGenericNodeMonitoredResource ¶
func NewGenericNodeMonitoredResource(location, namespace, node string) *GenericNodeMonitoredResource
func (*GenericNodeMonitoredResource) MonitoredResource ¶
func (mr *GenericNodeMonitoredResource) MonitoredResource() (string, map[string]string)
Click to show internal directories.
Click to hide internal directories.