Documentation
¶
Overview ¶
Package observability holds metrics and tracing recording implementations.
Index ¶
Constants ¶
View Source
const ( // ResultError is a shared result tag value for error. ResultError = "error" // ResultOK is a shared result tag value for success. ResultOK = "success" )
Variables ¶
View Source
var (
// KeyMethod is the tag used for marking method on a metric.
KeyMethod, _ = tag.NewKey("method")
// KeyResult is the tag used for marking result on a metric.
KeyResult, _ = tag.NewKey("result")
)
Functions ¶
func EnableTracing ¶ added in v0.9.0
func EnableTracing(enabled bool)
EnableTracing allows control over if tracing is enabled for the sdk. Default is false. This applies to all of the `github.com/cloudevents/sdk-go/...` package.
Types ¶
type Observable ¶
type Observable interface {
TraceName() string
MethodName() string
LatencyMs() *stats.Float64Measure
}
Observable represents the the customization used by the Reporter for a given measurement and trace for a single method.
type Reporter ¶
type Reporter interface {
Error()
OK()
}
Reporter represents a running latency counter and trace span. When Error or OK are called, the latency is calculated and the trace space is ended. Error or OK are only allowed to be called once.
func NewReporter ¶
NewReporter creates and returns a reporter wrapping the provided Observable, and injects a trace span into the context.
Click to show internal directories.
Click to hide internal directories.