metrics

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2021 License: MIT Imports: 7 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"
	LocalActivityFailedCounter          = TemporalMetricsPrefix + "local_activity_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"
	PollerStartCounter = TemporalMetricsPrefix + "poller_start"

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

	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"
	WorkerTypeTagName       = "worker_type"
	WorkflowTypeNameTagName = "workflow_type"
	ActivityTypeNameTagName = "activity_type"
	TaskQueueTagName        = "task_queue"
	OperationTagName        = "operation"
)

Metric tag keys

View Source
const (
	NoneTagValue   = "none"
	ClientTagValue = "temporal_go"
)

Metric tag values

View Source
const (
	ScopeContextKey    = contextKey("MetricsScope")
	LongPollContextKey = contextKey("IsLongPoll")
)

Context keys

Variables

This section is empty.

Functions

func ConvertMethodToScope added in v1.7.0

func ConvertMethodToScope(method string) string

ConvertMethodToScope extracts API name from the method string by truncating the prefix

func GetMetricsScopeForActivity added in v1.0.0

func GetMetricsScopeForActivity(ts tally.Scope, workflowType, activityType, taskQueueName string) tally.Scope

GetMetricsScopeForActivity return properly tagged tally scope for activity

func GetMetricsScopeForLocalActivity added in v1.0.0

func GetMetricsScopeForLocalActivity(ts tally.Scope, workflowType, localActivityType string) tally.Scope

GetMetricsScopeForLocalActivity return properly tagged tally scope for local activity

func GetMetricsScopeForRPC added in v1.0.0

func GetMetricsScopeForRPC(ts tally.Scope, workflowType, activityType, taskQueueName string) tally.Scope

GetMetricsScopeForRPC return properly tagged tally scope for workflow execution

func GetMetricsScopeForWorkflow added in v1.0.0

func GetMetricsScopeForWorkflow(ts tally.Scope, workflowType string) tally.Scope

GetMetricsScopeForWorkflow return properly tagged tally scope for workflow execution

func GetRootScope added in v1.0.0

func GetRootScope(ts tally.Scope, namespace string) tally.Scope

GetRootScope return properly tagged tally scope with base tags included on all metric emitted by the client

func GetWorkerScope added in v1.0.0

func GetWorkerScope(ts tally.Scope, workerType string) tally.Scope

GetWorkerScope return properly tagged tally scope worker type tag

func NewGRPCMetricsInterceptor added in v1.7.0

func NewGRPCMetricsInterceptor(defaultScope tally.Scope, metricSuffix string) grpc.UnaryClientInterceptor

NewGRPCMetricsInterceptor creates new metrics scope interceptor.

func TagScope added in v1.0.0

func TagScope(metricsScope tally.Scope, keyValuePairs ...string) tally.Scope

TagScope return a scope with one or multiple tags, input should be key value pairs like: tagScope(tag1, val1, tag2, val2).

func WrapScope

func WrapScope(isReplay *bool, scope tally.Scope, clock Clock) tally.Scope

WrapScope wraps a scope and skip recording metrics when isReplay is true. This is designed to be used by only by workflowEnvironmentImpl so we suppress metrics while replaying history events. Parameter isReplay is a pointer to workflowEnvironmentImpl.isReplay which will be updated when replaying history events.

Types

type CapturedCount

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

CapturedCount has associated name, tags and value

func (*CapturedCount) Name

func (c *CapturedCount) Name() string

Name return the name of CapturedCount

func (*CapturedCount) Tags

func (c *CapturedCount) Tags() map[string]string

Tags return CapturedCount tags

func (*CapturedCount) Value

func (c *CapturedCount) Value() int64

Value return the value of CapturedCount

type CapturedGauge

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

CapturedGauge has CapturedGauge name, tag and values

func (*CapturedGauge) Name

func (c *CapturedGauge) Name() string

Name return the name of CapturedGauge

func (*CapturedGauge) Tags

func (c *CapturedGauge) Tags() map[string]string

Tags return the tags of CapturedGauge

func (*CapturedGauge) Value

