instrumentation

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// MLatencyMs records the time it took for request to be served (routed to proxy)
	MLatencyMs = stats.Float64("request/latency", "Latency of request served", "ms")

	// KeyTarget holds target information of the request being routed. It will be either "canary" or "main"
	KeyTarget, _ = tag.NewKey("target")

	// KeyReason holds information of the reason on routing decision
	KeyReason, _ = tag.NewKey("reason")

	// KeyVersion holds information of binary version
	KeyVersion, _ = tag.NewKey("version")
)
View Source
var (
	// RequestCountView provide View for request count grouped by target and reason
	RequestCountView = &view.View{
		Name:        "request/count",
		Measure:     MLatencyMs,
		Description: "The count of requests per target and reason",
		Aggregation: view.Count(),
		TagKeys:     []tag.Key{KeyVersion, KeyTarget, KeyReason},
	}

	// RequestLatencyView provide view for latency count distribution
	RequestLatencyView = &view.View{
		Name:        "request/latency",
		Measure:     MLatencyMs,
		Description: "The latency distribution per request target",

		Aggregation: view.Distribution(0, 25, 50, 75, 100, 200, 400, 600, 800, 1000, 2000, 4000, 6000),
		TagKeys:     []tag.Key{KeyVersion, KeyTarget},
	}
)

Functions

func AddReasonTag

func AddReasonTag(ctx context.Context, reason string) (context.Context, error)

AddReasonTag ...

func AddTargetTag

func AddTargetTag(ctx context.Context, target string) (context.Context, error)

AddTargetTag ...

func AddVersionTag

func AddVersionTag(ctx context.Context, version string) (context.Context, error)

AddVersionTag ...

func Initialize

func Initialize(cfg config.InstrumentationConfig) error

Initialize register views and default Prometheus exporter

func InitializeLatencyTracking

func InitializeLatencyTracking(ctx context.Context) context.Context

InitializeLatencyTracking ...

func RecordLatency

func RecordLatency(ctx context.Context)

RecordLatency ...

Types

This section is empty.

Jump to

Keyboard shortcuts

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