telemetry

package
v4.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2026 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Overview

Code generated by util/telemetry/builder. DO NOT EDIT.

Code generated by util/telemetry/builder. DO NOT EDIT.

Code generated by util/telemetry/builder. DO NOT EDIT.

Index

Constants

View Source
const (
	AttribBuildCompiler       string = `compiler`
	AttribBuildDate           string = `build_date`
	AttribBuildGitCommit      string = `git_commit`
	AttribBuildGitTag         string = `git_tag`
	AttribBuildGitTreeState   string = `git_tree_state`
	AttribBuildGoVersion      string = `go_version`
	AttribBuildPlatform       string = `platform`
	AttribBuildVersion        string = `version`
	AttribConcurrencyPolicy   string = `concurrency_policy`
	AttribCronWFName          string = `name`
	AttribCronWFNamespace     string = `namespace`
	AttribDeprecatedFeature   string = `feature`
	AttribErrorCause          string = `cause`
	AttribLogLevel            string = `level`
	AttribNodePhase           string = `node_phase`
	AttribPodNamespace        string = `namespace`
	AttribPodPendingReason    string = `reason`
	AttribPodPhase            string = `phase`
	AttribPodRestartCondition string = `condition`
	AttribPodRestartReason    string = `reason`
	AttribQueueName           string = `queue_name`
	AttribRecentlyStarted     string = `recently_started`
	AttribRequestCode         string = `status_code`
	AttribRequestKind         string = `kind`
	AttribRequestVerb         string = `verb`
	AttribTemplateCluster     string = `cluster_scope`
	AttribTemplateName        string = `name`
	AttribTemplateNamespace   string = `namespace`
	AttribWorkerType          string = `worker_type`
	AttribWorkflowNamespace   string = `namespace`
	AttribWorkflowPhase       string = `phase`
	AttribWorkflowStatus      string = `status`
	AttribWorkflowType        string = `type`
)
View Source
const (
	DefaultPrometheusServerPort = 9090
	DefaultPrometheusServerPath = "/metrics"
)
View Source
const (
	Float64ObservableGauge instrumentType = iota
	Float64Histogram
	Float64ObservableCounter
	Int64ObservableGauge
	Int64UpDownCounter
	Int64Counter
)
View Source
const TestScopeName string = "argo-workflows-test"

TestScopeName is the name that the metrics running under test will have

Variables

View Source
var InstrumentCronworkflowsConcurrencypolicyTriggered = BuiltinInstrument{
	// contains filtered or unexported fields
}
View Source
var InstrumentCronworkflowsTriggeredTotal = BuiltinInstrument{
	// contains filtered or unexported fields
}
View Source
var InstrumentDeprecatedFeature = BuiltinInstrument{
	// contains filtered or unexported fields
}
View Source
var InstrumentErrorCount = BuiltinInstrument{
	// contains filtered or unexported fields
}
View Source
var InstrumentGauge = BuiltinInstrument{
	// contains filtered or unexported fields
}
View Source
var InstrumentIsLeader = BuiltinInstrument{
	// contains filtered or unexported fields
}
View Source
var InstrumentK8sRequestDuration = BuiltinInstrument{
	// contains filtered or unexported fields
}
View Source
var InstrumentK8sRequestTotal = BuiltinInstrument{
	// contains filtered or unexported fields
}
View Source
var InstrumentLogMessages = BuiltinInstrument{
	// contains filtered or unexported fields
}
View Source
var InstrumentOperationDurationSeconds = BuiltinInstrument{
	// contains filtered or unexported fields
}
View Source
var InstrumentPodMissing = BuiltinInstrument{
	// contains filtered or unexported fields
}
View Source
var InstrumentPodPendingCount = BuiltinInstrument{
	// contains filtered or unexported fields
}
View Source
var InstrumentPodRestartsTotal = BuiltinInstrument{
	// contains filtered or unexported fields
}
View Source
var InstrumentPodsGauge = BuiltinInstrument{
	// contains filtered or unexported fields
}
View Source
var InstrumentPodsTotalCount = BuiltinInstrument{
	// contains filtered or unexported fields
}
View Source
var InstrumentQueueAddsCount = BuiltinInstrument{
	// contains filtered or unexported fields
}
View Source
var InstrumentQueueDepthGauge = BuiltinInstrument{
	// contains filtered or unexported fields
}
View Source
var InstrumentQueueDuration = BuiltinInstrument{
	// contains filtered or unexported fields
}
View Source
var InstrumentQueueLatency = BuiltinInstrument{
	// contains filtered or unexported fields
}
View Source
var InstrumentQueueLongestRunning = BuiltinInstrument{
	// contains filtered or unexported fields
}
View Source
var InstrumentQueueRetries = BuiltinInstrument{
	// contains filtered or unexported fields
}
View Source
var InstrumentQueueUnfinishedWork = BuiltinInstrument{
	// contains filtered or unexported fields
}
View Source
var InstrumentTotalCount = BuiltinInstrument{
	// contains filtered or unexported fields
}
View Source
var InstrumentVersion = BuiltinInstrument{
	// contains filtered or unexported fields
}
View Source
var InstrumentWorkersBusyCount = BuiltinInstrument{
	// contains filtered or unexported fields
}
View Source
var InstrumentWorkflowCondition = BuiltinInstrument{
	// contains filtered or unexported fields
}
View Source
var InstrumentWorkflowtemplateRuntime = BuiltinInstrument{
	// contains filtered or unexported fields
}
View Source
var InstrumentWorkflowtemplateTriggeredTotal = BuiltinInstrument{
	// contains filtered or unexported fields
}

Functions

func AddDeprecationCounter

func AddDeprecationCounter(_ context.Context, m *Metrics) error

func AddVersion

func AddVersion(ctx context.Context, m *Metrics) error

func WithAsBuiltIn

func WithAsBuiltIn() instrumentOption

func WithDefaultBuckets

func WithDefaultBuckets(buckets []float64) instrumentOption

Types

type AddMetric

type AddMetric func(context.Context, *Metrics) error

type BuiltinAttribute

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

type BuiltinInstrument

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

func (*BuiltinInstrument) Name

func (bi *BuiltinInstrument) Name() string

type Config

type Config struct {
	Enabled      bool
	Path         string
	Port         int
	TTL          time.Duration
	IgnoreErrors bool
	Secure       bool
	Modifiers    map[string]Modifier
	Temporality  metricsdk.TemporalitySelector
}

type DeprecatedFeatureOption

type DeprecatedFeatureOption func(*InstAttribs)

DeprecatedFeatureOption is a functional option for configuring optional attributes on DeprecatedFeature

func WithWorkflowNamespace

func WithWorkflowNamespace(workflowNamespace string) DeprecatedFeatureOption

WithWorkflowNamespace sets the namespace attribute

type InstAttrib

type InstAttrib struct {
	Name  string
	Value interface{}
}

type InstAttribs

type InstAttribs []InstAttrib

type Instrument

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

func (*Instrument) AddInt

func (i *Instrument) AddInt(ctx context.Context, val int64, attribs InstAttribs)

func (*Instrument) GetDescription

func (i *Instrument) GetDescription() string

func (*Instrument) GetName

func (i *Instrument) GetName() string

func (*Instrument) GetOtel

func (i *Instrument) GetOtel() interface{}

func (*Instrument) GetUserdata

func (i *Instrument) GetUserdata() interface{}

func (*Instrument) ObserveFloat

func (i *Instrument) ObserveFloat(ctx context.Context, o metric.Observer, val float64, attribs InstAttribs)

func (*Instrument) ObserveInt

func (i *Instrument) ObserveInt(ctx context.Context, o metric.Observer, val int64, attribs InstAttribs)

func (*Instrument) Record

func (i *Instrument) Record(ctx context.Context, val float64, attribs InstAttribs)

func (*Instrument) RegisterCallback

func (i *Instrument) RegisterCallback(m *Metrics, f metric.Callback) error

func (*Instrument) SetUserdata

func (i *Instrument) SetUserdata(data interface{})

type Metrics

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

func NewMetrics

func NewMetrics(ctx context.Context, serviceName, prometheusName string, config *Config, extraOpts ...metricsdk.Option) (*Metrics, error)

func (*Metrics) AddCronworkflowsConcurrencypolicyTriggered

func (m *Metrics) AddCronworkflowsConcurrencypolicyTriggered(ctx context.Context, val int64, cronWFName string, cronWFNamespace string, concurrencyPolicy string)

AddCronworkflowsConcurrencypolicyTriggered adds a value to the cronworkflows_concurrencypolicy_triggered counter

func (*Metrics) AddCronworkflowsTriggeredTotal

func (m *Metrics) AddCronworkflowsTriggeredTotal(ctx context.Context, val int64, cronWFName string, cronWFNamespace string)

AddCronworkflowsTriggeredTotal adds a value to the cronworkflows_triggered_total counter

func (*Metrics) AddDeprecatedFeature

func (m *Metrics) AddDeprecatedFeature(ctx context.Context, val int64, deprecatedFeature string, opts ...DeprecatedFeatureOption)

AddDeprecatedFeature adds a value to the deprecated_feature counter

func (*Metrics) AddErrorCount

func (m *Metrics) AddErrorCount(ctx context.Context, val int64, errorCause string)

AddErrorCount adds a value to the error_count counter

func (*Metrics) AddInstrument

func (m *Metrics) AddInstrument(name string, inst *Instrument)

func (*Metrics) AddInt

func (m *Metrics) AddInt(ctx context.Context, name string, val int64, attribs InstAttribs)

func (*Metrics) AddK8sRequestTotal

func (m *Metrics) AddK8sRequestTotal(ctx context.Context, val int64, requestKind string, requestVerb string, requestCode int)

AddK8sRequestTotal adds a value to the k8s_request_total counter

func (*Metrics) AddLogMessages

func (m *Metrics) AddLogMessages(ctx context.Context, val int64, logLevel string)

AddLogMessages adds a value to the log_messages counter

func (*Metrics) AddPodMissing

func (m *Metrics) AddPodMissing(ctx context.Context, val int64, nodePhase string, recentlyStarted bool)

AddPodMissing adds a value to the pod_missing counter

func (*Metrics) AddPodPendingCount

func (m *Metrics) AddPodPendingCount(ctx context.Context, val int64, podPendingReason string, podNamespace string)

AddPodPendingCount adds a value to the pod_pending_count counter

func (*Metrics) AddPodRestartsTotal

func (m *Metrics) AddPodRestartsTotal(ctx context.Context, val int64, podRestartReason string, podNamespace string, opts ...PodRestartsTotalOption)

AddPodRestartsTotal adds a value to the pod_restarts_total counter

func (*Metrics) AddPodsTotalCount

func (m *Metrics) AddPodsTotalCount(ctx context.Context, val int64, podPhase string, podNamespace string)

AddPodsTotalCount adds a value to the pods_total_count counter

func (*Metrics) AddQueueAddsCount

func (m *Metrics) AddQueueAddsCount(ctx context.Context, val int64, queueName string)

AddQueueAddsCount adds a value to the queue_adds_count counter

func (*Metrics) AddQueueDepthGauge

func (m *Metrics) AddQueueDepthGauge(ctx context.Context, val int64, queueName string)

AddQueueDepthGauge adds a value to the queue_depth_gauge counter

func (*Metrics) AddQueueRetries

func (m *Metrics) AddQueueRetries(ctx context.Context, val int64, queueName string)

AddQueueRetries adds a value to the queue_retries counter

