Documentation ¶
Overview ¶
Package observability provides tools for working with open census.
Index ¶
- Constants
- Variables
- func APITagKeys() []tag.Key
- func CommonTagKeys() []tag.Key
- func RecordLatency(ctx context.Context, start time.Time, m *stats.Float64Measure, ...)
- func ResultError(result string) tag.Mutator
- func ResultNotOK() tag.Mutator
- func ResultOK() tag.Mutator
- func WithBuildInfo(octx context.Context) context.Context
- func WithRealmID(octx context.Context, realmID uint64) context.Context
Constants ¶
View Source
const (
MetricRoot = "en-verification-server"
)
Variables ¶
View Source
var ( BuildIDTagKey = tag.MustNewKey("build_id") BuildTagTagKey = tag.MustNewKey("build_tag") KnativeServiceTagKey = tag.MustNewKey("k_service") KnativeRevisionTagKey = tag.MustNewKey("k_revision") KnativeConfigurationTagKey = tag.MustNewKey("k_configuration") RealmTagKey = tag.MustNewKey("realm") // ResultTagKey contains a free format text describing the result of the // request. Preferably ALL CAPS WITH UNDERSCORE. // OK indicating a successful request. // You can losely base this string on // https://github.com/googleapis/googleapis/blob/master/google/rpc/code.proto // but feel free to use any text as long as it's easy to filter. ResultTagKey = tag.MustNewKey("result") )
View Source
var ( // BlameNone indicate no API failure BlameNone = tag.Upsert(blameTagKey, "NONE") // BlameClient indicate the client is at fault (e.g. invalid request) BlameClient = tag.Upsert(blameTagKey, "CLIENT") // BlameServer indicate the server is at fault BlameServer = tag.Upsert(blameTagKey, "SERVER") // BlameExternal indicate some third party is at fault BlameExternal = tag.Upsert(blameTagKey, "EXTERNAL") // BlameUnknown can be used for everything else BlameUnknown = tag.Upsert(blameTagKey, "UNKNOWN") )
Functions ¶
func APITagKeys ¶ added in v0.12.0
APITagKeys return a slice of tag.Key with common tag keys + additional API specific tag keys.
func CommonTagKeys ¶ added in v0.11.0
CommonTagKeys returns the slice of common tag keys that should used in all views.
func RecordLatency ¶ added in v0.16.0
func RecordLatency(ctx context.Context, start time.Time, m *stats.Float64Measure, mutators ...*tag.Mutator)
RecordLatency calculate and record the latency. Usage example:
func foo() { defer RecordLatency(&ctx, time.Now(), metric, tag1, tag2) // remaining of the function body. }
func ResultError ¶ added in v0.13.0
ResultError add a tag with the given string as the result.
func ResultNotOK ¶ added in v0.14.0
ResultNotOK add a tag indicating the API call is a failure.
func WithBuildInfo ¶ added in v0.11.0
WithBuildInfo creates a new context with the build and revision info attached to the observability context.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.