Documentation ¶
Overview ¶
Package octwirp provides opencensus metrics and tracing for twirp services
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
// PackageName is the twirp package
PackageName, _ = tag.NewKey("twirp.package")
// ServiceName is the twirp service
ServiceName, _ = tag.NewKey("twirp.service")
// MethodName is the twirp method
MethodName, _ = tag.NewKey("twirp.method")
// StatusCode is the twirp code
StatusCode, _ = tag.NewKey("twirp.status")
// ServerLatency measures server side latency
ServerLatency = stats.Float64(
"twirp/server/latency",
"End-to-end latency",
stats.UnitMilliseconds)
// ServerLatencyView measures the latency distribution of HTTP requests
ServerLatencyView = &view.View{
Name: "twirp/server/latency",
Description: "Latency distribution of HTTP requests",
Measure: ServerLatency,
Aggregation: ochttp.DefaultLatencyDistribution,
TagKeys: []tag.Key{PackageName, ServiceName, MethodName, StatusCode},
}
// ServerResponseView measures the server response count
ServerResponseView = &view.View{
Name: "twirp/server/response_count",
Description: "Server response count",
TagKeys: []tag.Key{PackageName, ServiceName, MethodName, StatusCode},
Measure: ServerLatency,
Aggregation: view.Count(),
}
// ClientRoundtripLatency measures end to end latency from the client perspective.
ClientRoundtripLatency = &view.View{
Name: "twirp/client/roundtrip_latency",
Measure: ochttp.ClientRoundtripLatency,
Aggregation: ochttp.DefaultLatencyDistribution,
Description: "End-to-end latency",
TagKeys: []tag.Key{PackageName, ServiceName, MethodName, ochttp.StatusCode},
}
)
Functions ¶
func WrapTransport ¶
func WrapTransport(base *ochttp.Transport) http.RoundTripper
WrapTransport wraps the ochttp transport to inject twirp metadata.
Types ¶
type Tracer ¶
type Tracer struct { Propagation propagation.HTTPFormat StartOptions trace.StartOptions }
Tracer adds Opencensus tracing and metrics to twirp servers.
func (*Tracer) ServerHooks ¶
func (t *Tracer) ServerHooks() *twirp.ServerHooks
ServerHooks creates twrip server hooks for Opencensus tracing and metrics.
Directories ¶
Path | Synopsis |
---|---|
examples
|
|
client
based on https://github.com/twitchtv/twirp/blob/337e90237d72193bf7f9fa387b5b9946436b7733/example/cmd/client/main.go Copyright 2018 Twitch Interactive, Inc.
|
based on https://github.com/twitchtv/twirp/blob/337e90237d72193bf7f9fa387b5b9946436b7733/example/cmd/client/main.go Copyright 2018 Twitch Interactive, Inc. |
Click to show internal directories.
Click to hide internal directories.