metrics

package
v0.0.0-...-91b6c24 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 22, 2018 License: MIT Imports: 12 Imported by: 0

Documentation

Index

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 AttachExternalWatcher

func AttachExternalWatcher(endpointURL url.URL, metricsOptions MetricOptions, label string, interval time.Duration)

func PrometheusHandler

func PrometheusHandler() http.Handler

PrometheusHandler Bootstraps prometheus for metrics collection

func RegisterMetrics

func RegisterMetrics(metricsOptions MetricOptions)

RegisterMetrics registers with Prometheus for tracking

Types

type MetricOptions

type MetricOptions struct {
	GatewayFunctionInvocation *prometheus.CounterVec
	GatewayFunctionsHistogram *prometheus.HistogramVec
	ServiceReplicasCounter    *prometheus.GaugeVec
}

MetricOptions to be used by web handlers

func BuildMetricsOptions

func BuildMetricsOptions() MetricOptions

BuildMetricsOptions builds metrics for tracking functions in the API gateway

type PrometheusQuery

type PrometheusQuery struct {
	Port   int
	Host   string
	Client *http.Client
}

PrometheusQuery a PrometheusQuery

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 VectorQueryResponse

type VectorQueryResponse struct {
	Data struct {
		Result []struct {
			Metric struct {
				Code         string `json:"code"`
				FunctionName string `json:"function_name"`
			}
			Value []interface{} `json:"value"`
		}
	}
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL