bricks: Index | Files

package jsonapi

import ""

Package jsonapi implements the json api related metrics documented here:


Package Files



const (
    TypeRequest  = "req"
    TypeResponse = "resp"

func AddPaceAPIHTTPRequestDurationSeconds Uses

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

AddPaceAPIHTTPRequestDurationSeconds adds an observed value for the pace_api_http_request_duration_seconds histogram metric

func AddPaceAPIHTTPSizeBytes Uses

func AddPaceAPIHTTPSizeBytes(size float64, method, path, service, requestOrResponse string)

AddPaceAPIHTTPSizeBytes adds an observed value for the pace_api_http_size_bytes histogram metric.

func IncPaceAPIHTTPRequestTotal Uses

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

IncPaceAPIHTTPRequestTotal increments the pace_api_http_request_total counter metric

type Metric Uses

type Metric struct {
    // contains filtered or unexported fields

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

func NewMetric Uses

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) and collects the pace_api_http_size_bytes histogram metric.

func (*Metric) Write Uses

func (m *Metric) Write(p []byte) (int, error)

Write captures the length of the response body.

func (*Metric) WriteHeader Uses

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

Package jsonapi imports 7 packages (graph). Updated 2019-09-16. Refresh now. Tools for package owners.