Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultNameNormalizer = &SimpleNameNormalizer{ SafeSets: []SafeCharacterSet{ &Range{From: 'a', To: 'z'}, &Range{From: 'A', To: 'Z'}, &Range{From: '0', To: '9'}, &Char{'_'}, &Char{'/'}, &Char{'.'}, }, Replacement: '_', }
DefaultNameNormalizer converts endpoint names so that they contain only characters from the safe charset [a-zA-Z0-9./_]. All other characters are replaced with '_'.
Functions ¶
This section is empty.
Types ¶
type Metrics ¶
type Metrics struct { // RequestCountSuccess is a counter of the total number of successes. RequestCountSuccess metrics.Counter `metric:"requests" tags:"error=false"` // RequestCountFailures is a counter of the number of times any failure has been observed. RequestCountFailures metrics.Counter `metric:"requests" tags:"error=true"` // RequestLatencySuccess is a latency histogram of successful requests. RequestLatencySuccess metrics.Timer `metric:"request_latency" tags:"error=false"` // RequestLatencyFailures is a latency histogram of failed requests. RequestLatencyFailures metrics.Timer `metric:"request_latency" tags:"error=true"` // HTTPStatusCode2xx is a counter of the total number of requests with HTTP status code 200-299 HTTPStatusCode2xx metrics.Counter `metric:"http_requests" tags:"status_code=2xx"` // HTTPStatusCode3xx is a counter of the total number of requests with HTTP status code 300-399 HTTPStatusCode3xx metrics.Counter `metric:"http_requests" tags:"status_code=3xx"` // HTTPStatusCode4xx is a counter of the total number of requests with HTTP status code 400-499 HTTPStatusCode4xx metrics.Counter `metric:"http_requests" tags:"status_code=4xx"` // HTTPStatusCode5xx is a counter of the total number of requests with HTTP status code 500-599 HTTPStatusCode5xx metrics.Counter `metric:"http_requests" tags:"status_code=5xx"` }
Metrics is a collection of metrics for an endpoint describing throughput, success, errors, and performance.
type MetricsByEndpoint ¶
type MetricsByEndpoint struct {
// contains filtered or unexported fields
}
MetricsByEndpoint is a registry/cache of metrics for each unique endpoint name. Only maxNumberOfEndpoints Metrics are stored, all other endpoint names are mapped to a generic endpoint name "other".
type NameNormalizer ¶
NameNormalizer is used to convert the endpoint names to strings that can be safely used as tags in the metrics.
type Observer ¶
type Observer struct {
// contains filtered or unexported fields
}
Observer is an observer that can emit RPC metrics.
func NewObserver ¶
func NewObserver(metricsFactory metrics.Factory, normalizer NameNormalizer) *Observer
NewObserver creates a new observer that can emit RPC metrics.
func (*Observer) OnEnd ¶
func (o *Observer) OnEnd(sp sdktrace.ReadOnlySpan)
type SafeCharacterSet ¶
SafeCharacterSet determines if the given character is "safe"
type SimpleNameNormalizer ¶
type SimpleNameNormalizer struct { SafeSets []SafeCharacterSet Replacement byte }
SimpleNameNormalizer uses a set of safe character sets.
func (*SimpleNameNormalizer) Normalize ¶
func (n *SimpleNameNormalizer) Normalize(name string) string
Normalize checks each character in the string against SafeSets, and if it's not safe substitutes it with Replacement.