Documentation ¶
Index ¶
- func AddMetricsHandler(handler http.HandlerFunc, prometheusQuery PrometheusQueryFetcher) http.HandlerFunc
- func PrometheusHandler() http.Handler
- func RegisterExporter(exporter *Exporter)
- type Exporter
- type MetricOptions
- type PrometheusQuery
- type PrometheusQueryFetcher
- type ServiceMetricOptions
- type VectorQueryResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddMetricsHandler ¶
func AddMetricsHandler(handler http.HandlerFunc, prometheusQuery PrometheusQueryFetcher) http.HandlerFunc
AddMetricsHandler wraps a http.HandlerFunc with Prometheus metrics
func PrometheusHandler ¶
PrometheusHandler Bootstraps prometheus for metrics collection
func RegisterExporter ¶
func RegisterExporter(exporter *Exporter)
RegisterExporter registers with Prometheus for tracking
Types ¶
type Exporter ¶
type Exporter struct {
// contains filtered or unexported fields
}
Exporter is a prometheus exporter
func NewExporter ¶
func NewExporter(options MetricOptions, credentials *auth.BasicAuthCredentials) *Exporter
NewExporter creates a new exporter for the OpenFaaS gateway metrics
func (*Exporter) Collect ¶
func (e *Exporter) Collect(ch chan<- prometheus.Metric)
Collect collects data to be consumed by prometheus
func (*Exporter) Describe ¶
func (e *Exporter) Describe(ch chan<- *prometheus.Desc)
Describe is to describe the metrics for Prometheus
func (*Exporter) StartServiceWatcher ¶
func (e *Exporter) StartServiceWatcher(endpointURL url.URL, metricsOptions MetricOptions, label string, interval time.Duration)
StartServiceWatcher starts a ticker and collects service replica counts to expose to prometheus
type MetricOptions ¶
type MetricOptions struct { GatewayFunctionInvocation *prometheus.CounterVec GatewayFunctionsHistogram *prometheus.HistogramVec ServiceReplicasGauge *prometheus.GaugeVec ServiceMetrics *ServiceMetricOptions }
MetricOptions to be used by web handlers
func BuildMetricsOptions ¶
func BuildMetricsOptions() MetricOptions
BuildMetricsOptions builds metrics for tracking functions in the API gateway
type PrometheusQuery ¶
PrometheusQuery represents parameters for querying Prometheus
func NewPrometheusQuery ¶
func NewPrometheusQuery(host string, port int, client *http.Client) PrometheusQuery
NewPrometheusQuery create a NewPrometheusQuery
func (PrometheusQuery) Fetch ¶
func (q PrometheusQuery) Fetch(query string) (*VectorQueryResponse, error)
Fetch queries aggregated stats
type PrometheusQueryFetcher ¶
type PrometheusQueryFetcher interface {
Fetch(query string) (*VectorQueryResponse, error)
}
type ServiceMetricOptions ¶
type ServiceMetricOptions struct { Histogram *prometheus.HistogramVec Counter *prometheus.CounterVec }
ServiceMetricOptions provides RED metrics