Documentation
¶
Index ¶
- Constants
- Variables
- func NewAdminAPIAddressProvider(cl client.Client) *adminAPIAddressProvider
- func NewEnricher(logger logr.Logger, dataplane *operatorv1beta1.DataPlane, cl client.Client, ...) (metricsEnricher, error)
- type AdminAPIAddressProvider
- type DiscoveredAdminAPI
- type HistogramCollector
- type HistogramPassthroughMetric
- type Manager
- func (msm *Manager) Add(cp *gwtypes.ControlPlane, pipeline MetricsScrapePipeline) bool
- func (msm *Manager) NotifyAdd(ctx context.Context, cp *gwtypes.ControlPlane)
- func (msm *Manager) NotifyRemove(ctx context.Context, cp types.NamespacedName)
- func (msm *Manager) RemoveForControlPlaneNN(cpNN types.NamespacedName)
- func (msm *Manager) Start(ctx context.Context) error
- type Metrics
- type MetricsConsumer
- type MetricsEnricher
- type MetricsScrapePipeline
- type MetricsScraper
- type PrometheusMetricsScraper
Constants ¶
const ( // KongMetricTagK8sName is the tag set on Kong Services in the Admin API // configuration to indicate the name of the Kubernetes Service associated // with the Kong Service. KongMetricTagK8sName = "k8s-name" // KongMetricTagK8sNamespace is the tag set on Kong Services in the Admin API // configuration to indicate the namespace of the Kubernetes Service associated // with the Kong Service. KongMetricTagK8sNamespace = "k8s-namespace" )
const (
// KongMetricNameKongUpstreamLatencyMs is the name of the kong_upstream_latency_ms metric.
KongMetricNameKongUpstreamLatencyMs = "kong_upstream_latency_ms"
)
Variables ¶
var KongUpstreamLatencyMsHistogram = &HistogramCollector{ Name: KongMetricNameKongUpstreamLatencyMs, Help: "Provides kong_upstream_latency_ms histogram enriched with dataplane metadata", Metrics: make(map[adminAPIEndpointURL]prometheus.Metric), }
KongUpstreamLatencyMsHistogram is a prometheus.Collector that collects kong_upstream_latency_ms histograms.
Functions ¶
func NewAdminAPIAddressProvider ¶
NewAdminAPIAddressProvider creates a new AdminAPIAddressProvider.
func NewEnricher ¶
func NewEnricher( logger logr.Logger, dataplane *operatorv1beta1.DataPlane, cl client.Client, certs certs, adminAPIAddressProvider AdminAPIAddressProvider, ) (metricsEnricher, error)
NewEnricher creates a new MetricsEnricher.
Types ¶
type AdminAPIAddressProvider ¶
type AdminAPIAddressProvider interface {
AdminAddressesForDP(ctx context.Context, dataplane *operatorv1beta1.DataPlane) ([]string, error)
}
AdminAPIAddressProvider is an interface for providing the admin API addresses for a DataPlane.
type DiscoveredAdminAPI ¶
type DiscoveredAdminAPI struct { // Address is the Admin API's URL reachable from within the cluster. Address string }
DiscoveredAdminAPI represents an Admin API discovered from a Kubernetes Service.
type HistogramCollector ¶
type HistogramCollector struct { Name string Help string Metrics map[adminAPIEndpointURL]prometheus.Metric // contains filtered or unexported fields }
HistogramCollector is a prometheus.Collector that collects histograms.
func (*HistogramCollector) Collect ¶
func (m *HistogramCollector) Collect(ch chan<- prometheus.Metric)
Collect implements prometheus.Collector.
func (*HistogramCollector) Describe ¶
func (m *HistogramCollector) Describe(ch chan<- *prometheus.Desc)
Describe implements prometheus.Collector.
func (*HistogramCollector) Observe ¶
func (m *HistogramCollector) Observe(metric *dto.Metric, dataplaneURL adminAPIEndpointURL)
Observe observes a metric for a given dataplaneURL.
type HistogramPassthroughMetric ¶
HistogramPassthroughMetric is a prometheus.Metric that passes through a dto.Metric. It allows observing whole histograms and not observing individual data points like it's done with prometheus.HistogramVec.
func (*HistogramPassthroughMetric) Desc ¶
func (m *HistogramPassthroughMetric) Desc() *prometheus.Desc
Desc implements prometheus.Metric.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager is a manager for metrics scrapers.
func NewManager ¶
func NewManager( logger logr.Logger, interval time.Duration, cl client.Client, caSecretNN types.NamespacedName, clusterCAKeyConfig secrets.KeyConfig, ) *Manager
NewManager creates new MetricsScrapeManager.
func (*Manager) Add ¶
func (msm *Manager) Add(cp *gwtypes.ControlPlane, pipeline MetricsScrapePipeline) bool
Add adds a scraper to the manager for the given ControlPlane. If a scraper already exists for the given DataPlane UID, it is replaced. User is responsible for ensuring that the scraper is configured for DataPlane that is associated with the given ControlPlane. It returns true if the scraper was added.
func (*Manager) NotifyAdd ¶
func (msm *Manager) NotifyAdd(ctx context.Context, cp *gwtypes.ControlPlane)
NotifyAdd notifies the manager that a new ControlPlane has been added.
func (*Manager) NotifyRemove ¶
func (msm *Manager) NotifyRemove(ctx context.Context, cp types.NamespacedName)
NotifyRemove notifies the manager that a ControlPlane has been removed. It uses the ControlPlane's NamespacedName to identify the ControlPlane because the ControlPlane object is already deleted when this method is called.
func (*Manager) RemoveForControlPlaneNN ¶
func (msm *Manager) RemoveForControlPlaneNN(cpNN types.NamespacedName)
RemoveForControlPlaneNN removes a scraper from the manager for the given ControlPlane.
type Metrics ¶
type Metrics struct {
// contains filtered or unexported fields
}
Metrics represents a collection of metrics scraped from a DataPlane.
type MetricsConsumer ¶
MetricsConsumer is an interface for consumers of metrics scraped by a MetricsScraper.
type MetricsEnricher ¶
MetricsEnricher consumes Metrics and enriches them with Kubernetes metadata.
type MetricsScrapePipeline ¶
type MetricsScrapePipeline interface { MetricsScraper MetricsEnricher }
MetricsScrapePipeline is a pipeline for scraping and enriching metrics.
type MetricsScraper ¶
type MetricsScraper interface { Scrape(ctx context.Context) (Metrics, error) DataPlaneUID() types.UID }
MetricsScraper is an interface for a scraper that scrapes metrics from a DataPlane.
func NewPrometheusMetricsScraper ¶
func NewPrometheusMetricsScraper( logger logr.Logger, dp *operatorv1beta1.DataPlane, httpClient *http.Client, adminAPIAddrProvider AdminAPIAddressProvider, ) MetricsScraper
NewPrometheusMetricsScraper creates a new PrometheusMetricsScraper that scrapes metrics from the Admin API endpoints of the provided DataPlane.
type PrometheusMetricsScraper ¶
type PrometheusMetricsScraper struct {
// contains filtered or unexported fields
}
PrometheusMetricsScraper is a MetricsScraper that scrapes Prometheus metrics from the Admin API endpoint of provided DataPlane.
func (*PrometheusMetricsScraper) DataPlaneUID ¶
func (p *PrometheusMetricsScraper) DataPlaneUID() types.UID
DataPlaneUID returns the UID of the DataPlane this scraper is scraping metrics for.