metrics

package
v0.0.0-...-60b7e97 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2025 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultPrometheusPath = "/metrics"

	TemporalProxyPrefix = "temporal_cloud_proxy_"

	// Encryption metrics
	EncryptLatency  = TemporalProxyPrefix + "encrypt_latency"
	EncryptRequests = TemporalProxyPrefix + "encrypt_requests"
	EncryptErrors   = TemporalProxyPrefix + "encrypt_errors"
	EncryptSuccess  = TemporalProxyPrefix + "encrypt_success"

	// Decryption metrics
	DecryptLatency  = TemporalProxyPrefix + "decrypt_latency"
	DecryptRequests = TemporalProxyPrefix + "decrypt_requests"
	DecryptErrors   = TemporalProxyPrefix + "decrypt_errors"
	DecryptSuccess  = TemporalProxyPrefix + "decrypt_success"

	// Materials manager get metrics
	MaterialsManagerGetLatency  = TemporalProxyPrefix + "materials_manager_get_latency"
	MaterialsManagerGetRequests = TemporalProxyPrefix + "materials_manager_get_requests"
	MaterialsManagerGetErrors   = TemporalProxyPrefix + "materials_manager_get_errors"
	MaterialsManagerGetSuccess  = TemporalProxyPrefix + "materials_manager_get_success"

	// Materials manager decrypt metrics
	MaterialsManagerDecryptLatency  = TemporalProxyPrefix + "materials_manager_decrypt_latency"
	MaterialsManagerDecryptRequests = TemporalProxyPrefix + "materials_manager_decrypt_requests"
	MaterialsManagerDecryptErrors   = TemporalProxyPrefix + "materials_manager_decrypt_errors"
	MaterialsManagerDecryptSuccess  = TemporalProxyPrefix + "materials_manager_decrypt_success"

	// Proxy metrics
	ProxyRequestTotal   = TemporalProxyPrefix + "requests_total"
	ProxyRequestSuccess = TemporalProxyPrefix + "request_success"
	ProxyRequestErrors  = TemporalProxyPrefix + "request_errors"
	ProxyLatency        = TemporalProxyPrefix + "latency"
)
View Source
const TemporalCloudMeterName = "temporal-cloud-proxy"

Variables

View Source
var Module = fx.Provide(
	newMetricsProvider,
)

Functions

func InitPrometheus

func InitPrometheus() (*metric.MeterProvider, error)

Types

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 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 MetricsHandler

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

MetricsHandler is an implementation of client.MetricsHandler for open telemetry.

func ExtractMetricsHandler

func ExtractMetricsHandler(handler client.MetricsHandler) *MetricsHandler

ExtractMetricsHandler gets the underlying Open Telemetry MetricsHandler from a MetricsHandler if any is present.

Raw use of the MetricHandler is discouraged but may be used for Histograms or other advanced features. This scope does not skip metrics during replay like the metrics handler does. Therefore the caller should check replay state.

func NewMetricsHandler

func NewMetricsHandler(options MetricsHandlerOptions) MetricsHandler

NewMetricsHandler returns a client.MetricsHandler that is backed by the given Meter

func (MetricsHandler) AddAttributes

func (m MetricsHandler) AddAttributes(attributes ...attribute.KeyValue)

func (MetricsHandler) Counter

func (m MetricsHandler) Counter(name string) client.MetricsCounter

func (MetricsHandler) Gauge

func (m MetricsHandler) Gauge(name string) client.MetricsGauge

func (MetricsHandler) GetAttributes

func (m MetricsHandler) GetAttributes() attribute.Set

GetAttributes returns the attributes set on this handler.

func (MetricsHandler) GetMeter

func (m MetricsHandler) GetMeter() metric.Meter

GetMeter returns the meter used by this handler.

func (MetricsHandler) Timer

func (m MetricsHandler) Timer(name string) client.MetricsTimer

func (MetricsHandler) WithTags

func (m MetricsHandler) WithTags(tags map[string]string) client.MetricsHandler

type MetricsHandlerOptions

type MetricsHandlerOptions struct {
	// Meter is the Meter to use. If not set, one is obtained from the global
	// meter provider using the name "temporal-sdk-go".
	Meter metric.Meter
	// InitialAttributes to set on the handler
	//
	// Optional: Defaults to the empty set.
	InitialAttributes attribute.Set
	// OnError Callback to invoke if the provided meter returns an error.
	//
	// Optional: Defaults to panicking on any error.
	OnError func(error)
}

MetricsHandlerOptions are options provided to NewMetricsHandler.

type MetricsProvider

type MetricsProvider interface {
	Start() error
	Stop() error
}

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