metrics

package
v0.0.0-...-88878d6 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2017 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddMetricsHandler

func AddMetricsHandler(handler http.HandlerFunc, host string, port int) 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 AttachSwarmWatcher

func AttachSwarmWatcher(dockerClient *client.Client, metricsOptions MetricOptions, label string)

AttachSwarmWatcher adds a go-route to monitor the amount of service replicas in the swarm matching a 'function' label.

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 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