jsonapi

package
v0.1.10 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2019 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package jsonapi implements the json api related metrics documented here: https://lab.jamit.de/pace/web/meta/wikis/concept/metrics#m2-microservice-any-pace-microservice

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddPaceAPIHTTPRequestDurationSeconds

func AddPaceAPIHTTPRequestDurationSeconds(duration float64, method, path, service string)

AddPaceAPIHTTPRequestDurationSeconds adds an observed value for the pace_api_http_request_duration_seconds histogram metric

func IncPaceAPIHTTPRequestTotal

func IncPaceAPIHTTPRequestTotal(code, method, path, service, clientID string)

IncPaceAPIHTTPRequestTotal increments the pace_api_http_request_total counter metric

Types

type Metric

type Metric struct {
	http.ResponseWriter
	// contains filtered or unexported fields
}

Metric is an http.ResponseWriter implementing metrics collector because the metrics depend on the http StatusCode.

func NewMetric

func NewMetric(serviceName, path string, w http.ResponseWriter, r *http.Request) *Metric

NewMetric creates a new metric collector (per request) with given service and path (pattern! not the request path)

func (*Metric) WriteHeader

func (m *Metric) WriteHeader(statusCode int)

WriteHeader captures the status code for metric submission and collects the pace_api_http_request_total counter and pace_api_http_request_duration_seconds histogram metric

Jump to

Keyboard shortcuts

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