sherpaprom

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2020 License: MIT Imports: 1 Imported by: 9

README

sherpaprom

Go package with a Prometheus [1] collector for Sherpa API's [2,3]. It provides a prometheus collector that implements interface Collector.

Read the godoc documentation at https://godoc.org/github.com/mjl-/sherpaprom

[1] Prometheus: https://prometheus.io/ [2] Sherpa protocol: https://www.ueber.net/who/mjl/sherpa/ [3] Sherpa Go package: https://github.com/mjl-/sherpa

LICENSE

Created by Mechiel Lukkien, originally at Irias, and released under an MIT-license, see LICENSE.md.

Documentation

Overview

Package sherpaprom provides a collector of statistics for incoming Sherpa requests that are exported over to Prometheus.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Collector

type Collector struct {
	// contains filtered or unexported fields
}

Collector implements the Collector interface from the sherpa package.

func NewCollector

func NewCollector(api string, reg prometheus.Registerer) (*Collector, error)

NewCollector creates a new collector for the named API. Metrics will be labeled with "api". The following prometheus metrics are automatically registered on reg, or the default prometheus registerer if reg is nil:

sherpa_requests_total
	calls, per function
sherpa_errors_total
	error responses, per function,code
sherpa_protocol_errors_total
	incorrect requests
sherpa_bad_function_total
	unknown functions called
sherpa_javascript_request_total
	requests to sherpa.js
sherpa_json_request_total
	requests to sherpa.json
sherpa_requests_duration_seconds
	histogram for .01, .05, .1, .2, .5, 1, 2, 4, 8, 16, per function

func (*Collector) BadFunction

func (c *Collector) BadFunction()

BadFunction increases counter "sherpa_bad_function_total" by one.

func (*Collector) FunctionCall

func (c *Collector) FunctionCall(name string, duration float64, errorCode string)

FunctionCall increases "sherpa_requests_total" by one, adds the call duration to "sherpa_requests_duration_seconds" and possibly increases "sherpa_error_total" and "sherpa_servererror_total".

func (*Collector) JSON

func (c *Collector) JSON()

JSON increases "sherpa_json_requests_total" by one.

func (*Collector) JavaScript

func (c *Collector) JavaScript()

JavaScript increases "sherpa_javascript_requests_total" by one.

func (*Collector) ProtocolError

func (c *Collector) ProtocolError()

ProtocolError increases counter "sherpa_protocol_errors_total" by one.

Jump to

Keyboard shortcuts

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