func (*Metrics) AddTotalCount

func (m *Metrics) AddTotalCount(ctx context.Context, val int64, workflowPhase string, workflowNamespace string)

AddTotalCount adds a value to the total_count counter

func (*Metrics) AddVersion

func (m *Metrics) AddVersion(ctx context.Context, val int64, buildVersion string, buildPlatform string, buildGoVersion string, buildDate string, buildCompiler string, buildGitCommit string, buildGitTreeState string, buildGitTag string)

AddVersion adds a value to the version counter

func (*Metrics) AddWorkersBusyCount

func (m *Metrics) AddWorkersBusyCount(ctx context.Context, val int64, workerType string)

AddWorkersBusyCount adds a value to the workers_busy_count counter

func (*Metrics) AddWorkflowtemplateTriggeredTotal

func (m *Metrics) AddWorkflowtemplateTriggeredTotal(ctx context.Context, val int64, templateName string, templateNamespace string, templateCluster bool, workflowPhase string)

AddWorkflowtemplateTriggeredTotal adds a value to the workflowtemplate_triggered_total counter

func (*Metrics) CreateBuiltinInstrument

func (m *Metrics) CreateBuiltinInstrument(instrument BuiltinInstrument, opts ...instrumentOption) error

CreateBuiltinInstrument adds a yaml defined builtin instrument opts parameter is for legacy metrics, do not use for new metrics

func (*Metrics) CreateInstrument

func (m *Metrics) CreateInstrument(instType instrumentType, name, desc, unit string, options ...instrumentOption) error

func (*Metrics) DeprecatedFeature

func (m *Metrics) DeprecatedFeature(ctx context.Context, deprecation string, namespace string)

func (*Metrics) GetInstrument

func (m *Metrics) GetInstrument(name string) *Instrument

func (*Metrics) IterateROInstruments

func (m *Metrics) IterateROInstruments(fn func(i *Instrument))

IterateROInstruments iterates over every instrument for Read-Only purposes

func (*Metrics) ObserveGauge

func (m *Metrics) ObserveGauge(ctx context.Context, o metric.Observer, val int64, workflowPhase string)

ObserveGauge observes a value for the gauge gauge This is a helper method for use inside RegisterCallback functions

func (*Metrics) ObserveIsLeader

func (m *Metrics) ObserveIsLeader(ctx context.Context, o metric.Observer, val int64)

ObserveIsLeader observes a value for the is_leader gauge This is a helper method for use inside RegisterCallback functions

func (*Metrics) ObservePodsGauge

func (m *Metrics) ObservePodsGauge(ctx context.Context, o metric.Observer, val int64, podPhase string)

ObservePodsGauge observes a value for the pods_gauge gauge This is a helper method for use inside RegisterCallback functions

func (*Metrics) ObserveQueueLongestRunning

func (m *Metrics) ObserveQueueLongestRunning(ctx context.Context, o metric.Observer, val float64, queueName string)

ObserveQueueLongestRunning observes a value for the queue_longest_running gauge This is a helper method for use inside RegisterCallback functions

func (*Metrics) ObserveQueueUnfinishedWork

func (m *Metrics) ObserveQueueUnfinishedWork(ctx context.Context, o metric.Observer, val float64, queueName string)

ObserveQueueUnfinishedWork observes a value for the queue_unfinished_work gauge This is a helper method for use inside RegisterCallback functions

func (*Metrics) ObserveWorkflowCondition

func (m *Metrics) ObserveWorkflowCondition(ctx context.Context, o metric.Observer, val int64, workflowType string, workflowStatus string)

ObserveWorkflowCondition observes a value for the workflow_condition gauge This is a helper method for use inside RegisterCallback functions

func (*Metrics) Populate

func (m *Metrics) Populate(ctx context.Context, adders ...AddMetric) error

func (*Metrics) Record

func (m *Metrics) Record(ctx context.Context, name string, val float64, attribs InstAttribs)

func (*Metrics) RecordK8sRequestDuration

func (m *Metrics) RecordK8sRequestDuration(ctx context.Context, val float64, requestKind string, requestVerb string, requestCode int)

RecordK8sRequestDuration records a value to the k8s_request_duration histogram

func (*Metrics) RecordOperationDurationSeconds

func (m *Metrics) RecordOperationDurationSeconds(ctx context.Context, val float64)

RecordOperationDurationSeconds records a value to the operation_duration_seconds histogram

func (*Metrics) RecordQueueDuration

func (m *Metrics) RecordQueueDuration(ctx context.Context, val float64, queueName string)

RecordQueueDuration records a value to the queue_duration histogram

func (*Metrics) RecordQueueLatency

func (m *Metrics) RecordQueueLatency(ctx context.Context, val float64, queueName string)

RecordQueueLatency records a value to the queue_latency histogram

func (*Metrics) RecordWorkflowtemplateRuntime

func (m *Metrics) RecordWorkflowtemplateRuntime(ctx context.Context, val float64, templateName string, templateNamespace string, templateCluster bool)

RecordWorkflowtemplateRuntime records a value to the workflowtemplate_runtime histogram

func (*Metrics) RunPrometheusServer

func (m *Metrics) RunPrometheusServer(ctx context.Context, isDummy bool)

RunPrometheusServer starts a prometheus metrics server If 'isDummy' is set to true, the dummy metrics server will be started. If it's false, the prometheus metrics server will be started

type Modifier

type Modifier struct {
	Disabled           bool
	DisabledAttributes []string
	HistogramBuckets   []float64
}

Modifier holds options to change the behaviour for a single metric

type PodRestartsTotalOption

type PodRestartsTotalOption func(*InstAttribs)

PodRestartsTotalOption is a functional option for configuring optional attributes on PodRestartsTotal

func WithPodRestartCondition

func WithPodRestartCondition(podRestartCondition string) PodRestartsTotalOption

WithPodRestartCondition sets the condition attribute

type TestMetricsExporter

type TestMetricsExporter struct {
	metric.Reader
}

TestExporter is an opentelemetry metrics exporter, purely for use within tests. It is not possible to query the values of an instrument via the otel SDK, so this exporter provides methods by which you can request metrics by name+attributes and therefore inspect whether they exist, and their values for the purposes of testing only. This is a public structure as it is used outside of this module also.

func NewTestMetricsExporter

func NewTestMetricsExporter() *TestMetricsExporter

func (*TestMetricsExporter) GetFloat64CounterValue

func (t *TestMetricsExporter) GetFloat64CounterValue(ctx context.Context, name string, attribs *attribute.Set) (float64, error)

GetFloat64CounterValue returns an otel float64 counter value for test reads

func (*TestMetricsExporter) GetFloat64GaugeValue

func (t *TestMetricsExporter) GetFloat64GaugeValue(ctx context.Context, name string, attribs *attribute.Set) (float64, error)

GetFloat64GaugeValue returns an otel float64 gauge value for test reads

func (*TestMetricsExporter) GetFloat64HistogramData

func (t *TestMetricsExporter) GetFloat64HistogramData(ctx context.Context, name string, attribs *attribute.Set) (*metricdata.HistogramDataPoint[float64], error)

GetFloat64HistogramData returns an otel histogram float64 data point for test reads

func (*TestMetricsExporter) GetInt64CounterValue

func (t *TestMetricsExporter) GetInt64CounterValue(ctx context.Context, name string, attribs *attribute.Set) (int64, error)

GetInt64CounterValue returns an otel int64 counter value for test reads

func (*TestMetricsExporter) GetInt64GaugeValue

func (t *TestMetricsExporter) GetInt64GaugeValue(ctx context.Context, name string, attribs *attribute.Set) (int64, error)

GetInt64GaugeValue returns an otel int64 gauge value for test reads

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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