Documentation ¶
Overview ¶
Package metrics provides Knative utilities for exporting metrics to Stackdriver backend or Prometheus backend based on config-observability settings.
Index ¶
- Constants
- func Buckets125(low, high float64) []float64
- func BucketsNBy10(low float64, n int) []float64
- func ConfigMapName() string
- func ConfigMapWatcher(component string, secrets SecretFetcher, logger *zap.SugaredLogger) func(*corev1.ConfigMap)
- func Domain() string
- func FlushExporter() bool
- func GetKnativeBrokerMonitoredResource(des *metricdata.Descriptor, tags map[string]string, gm *gcpMetadata) (map[string]string, monitoredresource.Interface)
- func GetKnativeRevisionMonitoredResource(des *metricdata.Descriptor, tags map[string]string, gm *gcpMetadata) (map[string]string, monitoredresource.Interface)
- func GetKnativeSourceMonitoredResource(des *metricdata.Descriptor, tags map[string]string, gm *gcpMetadata) (map[string]string, monitoredresource.Interface)
- func GetKnativeTriggerMonitoredResource(des *metricdata.Descriptor, tags map[string]string, gm *gcpMetadata) (map[string]string, monitoredresource.Interface)
- func MetricsOptionsToJson(opts *ExporterOptions) (string, error)
- func Record(ctx context.Context, ms stats.Measurement, ros ...stats.Options)
- func RecordBatch(ctx context.Context, mss ...stats.Measurement)
- func ResponseCodeClass(responseCode int) string
- func SetStackdriverSecretLocation(name string, namespace string)
- func UpdateExporter(ops ExporterOptions, logger *zap.SugaredLogger) error
- func UpdateExporterFromConfigMap(component string, logger *zap.SugaredLogger) func(configMap *corev1.ConfigMap)
- func UpdateExporterFromConfigMapWithOpts(opts ExporterOptions, logger *zap.SugaredLogger) (func(configMap *corev1.ConfigMap), error)
- type ClientProvider
- type ExporterOptions
- type Global
- type KnativeBroker
- type KnativeRevision
- type KnativeSource
- type KnativeTrigger
- type MemStatsProvider
- type ObservabilityConfig
- type ReflectorProvider
- func (rp *ReflectorProvider) DefaultViews() []*view.View
- func (rp *ReflectorProvider) ItemsInListView() *view.View
- func (rp *ReflectorProvider) ItemsInMatchView() *view.View
- func (rp *ReflectorProvider) ItemsInWatchView() *view.View
- func (rp *ReflectorProvider) LastResourceVersionView() *view.View
- func (rp *ReflectorProvider) ListDurationView() *view.View
- func (rp *ReflectorProvider) ListsView() *view.View
- func (rp *ReflectorProvider) NewItemsInListMetric(name string) cache.SummaryMetric
- func (rp *ReflectorProvider) NewItemsInMatchMetric(name string) cache.SummaryMetric
- func (rp *ReflectorProvider) NewItemsInWatchMetric(name string) cache.SummaryMetric
- func (rp *ReflectorProvider) NewLastResourceVersionMetric(name string) cache.GaugeMetric
- func (rp *ReflectorProvider) NewListDurationMetric(name string) cache.SummaryMetric
- func (rp *ReflectorProvider) NewListsMetric(name string) cache.CounterMetric
- func (rp *ReflectorProvider) NewShortWatchesMetric(name string) cache.CounterMetric
- func (rp *ReflectorProvider) NewWatchDurationMetric(name string) cache.SummaryMetric
- func (rp *ReflectorProvider) NewWatchesMetric(name string) cache.CounterMetric
- func (rp *ReflectorProvider) ShortWatchesView() *view.View
- func (rp *ReflectorProvider) WatchDurationView() *view.View
- func (rp *ReflectorProvider) WatchesView() *view.View
- type SecretFetcher
- type StackdriverClientConfig
- type WorkqueueProvider
- func (wp *WorkqueueProvider) AddsView() *view.View
- func (wp *WorkqueueProvider) DefaultViews() []*view.View
- func (wp *WorkqueueProvider) DepthView() *view.View
- func (wp *WorkqueueProvider) LatencyView() *view.View
- func (wp *WorkqueueProvider) LongestRunningProcessorSecondsView() *view.View
- func (wp *WorkqueueProvider) NewAddsMetric(name string) workqueue.CounterMetric
- func (wp *WorkqueueProvider) NewDeprecatedAddsMetric(name string) workqueue.CounterMetric
- func (wp *WorkqueueProvider) NewDeprecatedDepthMetric(name string) workqueue.GaugeMetric
- func (wp *WorkqueueProvider) NewDeprecatedLatencyMetric(name string) workqueue.SummaryMetric
- func (wp *WorkqueueProvider) NewDeprecatedLongestRunningProcessorMicrosecondsMetric(name string) workqueue.SettableGaugeMetric
- func (wp *WorkqueueProvider) NewDeprecatedRetriesMetric(name string) workqueue.CounterMetric
- func (wp *WorkqueueProvider) NewDeprecatedUnfinishedWorkSecondsMetric(name string) workqueue.SettableGaugeMetric
- func (wp *WorkqueueProvider) NewDeprecatedWorkDurationMetric(name string) workqueue.SummaryMetric
- func (wp *WorkqueueProvider) NewDepthMetric(name string) workqueue.GaugeMetric
- func (wp *WorkqueueProvider) NewLatencyMetric(name string) workqueue.HistogramMetric
- func (wp *WorkqueueProvider) NewLongestRunningProcessorSecondsMetric(name string) workqueue.SettableGaugeMetric
- func (wp *WorkqueueProvider) NewRetriesMetric(name string) workqueue.CounterMetric
- func (wp *WorkqueueProvider) NewUnfinishedWorkSecondsMetric(name string) workqueue.SettableGaugeMetric
- func (wp *WorkqueueProvider) NewWorkDurationMetric(name string) workqueue.HistogramMetric
- func (wp *WorkqueueProvider) RetriesView() *view.View
- func (wp *WorkqueueProvider) UnfinishedWorkSecondsView() *view.View
- func (wp *WorkqueueProvider) WorkDurationView() *view.View
Constants ¶
const ( // The following keys are used to configure metrics reporting. // See https://github.com/knative/serving/blob/master/config/config-observability.yaml // for details. AllowStackdriverCustomMetricsKey = "metrics.allow-stackdriver-custom-metrics" BackendDestinationKey = "metrics.backend-destination" ReportingPeriodKey = "metrics.reporting-period-seconds" StackdriverCustomMetricSubDomainKey = "metrics.stackdriver-custom-metrics-subdomain" // Stackdriver client configuration keys StackdriverProjectIDKey = "metrics.stackdriver-project-id" StackdriverGCPLocationKey = "metrics.stackdriver-gcp-location" StackdriverClusterNameKey = "metrics.stackdriver-cluster-name" StackdriverUseSecretKey = "metrics.stackdriver-use-secret" // Stackdriver is used for Stackdriver backend Stackdriver metricsBackend = "stackdriver" // Prometheus is used for Prometheus backend Prometheus metricsBackend = "prometheus" // OpenCensus is used to export to the OpenCensus Agent / Collector, // which can send to many other services. OpenCensus metricsBackend = "opencensus" // None is used to export, well, nothing. None metricsBackend = "none" CollectorAddressKey = "metrics.opencensus-address" CollectorSecureKey = "metrics.opencensus-require-tls" )
const ( // The following is used to set the default log url template DefaultLogURLTemplate = "" /* 212-byte string literal not displayed */ // The following is used to set the default metrics backend DefaultRequestMetricsBackend = "prometheus" // The env var name for config-observability ConfigMapNameEnv = "CONFIG_OBSERVABILITY_NAME" )
const ( // StackdriverSecretNamespaceDefault is the default namespace to search for a k8s Secret to pass to Stackdriver client to authenticate with Stackdriver. StackdriverSecretNamespaceDefault = "default" // StackdriverSecretNameDefault is the default name of the k8s Secret to pass to Stackdriver client to authenticate with Stackdriver. StackdriverSecretNameDefault = "stackdriver-service-account-key" )
const (
DomainEnv = "METRICS_DOMAIN"
)
Variables ¶
This section is empty.
Functions ¶
func Buckets125 ¶
Buckets125 generates an array of buckets with approximate powers-of-two buckets that also aligns with powers of 10 on every 3rd step. This can be used to create a view.Distribution.
func BucketsNBy10 ¶
BucketsNBy10 generates an array of N buckets starting from low and multiplying by 10 n times.
func ConfigMapName ¶
func ConfigMapName() string
ConfigMapName gets the name of the metrics ConfigMap
func ConfigMapWatcher ¶
func ConfigMapWatcher(component string, secrets SecretFetcher, logger *zap.SugaredLogger) func(*corev1.ConfigMap)
ConfigMapWatcher returns a helper func which updates the exporter configuration based on values in the supplied ConfigMap. This method captures a corev1.SecretLister which is used to configure mTLS with the opencensus agent.
func FlushExporter ¶
func FlushExporter() bool
FlushExporter waits for exported data to be uploaded. This should be called before the process shuts down or exporter is replaced. Return value indicates whether the exporter is flushable or not.
func GetKnativeBrokerMonitoredResource ¶
func GetKnativeBrokerMonitoredResource( des *metricdata.Descriptor, tags map[string]string, gm *gcpMetadata) (map[string]string, monitoredresource.Interface)
func GetKnativeRevisionMonitoredResource ¶
func GetKnativeRevisionMonitoredResource( des *metricdata.Descriptor, tags map[string]string, gm *gcpMetadata) (map[string]string, monitoredresource.Interface)
func GetKnativeSourceMonitoredResource ¶
func GetKnativeSourceMonitoredResource( des *metricdata.Descriptor, tags map[string]string, gm *gcpMetadata) (map[string]string, monitoredresource.Interface)
func GetKnativeTriggerMonitoredResource ¶
func GetKnativeTriggerMonitoredResource( des *metricdata.Descriptor, tags map[string]string, gm *gcpMetadata) (map[string]string, monitoredresource.Interface)
func MetricsOptionsToJson ¶
func MetricsOptionsToJson(opts *ExporterOptions) (string, error)
MetricsOptionsToJson converts a ExporterOptions to a json string.
func RecordBatch ¶
func RecordBatch(ctx context.Context, mss ...stats.Measurement)
RecordBatch stores the given Measurements from `mss` in the current metrics backend.
func ResponseCodeClass ¶
ResponseCodeClass converts an HTTP response code to a string representing its response code class. E.g., The response code class is "5xx" for response code 503.
func SetStackdriverSecretLocation ¶
SetStackdriverSecretLocation sets the name and namespace of the Secret that can be used to authenticate with Stackdriver. The Secret is only used if both: 1. This function has been explicitly called to set the name and namespace 2. Users set metricsConfig.stackdriverClientConfig.UseSecret to "true"
func UpdateExporter ¶
func UpdateExporter(ops ExporterOptions, logger *zap.SugaredLogger) error
UpdateExporter updates the exporter based on the given ExporterOptions. This is a thread-safe function. The entire series of operations is locked to prevent a race condition between reading the current configuration and updating the current exporter.
func UpdateExporterFromConfigMap ¶
func UpdateExporterFromConfigMap(component string, logger *zap.SugaredLogger) func(configMap *corev1.ConfigMap)
UpdateExporterFromConfigMap returns a helper func that can be used to update the exporter when a config map is updated. DEPRECATED: Callers should migrate to ConfigMapWatcher.
func UpdateExporterFromConfigMapWithOpts ¶
func UpdateExporterFromConfigMapWithOpts(opts ExporterOptions, logger *zap.SugaredLogger) (func(configMap *corev1.ConfigMap), error)
UpdateExporterFromConfigMapWithOpts returns a helper func that can be used to update the exporter when a config map is updated. opts.Component must be present. opts.ConfigMap must not be present as the value from the ConfigMap will be used instead.
Types ¶
type ClientProvider ¶
type ClientProvider struct { Latency *stats.Float64Measure Result *stats.Int64Measure }
ClientProvider implements the pattern of Kubernetes MetricProvider that may be used to produce suitable metrics for use with metrics.Register()
func (*ClientProvider) DefaultViews ¶
func (cp *ClientProvider) DefaultViews() []*view.View
DefaultViews returns a list of views suitable for passing to view.Register
func (*ClientProvider) LatencyView ¶
func (cp *ClientProvider) LatencyView() *view.View
LatencyView returns a view of the Latency metric.
func (*ClientProvider) NewLatencyMetric ¶
func (cp *ClientProvider) NewLatencyMetric() metrics.LatencyMetric
NewLatencyMetric implements MetricsProvider
func (*ClientProvider) NewResultMetric ¶
func (cp *ClientProvider) NewResultMetric() metrics.ResultMetric
NewResultMetric implements MetricsProvider
func (*ClientProvider) ResultView ¶
func (cp *ClientProvider) ResultView() *view.View
ResultView returns a view of the Result metric.
type ExporterOptions ¶
type ExporterOptions struct { // Domain is the metrics domain. e.g. "knative.dev". Must be present. // // Stackdriver uses the following format to construct full metric name: // <domain>/<component>/<metric name from View> // Prometheus uses the following format to construct full metric name: // <component>_<metric name from View> // Domain is actually not used if metrics backend is Prometheus. Domain string // Component is the name of the component that emits the metrics. e.g. // "activator", "queue_proxy". Should only contains alphabets and underscore. // Must be present. Component string // PrometheusPort is the port to expose metrics if metrics backend is Prometheus. // It should be between maxPrometheusPort and maxPrometheusPort. 0 value means // using the default 9090 value. If is ignored if metrics backend is not // Prometheus. PrometheusPort int // ConfigMap is the data from config map config-observability. Must be present. // See https://github.com/knative/serving/blob/master/config/config-observability.yaml // for details. ConfigMap map[string]string // A lister for Secrets to allow dynamic configuration of outgoing TLS client cert. Secrets SecretFetcher `json:"-"` }
ExporterOptions contains options for configuring the exporter.
func JsonToMetricsOptions ¶
func JsonToMetricsOptions(jsonOpts string) (*ExporterOptions, error)
JsonToMetricsOptions converts a json string of a ExporterOptions. Returns a non-nil ExporterOptions always.
type KnativeBroker ¶
type KnativeBroker struct { Project string Location string ClusterName string NamespaceName string BrokerName string }
func (*KnativeBroker) MonitoredResource ¶
func (kb *KnativeBroker) MonitoredResource() (resType string, labels map[string]string)
type KnativeRevision ¶
type KnativeRevision struct { Project string Location string ClusterName string NamespaceName string ServiceName string ConfigurationName string RevisionName string }
func (*KnativeRevision) MonitoredResource ¶
func (kr *KnativeRevision) MonitoredResource() (resType string, labels map[string]string)
type KnativeSource ¶
type KnativeSource struct { Project string Location string ClusterName string NamespaceName string SourceName string SourceResourceGroup string }
func (*KnativeSource) MonitoredResource ¶
func (ki *KnativeSource) MonitoredResource() (resType string, labels map[string]string)
type KnativeTrigger ¶
type KnativeTrigger struct { Project string Location string ClusterName string NamespaceName string TriggerName string BrokerName string TypeFilterAttribute string SourceFilterAttribute string }
func (*KnativeTrigger) MonitoredResource ¶
func (kt *KnativeTrigger) MonitoredResource() (resType string, labels map[string]string)
type MemStatsProvider ¶
type MemStatsProvider struct { // Alloc is bytes of allocated heap objects. // // This is the same as HeapAlloc (see below). Alloc *stats.Int64Measure // TotalAlloc is cumulative bytes allocated for heap objects. // // TotalAlloc increases as heap objects are allocated, but // unlike Alloc and HeapAlloc, it does not decrease when // objects are freed. TotalAlloc *stats.Int64Measure // Sys is the total bytes of memory obtained from the OS. // // Sys is the sum of the XSys fields below. Sys measures the // virtual address space reserved by the Go runtime for the // heap, stacks, and other internal data structures. It's // likely that not all of the virtual address space is backed // by physical memory at any given moment, though in general // it all was at some point. Sys *stats.Int64Measure // Lookups is the number of pointer lookups performed by the // runtime. // // This is primarily useful for debugging runtime internals. Lookups *stats.Int64Measure // Mallocs is the cumulative count of heap objects allocated. // The number of live objects is Mallocs - Frees. Mallocs *stats.Int64Measure // Frees is the cumulative count of heap objects freed. Frees *stats.Int64Measure // HeapAlloc is bytes of allocated heap objects. // // "Allocated" heap objects include all reachable objects, as // well as unreachable objects that the garbage collector has // not yet freed. Specifically, HeapAlloc increases as heap // objects are allocated and decreases as the heap is swept // and unreachable objects are freed. Sweeping occurs // incrementally between GC cycles, so these two processes // occur simultaneously, and as a result HeapAlloc tends to // change smoothly (in contrast with the sawtooth that is // typical of stop-the-world garbage collectors). HeapAlloc *stats.Int64Measure // HeapSys is bytes of heap memory obtained from the OS. // // HeapSys measures the amount of virtual address space // reserved for the heap. This includes virtual address space // that has been reserved but not yet used, which consumes no // physical memory, but tends to be small, as well as virtual // address space for which the physical memory has been // returned to the OS after it became unused (see HeapReleased // for a measure of the latter). // // HeapSys estimates the largest size the heap has had. HeapSys *stats.Int64Measure // HeapIdle is bytes in idle (unused) spans. // // Idle spans have no objects in them. These spans could be // (and may already have been) returned to the OS, or they can // be reused for heap allocations, or they can be reused as // stack memory. // // HeapIdle minus HeapReleased estimates the amount of memory // that could be returned to the OS, but is being retained by // the runtime so it can grow the heap without requesting more // memory from the OS. If this difference is significantly // larger than the heap size, it indicates there was a recent // transient spike in live heap size. HeapIdle *stats.Int64Measure // HeapInuse is bytes in in-use spans. // // In-use spans have at least one object in them. These spans // can only be used for other objects of roughly the same // size. // // HeapInuse minus HeapAlloc estimates the amount of memory // that has been dedicated to particular size classes, but is // not currently being used. This is an upper bound on // fragmentation, but in general this memory can be reused // efficiently. HeapInuse *stats.Int64Measure // HeapReleased is bytes of physical memory returned to the OS. // // This counts heap memory from idle spans that was returned // to the OS and has not yet been reacquired for the heap. HeapReleased *stats.Int64Measure // HeapObjects is the number of allocated heap objects. // // Like HeapAlloc, this increases as objects are allocated and // decreases as the heap is swept and unreachable objects are // freed. HeapObjects *stats.Int64Measure // StackInuse is bytes in stack spans. // // In-use stack spans have at least one stack in them. These // spans can only be used for other stacks of the same size. // // There is no StackIdle because unused stack spans are // returned to the heap (and hence counted toward HeapIdle). StackInuse *stats.Int64Measure // StackSys is bytes of stack memory obtained from the OS. // // StackSys is StackInuse, plus any memory obtained directly // from the OS for OS thread stacks (which should be minimal). StackSys *stats.Int64Measure // MSpanInuse is bytes of allocated mspan structures. MSpanInuse *stats.Int64Measure // MSpanSys is bytes of memory obtained from the OS for mspan // structures. MSpanSys *stats.Int64Measure // MCacheInuse is bytes of allocated mcache structures. MCacheInuse *stats.Int64Measure // MCacheSys is bytes of memory obtained from the OS for // mcache structures. MCacheSys *stats.Int64Measure // BuckHashSys is bytes of memory in profiling bucket hash tables. BuckHashSys *stats.Int64Measure // GCSys is bytes of memory in garbage collection metadata. GCSys *stats.Int64Measure // OtherSys is bytes of memory in miscellaneous off-heap // runtime allocations. OtherSys *stats.Int64Measure // NextGC is the target heap size of the next GC cycle. // // The garbage collector's goal is to keep HeapAlloc ≤ NextGC. // At the end of each GC cycle, the target for the next cycle // is computed based on the amount of reachable data and the // value of GOGC. NextGC *stats.Int64Measure // LastGC is the time the last garbage collection finished, as // nanoseconds since 1970 (the UNIX epoch). LastGC *stats.Int64Measure // PauseTotalNs is the cumulative nanoseconds in GC // stop-the-world pauses since the program started. // // During a stop-the-world pause, all goroutines are paused // and only the garbage collector can run. PauseTotalNs *stats.Int64Measure // NumGC is the number of completed GC cycles. NumGC *stats.Int64Measure // NumForcedGC is the number of GC cycles that were forced by // the application calling the GC function. NumForcedGC *stats.Int64Measure // GCCPUFraction is the fraction of this program's available // CPU time used by the GC since the program started. // // GCCPUFraction is expressed as a number between 0 and 1, // where 0 means GC has consumed none of this program's CPU. A // program's available CPU time is defined as the integral of // GOMAXPROCS since the program started. That is, if // GOMAXPROCS is 2 and a program has been running for 10 // seconds, its "available CPU" is 20 seconds. GCCPUFraction // does not include CPU time used for write barrier activity. // // This is the same as the fraction of CPU reported by // GODEBUG=gctrace=1. GCCPUFraction *stats.Float64Measure }
MemStatsProvider is used to expose metrics based on Go's runtime.MemStats. The fields below (and their comments) are a filtered list taken from Go's runtime.MemStats.
func NewMemStatsAll ¶
func NewMemStatsAll() *MemStatsProvider
NewMemStatsAll creates a new MemStatsProvider with stats for all of the supported Go runtime.MemStat fields.
func (*MemStatsProvider) DefaultViews ¶
func (msp *MemStatsProvider) DefaultViews() (views []*view.View)
DefaultViews returns a list of views suitable for passing to view.Register
type ObservabilityConfig ¶
type ObservabilityConfig struct { // EnableVarLogCollection specifies whether the logs under /var/log/ should be available // for collection on the host node by the fluentd daemon set. EnableVarLogCollection bool // LoggingURLTemplate is a string containing the logging url template where // the variable REVISION_UID will be replaced with the created revision's UID. LoggingURLTemplate string // RequestLogTemplate is the go template to use to shape the request logs. RequestLogTemplate string // EnableProbeRequestLog enables queue-proxy to write health check probe request logs. EnableProbeRequestLog bool // RequestMetricsBackend specifies the request metrics destination, e.g. Prometheus, // Stackdriver. "None" disables all backends. RequestMetricsBackend string // EnableProfiling indicates whether it is allowed to retrieve runtime profiling data from // the pods via an HTTP server in the format expected by the pprof visualization tool. EnableProfiling bool }
ObservabilityConfig contains the configuration defined in the observability ConfigMap. +k8s:deepcopy-gen=true
func NewObservabilityConfigFromConfigMap ¶
func NewObservabilityConfigFromConfigMap(configMap *corev1.ConfigMap) (*ObservabilityConfig, error)
NewObservabilityConfigFromConfigMap creates a ObservabilityConfig from the supplied ConfigMap
func (*ObservabilityConfig) DeepCopy ¶
func (in *ObservabilityConfig) DeepCopy() *ObservabilityConfig
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ObservabilityConfig.
func (*ObservabilityConfig) DeepCopyInto ¶
func (in *ObservabilityConfig) DeepCopyInto(out *ObservabilityConfig)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type ReflectorProvider ¶
type ReflectorProvider struct { ItemsInList *stats.Float64Measure // TODO(mattmoor): This is not in the latest version, so it will // be removed in a future version. ItemsInMatch *stats.Float64Measure ItemsInWatch *stats.Float64Measure LastResourceVersion *stats.Float64Measure ListDuration *stats.Float64Measure Lists *stats.Int64Measure ShortWatches *stats.Int64Measure WatchDuration *stats.Float64Measure Watches *stats.Int64Measure }
ReflectorProvider implements reflector.MetricsProvider and may be used with reflector.SetProvider to have metrics exported to the provided metrics.
func (*ReflectorProvider) DefaultViews ¶
func (rp *ReflectorProvider) DefaultViews() []*view.View
DefaultViews returns a list of views suitable for passing to view.Register
func (*ReflectorProvider) ItemsInListView ¶
func (rp *ReflectorProvider) ItemsInListView() *view.View
ItemsInListView returns a view of the ItemsInList metric.
func (*ReflectorProvider) ItemsInMatchView ¶
func (rp *ReflectorProvider) ItemsInMatchView() *view.View
ItemsInMatchView returns a view of the ItemsInMatch metric.
func (*ReflectorProvider) ItemsInWatchView ¶
func (rp *ReflectorProvider) ItemsInWatchView() *view.View
ItemsInWatchView returns a view of the ItemsInWatch metric.
func (*ReflectorProvider) LastResourceVersionView ¶
func (rp *ReflectorProvider) LastResourceVersionView() *view.View
LastResourceVersionView returns a view of the LastResourceVersion metric.
func (*ReflectorProvider) ListDurationView ¶
func (rp *ReflectorProvider) ListDurationView() *view.View
ListDurationView returns a view of the ListDuration metric.
func (*ReflectorProvider) ListsView ¶
func (rp *ReflectorProvider) ListsView() *view.View
ListsView returns a view of the Lists metric.
func (*ReflectorProvider) NewItemsInListMetric ¶
func (rp *ReflectorProvider) NewItemsInListMetric(name string) cache.SummaryMetric
NewItemsInListMetric implements MetricsProvider
func (*ReflectorProvider) NewItemsInMatchMetric ¶
func (rp *ReflectorProvider) NewItemsInMatchMetric(name string) cache.SummaryMetric
NewItemsInMatchMetric implements MetricsProvider
func (*ReflectorProvider) NewItemsInWatchMetric ¶
func (rp *ReflectorProvider) NewItemsInWatchMetric(name string) cache.SummaryMetric
NewItemsInWatchMetric implements MetricsProvider
func (*ReflectorProvider) NewLastResourceVersionMetric ¶
func (rp *ReflectorProvider) NewLastResourceVersionMetric(name string) cache.GaugeMetric
NewLastResourceVersionMetric implements MetricsProvider
func (*ReflectorProvider) NewListDurationMetric ¶
func (rp *ReflectorProvider) NewListDurationMetric(name string) cache.SummaryMetric
NewListDurationMetric implements MetricsProvider
func (*ReflectorProvider) NewListsMetric ¶
func (rp *ReflectorProvider) NewListsMetric(name string) cache.CounterMetric
NewListsMetric implements MetricsProvider
func (*ReflectorProvider) NewShortWatchesMetric ¶
func (rp *ReflectorProvider) NewShortWatchesMetric(name string) cache.CounterMetric
NewShortWatchesMetric implements MetricsProvider
func (*ReflectorProvider) NewWatchDurationMetric ¶
func (rp *ReflectorProvider) NewWatchDurationMetric(name string) cache.SummaryMetric
NewWatchDurationMetric implements MetricsProvider
func (*ReflectorProvider) NewWatchesMetric ¶
func (rp *ReflectorProvider) NewWatchesMetric(name string) cache.CounterMetric
NewWatchesMetric implements MetricsProvider
func (*ReflectorProvider) ShortWatchesView ¶
func (rp *ReflectorProvider) ShortWatchesView() *view.View
ShortWatchesView returns a view of the ShortWatches metric.
func (*ReflectorProvider) WatchDurationView ¶
func (rp *ReflectorProvider) WatchDurationView() *view.View
WatchDurationView returns a view of the WatchDuration metric.
func (*ReflectorProvider) WatchesView ¶
func (rp *ReflectorProvider) WatchesView() *view.View
WatchesView returns a view of the Watches metric.
type SecretFetcher ¶
SecretFetcher is a function (extracted from SecretNamespaceLister) for fetching a specific Secret. This avoids requiring global or namespace list in controllers.
type StackdriverClientConfig ¶
type StackdriverClientConfig struct { // ProjectID is the stackdriver project ID to which data is uploaded. // This is not necessarily the GCP project ID where the Kubernetes cluster is hosted. // Required when the Kubernetes cluster is not hosted on GCE. ProjectID string // GCPLocation is the GCP region or zone to which data is uploaded. // This is not necessarily the GCP location where the Kubernetes cluster is hosted. // Required when the Kubernetes cluster is not hosted on GCE. GCPLocation string // ClusterName is the cluster name with which the data will be associated in Stackdriver. // Required when the Kubernetes cluster is not hosted on GCE. ClusterName string // UseSecret is whether the credentials stored in a Kubernetes Secret should be used to // authenticate with Stackdriver. The Secret name and namespace can be specified by calling // metrics.SetStackdriverSecretLocation. // If UseSecret is false, Google Application Default Credentials // will be used (https://cloud.google.com/docs/authentication/production). UseSecret bool }
StackdriverClientConfig encapsulates the metadata required to configure a Stackdriver client.
func NewStackdriverClientConfigFromMap ¶
func NewStackdriverClientConfigFromMap(config map[string]string) *StackdriverClientConfig
NewStackdriverClientConfigFromMap creates a stackdriverClientConfig from the given map
type WorkqueueProvider ¶
type WorkqueueProvider struct { Adds *stats.Int64Measure Depth *stats.Int64Measure Latency *stats.Float64Measure UnfinishedWorkSeconds *stats.Float64Measure LongestRunningProcessorSeconds *stats.Float64Measure Retries *stats.Int64Measure WorkDuration *stats.Float64Measure }
WorkqueueProvider implements workqueue.MetricsProvider and may be used with workqueue.SetProvider to have metrics exported to the provided metrics.
func (*WorkqueueProvider) AddsView ¶
func (wp *WorkqueueProvider) AddsView() *view.View
AddsView returns a view of the Adds metric.
func (*WorkqueueProvider) DefaultViews ¶
func (wp *WorkqueueProvider) DefaultViews() []*view.View
DefaultViews returns a list of views suitable for passing to view.Register
func (*WorkqueueProvider) DepthView ¶
func (wp *WorkqueueProvider) DepthView() *view.View
DepthView returns a view of the Depth metric.
func (*WorkqueueProvider) LatencyView ¶
func (wp *WorkqueueProvider) LatencyView() *view.View
LatencyView returns a view of the Latency metric.
func (*WorkqueueProvider) LongestRunningProcessorSecondsView ¶
func (wp *WorkqueueProvider) LongestRunningProcessorSecondsView() *view.View
LongestRunningProcessorSecondsView returns a view of the LongestRunningProcessorSeconds metric.
func (*WorkqueueProvider) NewAddsMetric ¶
func (wp *WorkqueueProvider) NewAddsMetric(name string) workqueue.CounterMetric
NewAddsMetric implements MetricsProvider
func (*WorkqueueProvider) NewDeprecatedAddsMetric ¶
func (wp *WorkqueueProvider) NewDeprecatedAddsMetric(name string) workqueue.CounterMetric
NewDeprecatedAddsMetric implements MetricsProvider
func (*WorkqueueProvider) NewDeprecatedDepthMetric ¶
func (wp *WorkqueueProvider) NewDeprecatedDepthMetric(name string) workqueue.GaugeMetric
NewDeprecatedDepthMetric implements MetricsProvider
func (*WorkqueueProvider) NewDeprecatedLatencyMetric ¶
func (wp *WorkqueueProvider) NewDeprecatedLatencyMetric(name string) workqueue.SummaryMetric
NewDeprecatedLatencyMetric implements MetricsProvider
func (*WorkqueueProvider) NewDeprecatedLongestRunningProcessorMicrosecondsMetric ¶
func (wp *WorkqueueProvider) NewDeprecatedLongestRunningProcessorMicrosecondsMetric(name string) workqueue.SettableGaugeMetric
NewDeprecatedLongestRunningProcessorMicrosecondsMetric implements MetricsProvider
func (*WorkqueueProvider) NewDeprecatedRetriesMetric ¶
func (wp *WorkqueueProvider) NewDeprecatedRetriesMetric(name string) workqueue.CounterMetric
NewDeprecatedRetriesMetric implements MetricsProvider
func (*WorkqueueProvider) NewDeprecatedUnfinishedWorkSecondsMetric ¶
func (wp *WorkqueueProvider) NewDeprecatedUnfinishedWorkSecondsMetric(name string) workqueue.SettableGaugeMetric
NewDeprecatedUnfinishedWorkSecondsMetric implements MetricsProvider
func (*WorkqueueProvider) NewDeprecatedWorkDurationMetric ¶
func (wp *WorkqueueProvider) NewDeprecatedWorkDurationMetric(name string) workqueue.SummaryMetric
NewDeprecatedWorkDurationMetric implements MetricsProvider
func (*WorkqueueProvider) NewDepthMetric ¶
func (wp *WorkqueueProvider) NewDepthMetric(name string) workqueue.GaugeMetric
NewDepthMetric implements MetricsProvider
func (*WorkqueueProvider) NewLatencyMetric ¶
func (wp *WorkqueueProvider) NewLatencyMetric(name string) workqueue.HistogramMetric
NewLatencyMetric implements MetricsProvider
func (*WorkqueueProvider) NewLongestRunningProcessorSecondsMetric ¶
func (wp *WorkqueueProvider) NewLongestRunningProcessorSecondsMetric(name string) workqueue.SettableGaugeMetric
NewLongestRunningProcessorSecondsMetric implements MetricsProvider
func (*WorkqueueProvider) NewRetriesMetric ¶
func (wp *WorkqueueProvider) NewRetriesMetric(name string) workqueue.CounterMetric
NewRetriesMetric implements MetricsProvider
func (*WorkqueueProvider) NewUnfinishedWorkSecondsMetric ¶
func (wp *WorkqueueProvider) NewUnfinishedWorkSecondsMetric(name string) workqueue.SettableGaugeMetric
NewUnfinishedWorkSecondsMetric implements MetricsProvider
func (*WorkqueueProvider) NewWorkDurationMetric ¶
func (wp *WorkqueueProvider) NewWorkDurationMetric(name string) workqueue.HistogramMetric
NewWorkDurationMetric implements MetricsProvider
func (*WorkqueueProvider) RetriesView ¶
func (wp *WorkqueueProvider) RetriesView() *view.View
RetriesView returns a view of the Retries metric.
func (*WorkqueueProvider) UnfinishedWorkSecondsView ¶
func (wp *WorkqueueProvider) UnfinishedWorkSecondsView() *view.View
UnfinishedWorkSecondsView returns a view of the UnfinishedWorkSeconds metric.
func (*WorkqueueProvider) WorkDurationView ¶
func (wp *WorkqueueProvider) WorkDurationView() *view.View
WorkDurationView returns a view of the WorkDuration metric.
Source Files ¶
- client.go
- config.go
- config_observability.go
- doc.go
- exporter.go
- gcp_metadata.go
- memstats.go
- metrics.go
- monitored_resources.go
- monitored_resources_eventing.go
- monitored_resources_serving.go
- opencensus_exporter.go
- prometheus_exporter.go
- record.go
- reflector.go
- stackdriver_exporter.go
- utils.go
- workqueue.go
- zz_generated.deepcopy.go