metrics

package
v0.0.0-...-266fb8d Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TemporalMetricsPrefix = "temporal_"

	WorkflowCompletedCounter     = TemporalMetricsPrefix + "workflow_completed"
	WorkflowCanceledCounter      = TemporalMetricsPrefix + "workflow_canceled"
	WorkflowFailedCounter        = TemporalMetricsPrefix + "workflow_failed"
	WorkflowContinueAsNewCounter = TemporalMetricsPrefix + "workflow_continue_as_new"
	WorkflowEndToEndLatency      = TemporalMetricsPrefix + "workflow_endtoend_latency" // measure workflow execution from start to close

	WorkflowTaskReplayLatency           = TemporalMetricsPrefix + "workflow_task_replay_latency"
	WorkflowTaskQueuePollEmptyCounter   = TemporalMetricsPrefix + "workflow_task_queue_poll_empty"
	WorkflowTaskQueuePollSucceedCounter = TemporalMetricsPrefix + "workflow_task_queue_poll_succeed"
	WorkflowTaskScheduleToStartLatency  = TemporalMetricsPrefix + "workflow_task_schedule_to_start_latency"
	WorkflowTaskExecutionLatency        = TemporalMetricsPrefix + "workflow_task_execution_latency"
	WorkflowTaskExecutionFailureCounter = TemporalMetricsPrefix + "workflow_task_execution_failed"
	WorkflowTaskNoCompletionCounter     = TemporalMetricsPrefix + "workflow_task_no_completion"

	ActivityPollNoTaskCounter             = TemporalMetricsPrefix + "activity_poll_no_task"
	ActivityScheduleToStartLatency        = TemporalMetricsPrefix + "activity_schedule_to_start_latency"
	ActivityExecutionFailedCounter        = TemporalMetricsPrefix + "activity_execution_failed"
	UnregisteredActivityInvocationCounter = TemporalMetricsPrefix + "unregistered_activity_invocation"
	ActivityExecutionLatency              = TemporalMetricsPrefix + "activity_execution_latency"
	ActivitySucceedEndToEndLatency        = TemporalMetricsPrefix + "activity_succeed_endtoend_latency"
	ActivityTaskErrorCounter              = TemporalMetricsPrefix + "activity_task_error"

	LocalActivityTotalCounter             = TemporalMetricsPrefix + "local_activity_total"
	LocalActivityCanceledCounter          = TemporalMetricsPrefix + "local_activity_canceled" // Deprecated: Use LocalActivityExecutionCanceledCounter instead.
	LocalActivityExecutionCanceledCounter = TemporalMetricsPrefix + "local_activity_execution_cancelled"
	LocalActivityFailedCounter            = TemporalMetricsPrefix + "local_activity_failed" // Deprecated: Use LocalActivityExecutionFailedCounter instead.
	LocalActivityExecutionFailedCounter   = TemporalMetricsPrefix + "local_activity_execution_failed"
	LocalActivityErrorCounter             = TemporalMetricsPrefix + "local_activity_error"
	LocalActivityExecutionLatency         = TemporalMetricsPrefix + "local_activity_execution_latency"
	LocalActivitySucceedEndToEndLatency   = TemporalMetricsPrefix + "local_activity_succeed_endtoend_latency"

	CorruptedSignalsCounter = TemporalMetricsPrefix + "corrupted_signals"

	WorkerStartCounter       = TemporalMetricsPrefix + "worker_start"
	WorkerTaskSlotsAvailable = TemporalMetricsPrefix + "worker_task_slots_available"
	PollerStartCounter       = TemporalMetricsPrefix + "poller_start"
	NumPoller                = TemporalMetricsPrefix + "num_pollers"

	TemporalRequest                      = TemporalMetricsPrefix + "request"
	TemporalRequestFailure               = TemporalRequest + "_failure"
	TemporalRequestLatency               = TemporalRequest + "_latency"
	TemporalLongRequest                  = TemporalMetricsPrefix + "long_request"
	TemporalLongRequestFailure           = TemporalLongRequest + "_failure"
	TemporalLongRequestLatency           = TemporalLongRequest + "_latency"
	TemporalRequestResourceExhausted     = TemporalRequest + "_resource_exhausted"
	TemporalLongRequestResourceExhausted = TemporalLongRequest + "_resource_exhausted"

	StickyCacheHit                 = TemporalMetricsPrefix + "sticky_cache_hit"
	StickyCacheMiss                = TemporalMetricsPrefix + "sticky_cache_miss"
	StickyCacheTotalForcedEviction = TemporalMetricsPrefix + "sticky_cache_total_forced_eviction"
	StickyCacheSize                = TemporalMetricsPrefix + "sticky_cache_size"

	WorkflowActiveThreadCount = TemporalMetricsPrefix + "workflow_active_thread_count"
)

