Documentation ¶
Index ¶
- Constants
- Variables
- func CountSpannerStatus(ctx context.Context, id string, kind string) error
- func ExtractServerTimingValue(md metadata.MD) (int64, bool)
- func GFEMetricsStreamClientInterceptor() grpc.StreamClientInterceptor
- func GFEMetricsUnaryClientInterceptor() grpc.UnaryClientInterceptor
- func GetMetricType(v *view.View) string
- func InitExporter(project string, location string, namespace string, node string, ...) *stackdriver.Exporter
- func InitOpenCensusStats(exporter *stackdriver.Exporter) error
- type AppRunnner
- type GenericNodeMonitoredResource
- type Runnner
Constants ¶
View Source
const ( MetricsKindOK = "OK" MetricsKindNG = "NG" MetricsKindTimeout = "TIMEOUT" )
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 (
// KeySource is the key for label in "generic_node",
KeySource, _ = tag.NewKey("source")
KeyKind, _ = tag.NewKey("kind")
// 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, KeyKind},
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,
}
)
Functions ¶
func CountSpannerStatus ¶
func GFEMetricsStreamClientInterceptor ¶
func GFEMetricsStreamClientInterceptor() grpc.StreamClientInterceptor
GFEMetricsStreamClientInterceptor is server-timing をログ出力する https://medium.com/google-cloud/use-gfe-server-timing-header-in-cloud-spanner-debugging-d7d891a50642
func GFEMetricsUnaryClientInterceptor ¶
func GFEMetricsUnaryClientInterceptor() grpc.UnaryClientInterceptor
GFEMetricsUnaryClientInterceptor is server-timing をログ出力する https://medium.com/google-cloud/use-gfe-server-timing-header-in-cloud-spanner-debugging-d7d891a50642
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
Types ¶
type AppRunnner ¶
type AppRunnner struct {
// contains filtered or unexported fields
}
func NewAppRunner ¶
func NewAppRunner(ctx context.Context, ratePerSec int, parallelism int) *AppRunnner
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.