metrics

package
v0.0.0-...-d0ba2f4 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewProcessCollector

func NewProcessCollector(pid int) (*processCollector, error)

Types

type MetricDataPoint

type MetricDataPoint struct {
	Timestamp time.Time
	Value     float64
}

MetricDataPoint represents a single data point with timestamp and value (internal use).

type MetricLine

type MetricLine struct {
	Timestamp           time.Time `parquet:"timestamp,timestamp"`
	Metric              string    `parquet:"metric,dict"`
	Value               float64   `parquet:"value"`
	Environment         string    `parquet:"environment,dict"`
	SDKVersion          string    `parquet:"sdk_version,dict"`
	BuildID             string    `parquet:"build_id,dict"`
	Language            string    `parquet:"language,dict"`
	Scenario            string    `parquet:"scenario,dict"`
	RunID               string    `parquet:"run_id,dict"`
	RunFamily           string    `parquet:"run_family,dict"`
	RunConfigProfile    string    `parquet:"run_profile,dict"`
	WorkerConfigProfile string    `parquet:"worker_profile,dict"`
}

MetricLine represents a single metric data point.

type Metrics

type Metrics struct {
	Server               *http.Server
	ProcessMetricsServer *http.Server // Separate server for process metrics (CPU/memory)
	Registry             *prometheus.Registry
	Cache                map[string]any

	PromInstance *PrometheusInstance
	// contains filtered or unexported fields
}

Metrics is a component for instrumenting an application with Prometheus metrics.

func (*Metrics) NewHandler

func (m *Metrics) NewHandler() client.MetricsHandler

Handler returns a new Temporal-client-compatible metrics handler.

func (*Metrics) Shutdown

func (m *Metrics) Shutdown(ctx context.Context, logger *zap.SugaredLogger, scenario, runID, runFamily string) error

Shutdown the Prometheus HTTP server and local Prometheus process if they were set up. scenario, runID, and runFamily are passed to the export function for metrics metadata.

type PrometheusInstance

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

func (*PrometheusInstance) Shutdown

func (i *PrometheusInstance) Shutdown(ctx context.Context, logger *zap.SugaredLogger, scenario, runID, runFamily string)

type PrometheusInstanceOptions

type PrometheusInstanceOptions struct {
	// Address to run the Prometheus instance
	Address string
	// Path to Prometheus config file for starting a local Prometheus instance.
	// If empty, no local Prometheus will be started.
	ConfigPath string
	// If true, create a TSDB snapshot on shutdown.
	Snapshot bool
	// Path to export worker metrics on shutdown.
	// Includes process metrics (CPU/memory), task latencies, polling metrics, and throughput.
	// If empty, no export will be performed.
	ExportWorkerMetricsPath string
	// Worker job to export SDK metrics (temporal_*).
	ExportWorkerMetricsJob string
	// Process metrics job to export (process_cpu_percent, process_memory_*, etc).
	ExportProcessMetricsJob string
	// Step interval when sampling timeseries metrics for export.
	// If not provided a default interval of 15s will be used.
	// (only used if ExportWorkerMetricsPath is provided)
	ExportMetricsStep time.Duration
	// Address to fetch worker info from during export (e.g., "localhost:9091").
	// If provided, /info will be fetched and used to populate build_id in export.
	ExportWorkerInfoAddress string
}

func (*PrometheusInstanceOptions) IsConfigured

func (p *PrometheusInstanceOptions) IsConfigured() bool

func (*PrometheusInstanceOptions) StartPrometheusInstance

func (p *PrometheusInstanceOptions) StartPrometheusInstance(ctx context.Context, logger *zap.SugaredLogger) *PrometheusInstance

type WorkerInfo

type WorkerInfo struct {
	SDKVersion string `json:"sdk_version"`
	BuildID    string `json:"build_id"`
	Language   string `json:"language"`
}

WorkerInfo represents the response from the /info endpoint. Only contains fields that run-scenario doesn't already know.

Jump to

Keyboard shortcuts

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