Metrics keys

View Source
const (
	NamespaceTagName        = "namespace"
	ClientTagName           = "client_name"
	PollerTypeTagName       = "poller_type"
	WorkerTypeTagName       = "worker_type"
	WorkflowTypeNameTagName = "workflow_type"
	ActivityTypeNameTagName = "activity_type"
	TaskQueueTagName        = "task_queue"
	OperationTagName        = "operation"
	CauseTagName            = "cause"
)

Metric tag keys

View Source
const (
	NoneTagValue                 = "none"
	ClientTagValue               = "temporal_go"
	PollerTypeWorkflowTask       = "workflow_task"
	PollerTypeWorkflowStickyTask = "workflow_sticky_task"
	PollerTypeActivityTask       = "activity_task"
)

Metric tag values

Variables

This section is empty.

Functions

func ActivityTags

func ActivityTags(workflowType, activityType, taskQueueName string) map[string]string

ActivityTags returns a set of tags for activities.

func LocalActivityTags

func LocalActivityTags(workflowType, activityType string) map[string]string

LocalActivityTags returns a set of tags for local activities.

func NewGRPCInterceptor

func NewGRPCInterceptor(defaultHandler Handler, suffix string) grpc.UnaryClientInterceptor

NewGRPCInterceptor creates a new gRPC unary interceptor to record metrics.

func PollerTags

func PollerTags(pollerType string) map[string]string

PollerTags returns a set of tags for pollers.

func RPCTags

func RPCTags(workflowType, activityType, taskQueueName string) map[string]string

RPCTags returns a set of tags for RPC calls.

func RootTags

func RootTags(namespace string) map[string]string

RootTags returns a set of base tags for all metrics.

func TaskQueueTags

func TaskQueueTags(taskQueue string) map[string]string

TaskQueueTags returns a set of tags for a task queue.

func WorkerTags

func WorkerTags(workerType string) map[string]string

WorkerTags returns a set of tags for workers.

func WorkflowTags

func WorkflowTags(workflowType string) map[string]string

WorkflowTags returns a set of tags for workflows.

Types

type CapturedCounter

type CapturedCounter struct {
	CapturedMetricMeta
	// contains filtered or unexported fields
}

CapturedCounter atomically implements Counter and provides an atomic getter.

func (*CapturedCounter) Inc

func (c *CapturedCounter) Inc(d int64)

Inc implements Counter.Inc.

func (*CapturedCounter) Value

func (c *CapturedCounter) Value() int64

Value atomically returns the current value.

type CapturedGauge

type CapturedGauge struct {
	CapturedMetricMeta
	// contains filtered or unexported fields
}

CapturedGauge atomically implements Gauge and provides an atomic getter.

func (*CapturedGauge) Update

func (c *CapturedGauge) Update(d float64)

Update implements Gauge.Update.

func (*CapturedGauge) Value

func (c *CapturedGauge) Value() float64

Value atomically returns the current value.

type CapturedMetricMeta

type CapturedMetricMeta struct {
	Name string
	Tags map[string]string
}

CapturedMetricMeta is common information for captured metrics. These fields should never by mutated.

type CapturedTimer

type CapturedTimer struct {
	CapturedMetricMeta
	// contains filtered or unexported fields
}

CapturedTimer atomically implements Timer and provides an atomic getter.

func (*CapturedTimer) Record

func (c *CapturedTimer) Record(d time.Duration)

Record implements Timer.Record.

func (*CapturedTimer) Value

func (c *CapturedTimer) Value() time.Duration

Value atomically returns the current value.

type CapturingHandler

type CapturingHandler struct {
	// contains filtered or unexported fields
}

CapturingHandler is a Handler that retains counted values locally.

func NewCapturingHandler

func NewCapturingHandler() *CapturingHandler

NewCapturingHandler creates a new CapturingHandler.

func (*CapturingHandler) Clear

func (c *CapturingHandler) Clear()

Clear removes all known metrics from the root handler.

func (*CapturingHandler) Counter

func (c *CapturingHandler) Counter(name string) Counter

Counter implements Handler.Counter.

func (*CapturingHandler) Counters

func (c *CapturingHandler) Counters() []*CapturedCounter

Counters returns shallow copy of the local counters. New counters will not get added here, but the value within the counter may still change.

func (*CapturingHandler) Gauge

func (c *CapturingHandler) Gauge(name string) Gauge

Gauge implements Handler.Gauge.

func (*CapturingHandler) Gauges

func (c *CapturingHandler) Gauges() []*CapturedGauge

Gauges returns shallow copy of the local gauges. New gauges will not get added here, but the value within the gauge may still change.

func (*CapturingHandler) Timer

func (c *CapturingHandler) Timer(name string) Timer

Timer implements Handler.Timer.

func (*CapturingHandler) Timers

func (c *CapturingHandler) Timers() []*CapturedTimer

Timers returns shallow copy of the local timers. New timers will not get added here, but the value within the timer may still change.

func (*CapturingHandler) WithTags

func (c *CapturingHandler) WithTags(tags map[string]string) Handler

WithTags implements Handler.WithTags.

type Counter

type Counter interface {
	// Inc increments the counter value.
	Inc(int64)
}

Counter is an ever-increasing counter.

type CounterFunc

type CounterFunc func(int64)

CounterFunc implements Counter with a single function.

func (CounterFunc) Inc

func (c CounterFunc) Inc(d int64)

Inc implements Counter.Inc.

type Gauge

type Gauge interface {
	// Update updates the gauge value.
	Update(float64)
}

Gauge can be set to any float.

type GaugeFunc

type GaugeFunc func(float64)

GaugeFunc implements Gauge with a single function.

func (GaugeFunc) Update

func (g GaugeFunc) Update(d float64)

Update implements Gauge.Update.

type Handler

type Handler interface {
	// WithTags returns a new handler with the given tags set for each metric
	// created from it.
	WithTags(map[string]string) Handler

	// Counter obtains a counter for the given name.
	Counter(name string) Counter

	// Gauge obtains a gauge for the given name.
	Gauge(name string) Gauge

	// Timer obtains a timer for the given name.
	Timer(name string) Timer
}

Handler is a handler for metrics emitted by the SDK. This interface is intentionally limited to only what the SDK needs to emit metrics and is not built to be a general purpose metrics abstraction for all uses.

A common implementation is at go.temporal.io/sdk/contrib/tally.NewMetricsHandler. The NopHandler is a noop handler. A handler may implement "Unwrap() Handler" if it wraps a handler.

var NopHandler Handler = nopHandler{}

NopHandler is a noop handler that does nothing with the metrics.

func NewReplayAwareHandler

func NewReplayAwareHandler(replay *bool, underlying Handler) Handler

NewReplayAwareHandler is a handler that will not record any metrics if the boolean pointed to by "replay" is true.

type HandlerContextKey

type HandlerContextKey struct{}

HandlerContextKey is the context key for a MetricHandler value.

type LongPollContextKey

type LongPollContextKey struct{}

LongPollContextKey is the context key for a boolean stating whether the gRPC call is a long poll.

type Timer

type Timer interface {
	// Record sets the timer value.
	Record(time.Duration)
}

Timer records time durations.

type TimerFunc

type TimerFunc func(time.Duration)

TimerFunc implements Timer with a single function.

func (TimerFunc) Record

func (t TimerFunc) Record(d time.Duration)

Record implements Timer.Record.

Jump to

Keyboard shortcuts

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