metrics

package
v1.4.3 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2019 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// APICounterOpts define the counter opts for server APIs
	APICounterOpts = metrics.CounterOpts{
		Namespace:  "api_request",
		Subsystem:  "",
		Name:       "count",
		Help:       "Number of requests made to an API",
		LabelNames: []string{"ca_name", "api_name", "status_code"},
		LabelHelp: map[string]string{
			"api_name":    "example api_names: affiliations/{affiliation}, affiliations, certificates, enroll, reenroll, gencrl, idemix/cri, identities, register, revoke, idemix/credential, identities/{id}. ",
			"status_code": "Http status code. https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html",
		},
		StatsdFormat: "%{#fqname}.%{ca_name}.%{api_name}.%{status_code}",
	}

	// APIDurationOpts define the duration opts for server APIs
	APIDurationOpts = metrics.HistogramOpts{
		Namespace:  "api_request",
		Subsystem:  "",
		Name:       "duration",
		Help:       "Time taken in seconds for the request to an API to be completed",
		LabelNames: []string{"ca_name", "api_name", "status_code"},
		LabelHelp: map[string]string{
			"api_name":    "example api_names: affiliations/{affiliation}, affiliations, certificates, enroll, reenroll, gencrl, idemix/cri, identities, register, revoke, idemix/credential, identities/{id}. ",
			"status_code": "Http status code. https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html",
		},
		StatsdFormat: "%{#fqname}.%{ca_name}.%{api_name}.%{status_code}",
	}
)

Functions

This section is empty.

Types

type Metrics

type Metrics struct {
	// APICounter keeps track of number of times an API endpoint is called
	APICounter metrics.Counter
	// APIDuration keeps track of time taken for request to complete for an API
	APIDuration metrics.Histogram
}

Metrics are the metrics tracked by server

Jump to

Keyboard shortcuts

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