function

package
Version: v0.0.0-...-f1c27b4 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2020 License: MIT Imports: 8 Imported by: 0

README

metrics

This function exposes metrics from Prometheus.

It queries Prometheus for a function's 2xx and non-2xx invocations count and returns a JSON response of type:

{
    "success": 10,
    "failure": 8
}

It takes function's name (i.e. myFunction [required]) and metrics_window (i.e. 24h [default: 60m] from a query and is invoked by GET request to http://gateway-url:8080/function/metrics?function=myFunction&metrics_window=24h

Note: If you're running the function on Swarm, you should update prometheus_host in gateway_config.yml to prometheus, i.e. removing the namespace suffix for Kubernetes.

Note: metrics function requires prometheus service to be up and running. If you scale down prometheus to 0, this will result in function invocation count not being updated and an error invoking metrics: Couldn't get metrics from Prometheus for function...

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Handle

func Handle(req []byte) string

Handle exposes the OpenFaaS instance metrics

Types

type Metrics

type Metrics struct {
	Success int `json:"success"`
	Failure int `json:"failure"`
}

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL