metrics

package
v1.26.0-rc.4 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 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"
	WorkflowTaskFailureReason = "failure_reason"
)

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 added in v1.12.0

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

ActivityTags returns a set of tags for activities.

func LocalActivityTags added in v1.12.0

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

LocalActivityTags returns a set of tags for local activities.

func NewGRPCInterceptor added in v1.12.0

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

NewGRPCInterceptor creates a new gRPC unary interceptor to record metrics.

func PollerTags added in v1.19.0

func PollerTags(pollerType string) map[string]string

PollerTags returns a set of tags for pollers.

func RPCTags added in v1.12.0

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

RPCTags returns a set of tags for RPC calls.

func RootTags added in v1.12.0

func RootTags(namespace string) map[string]string

RootTags returns a set of base tags for all metrics.

func TaskQueueTags added in v1.15.0

func TaskQueueTags(taskQueue string) map[string]string

TaskQueueTags returns a set of tags for a task queue.

func WorkerTags added in v1.12.0

func WorkerTags(workerType string) map[string]string

WorkerTags returns a set of tags for workers.

func WorkflowTags added in v1.12.0

func WorkflowTags(workflowType string) map[string]string

WorkflowTags returns a set of tags for workflows.

func WorkflowTaskFailedTags added in v1.26.0

func WorkflowTaskFailedTags(reason string) map[string]string

WorkflowTaskFailedTags returns a set of tags for a workflow task failure.

Types

type CapturedCounter added in v1.12.0

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

CapturedCounter atomically implements Counter and provides an atomic getter.

func (*CapturedCounter) Inc added in v1.12.0

func (c *CapturedCounter) Inc(d int64)

Inc implements Counter.Inc.

func (*CapturedCounter) Value added in v1.12.0

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 added in v1.12.0

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 added in v1.12.0

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 added in v1.12.0

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 added in v1.12.0

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

CapturingHandler is a Handler that retains counted values locally.

func NewCapturingHandler added in v1.12.0

func NewCapturingHandler() *CapturingHandler

NewCapturingHandler creates a new CapturingHandler.

func (*CapturingHandler) Clear added in v1.12.0

func (c *CapturingHandler) Clear()

Clear removes all known metrics from the root handler.

func (*CapturingHandler) Counter added in v1.12.0

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

Counter implements Handler.Counter.

func (*CapturingHandler) Counters added in v1.12.0

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 added in v1.12.0

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

Gauge implements Handler.Gauge.

func (*CapturingHandler) Gauges added in v1.12.0

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 added in v1.12.0

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

Timer implements Handler.Timer.

func (*CapturingHandler) Timers added in v1.12.0

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 added in v1.12.0

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

WithTags implements Handler.WithTags.

type Counter added in v1.12.0

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

Counter is an ever-increasing counter.

type CounterFunc added in v1.12.0

type CounterFunc func(int64)

CounterFunc implements Counter with a single function.

func (CounterFunc) Inc added in v1.12.0

func (c CounterFunc) Inc(d int64)

Inc implements Counter.Inc.

type Gauge added in v1.12.0

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

Gauge can be set to any float.

type GaugeFunc added in v1.12.0

type GaugeFunc func(float64)

GaugeFunc implements Gauge with a single function.

func (GaugeFunc) Update added in v1.12.0

func (g GaugeFunc) Update(d float64)

Update implements Gauge.Update.

type Handler added in v1.12.0

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 added in v1.12.0

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 added in v1.12.0

type HandlerContextKey struct{}

HandlerContextKey is the context key for a MetricHandler value.

type LongPollContextKey added in v0.29.0

type LongPollContextKey struct{}

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

type Timer added in v1.12.0

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

Timer records time durations.

type TimerFunc added in v1.12.0

type TimerFunc func(time.Duration)

TimerFunc implements Timer with a single function.

func (TimerFunc) Record added in v1.12.0

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