func (c *CapturedGauge) Value() float64

Value return the value of CapturedGauge

type CapturedHistogramDurationSamples

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

CapturedHistogramDurationSamples has related information for CapturedHistogramDurationSamples

type CapturedHistogramValueSamples

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

CapturedHistogramValueSamples has related information for CapturedHistogramValueSamples

type CapturedTimer

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

CapturedTimer has related name , tags and value

func (*CapturedTimer) Name

func (c *CapturedTimer) Name() string

Name return the name of CapturedTimer

func (*CapturedTimer) Tags

func (c *CapturedTimer) Tags() map[string]string

Tags return the tag of CapturedTimer

func (*CapturedTimer) Value

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

Value return the value of CapturedTimer

type CapturingStatsReporter

type CapturingStatsReporter struct {
	sync.Mutex
	// contains filtered or unexported fields
}

CapturingStatsReporter is a reporter used by tests to capture the metric so we can verify our tests.

func NewMetricsScope

func NewMetricsScope(isReplay *bool) (tally.Scope, io.Closer, *CapturingStatsReporter)

NewMetricsScope returns a new metric scope

func NewTaggedMetricsScope

func NewTaggedMetricsScope() (tally.Scope, io.Closer, *CapturingStatsReporter)

NewTaggedMetricsScope return NewTaggedMetricsScope

func (*CapturingStatsReporter) Capabilities

func (c *CapturingStatsReporter) Capabilities() tally.Capabilities

Capabilities return tally.Capabilities

func (*CapturingStatsReporter) Counts

func (c *CapturingStatsReporter) Counts() []CapturedCount

Counts return Counts

func (*CapturingStatsReporter) Flush

func (c *CapturingStatsReporter) Flush()

Flush will add one to flush

func (*CapturingStatsReporter) Gauges

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

Gauges return Gauges

func (*CapturingStatsReporter) HistogramDurationSamples

func (c *CapturingStatsReporter) HistogramDurationSamples() []CapturedHistogramDurationSamples

HistogramDurationSamples return HistogramDurationSamples

func (*CapturingStatsReporter) HistogramValueSamples

func (c *CapturingStatsReporter) HistogramValueSamples() []CapturedHistogramValueSamples

HistogramValueSamples return HistogramValueSamples

func (*CapturingStatsReporter) ReportCounter

func (c *CapturingStatsReporter) ReportCounter(
	name string,
	tags map[string]string,
	value int64,
)

ReportCounter reports the counts

func (*CapturingStatsReporter) ReportGauge

func (c *CapturingStatsReporter) ReportGauge(
	name string,
	tags map[string]string,
	value float64,
)

ReportGauge reports the gauges

func (*CapturingStatsReporter) ReportHistogramDurationSamples

func (c *CapturingStatsReporter) ReportHistogramDurationSamples(
	name string,
	tags map[string]string,
	_ tally.Buckets,
	bucketLowerBound,
	bucketUpperBound time.Duration,
	samples int64,
)

ReportHistogramDurationSamples reports ReportHistogramDurationSamples

func (*CapturingStatsReporter) ReportHistogramValueSamples

func (c *CapturingStatsReporter) ReportHistogramValueSamples(
	name string,
	tags map[string]string,
	_ tally.Buckets,
	bucketLowerBound,
	bucketUpperBound float64,
	samples int64,
)

ReportHistogramValueSamples reports histogramValueSamples

func (*CapturingStatsReporter) ReportTimer

func (c *CapturingStatsReporter) ReportTimer(
	name string,
	tags map[string]string,
	value time.Duration,
)

ReportTimer reports timers

func (*CapturingStatsReporter) Reporting

func (c *CapturingStatsReporter) Reporting() bool

Reporting will always return true

func (*CapturingStatsReporter) Tagging

func (c *CapturingStatsReporter) Tagging() bool

Tagging will always return true

func (*CapturingStatsReporter) Timers

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

Timers return Timers

type Clock

type Clock interface {
	Now() time.Time
}

Clock defines interface used as time source

Jump to

Keyboard shortcuts

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