Documentation ¶
Overview ¶
Package ocworkqueue contains support for extracting workqueue metrics with OpenCensus.
Example ¶
package main import ( "github.com/0xRLG/ocworkqueue" "go.opencensus.io/stats/view" "k8s.io/client-go/util/workqueue" ) func main() { // You must register the views to collect data. view.Register(ocworkqueue.DefaultViews...) // Register the metrics provider before you create the queue. workqueue.SetProvider(ocworkqueue.MetricsProvider()) q := workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "test_queue") // use the queue _ = q }
Output:
Index ¶
Examples ¶
Constants ¶
const (
NameAttribute = "k8s.client-go.workqueue.name"
)
Variables ¶
var ( QueueDepth = stats.Int64("opencensus.io/k8s/client-go/workqueue/depth", "Current depth of the workqueue", stats.UnitDimensionless) QueueAdds = stats.Int64("opencensus.io/k8s/client-go/workqueue/adds", "Total number of items added to the queue", stats.UnitDimensionless) QueueLatency = stats.Float64("opencensus.io/k8s/client-go/workqueue/latency", "How long an item stays in a workqueue", stats.UnitMilliseconds) QueueWorkDuration = stats.Float64("opencensus.io/k8s/client-go/workqueue/work_duration", "How long processing an item from a workqueue takes", stats.UnitMilliseconds) QueueRetries = stats.Int64("opencensus.io/k8s/client-go/workqueue/retries", "Total number of items re-added to the workqueue", stats.UnitDimensionless) )
This package provides the following Measures for use in custom views.
var ( QueueDepthView = &view.View{ Name: "opencensus.io/k8s/client-go/workqueue/depth", Description: "Sum of items in the queue", Measure: QueueDepth, TagKeys: []tag.Key{Name}, Aggregation: view.Sum(), } QueueAddsView = &view.View{ Name: "opencensus.io/k8s/client-go/workqueue/adds", Description: "Sum of items added to the queue", Measure: QueueAdds, TagKeys: []tag.Key{Name}, Aggregation: view.Sum(), } QueueLatencyView = &view.View{ Name: "opencensus.io/k8s/client-go/workqueue/latency", Description: "Distribution of how long items stay in the workqueue", Measure: QueueLatency, TagKeys: []tag.Key{Name}, Aggregation: DefaultMillisecondsDistribution, } QueueWorkDurationView = &view.View{ Name: "opencensus.io/k8s/client-go/workqueue/workduration", Description: "Distribution of how long items take to be processed", Measure: QueueWorkDuration, TagKeys: []tag.Key{Name}, Aggregation: DefaultMillisecondsDistribution, } QueueRetriesView = &view.View{ Name: "opencensus.io/k8s/client-go/workqueue/retries", Description: "Sum of items re-added to the workqueue", Measure: QueueRetries, TagKeys: []tag.Key{Name}, Aggregation: view.Sum(), } )
This package provides the following convenience views. You must register views before any data is collected.
var DefaultMillisecondsDistribution = view.Distribution(0, 0.01, 0.05, 0.1, 0.3, 0.6, 0.8, 1, 2, 3, 4, 5, 6, 8, 10, 13, 16, 20, 25, 30, 40, 50, 65, 80, 100, 130, 160, 200, 250, 300, 400, 500, 650, 800, 1000, 2000, 5000, 10000, 20000, 50000, 100000)
The default distributions used by the views in this package.
var DefaultViews = []*view.View{ QueueDepthView, QueueAddsView, QueueLatencyView, QueueWorkDurationView, QueueRetriesView, }
DefaultViews are the default metrics exported by this package.
var (
Name, _ = tag.NewKey(NameAttribute)
)
Name tag is determined by the name the queue is given when created.
Functions ¶
func MetricsProvider ¶
func MetricsProvider() workqueue.MetricsProvider
MetricsProvider returns an implementation of the workqueue metrics provider backed by opencensus measurements. This provider works with all of the metrics that the workqueue can export (Depth,Adds,Latency,WorkDuration,Retries)
You must register the views before any data is collected.
Types ¶
This section is empty.