telemetry

package
v3.6.4 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2025 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AttribBuildVersion      string = `version`
	AttribBuildPlatform     string = `platform`
	AttribBuildGoVersion    string = `go_version`
	AttribBuildDate         string = `build_date`
	AttribBuildCompiler     string = `compiler`
	AttribBuildGitCommit    string = `git_commit`
	AttribBuildGitTreeState string = `git_treestate`
	AttribBuildGitTag       string = `git_tag`

	AttribCronWFName        string = `name`
	AttribConcurrencyPolicy string = `concurrency_policy`

	AttribDeprecatedFeature string = "feature"

	AttribErrorCause string = "cause"

	AttribLogLevel string = `level`

	AttribNodePhase string = `node_phase`

	AttribPodPhase         string = `phase`
	AttribPodNamespace     string = `namespace`
	AttribPodPendingReason string = `reason`

	AttribQueueName string = `queue_name`

	AttribRecentlyStarted string = `recently_started`

	AttribRequestKind = `kind`
	AttribRequestVerb = `verb`
	AttribRequestCode = `status_code`

	AttribTemplateName      string = `name`
	AttribTemplateNamespace string = `namespace`
	AttribTemplateCluster   string = `cluster_scope`

	AttribWorkerType string = `worker_type`

	AttribWorkflowNamespace string = `namespace`
	AttribWorkflowPhase     string = `phase`
	AttribWorkflowStatus           = `status`
	AttribWorkflowType             = `type`
)
View Source
const (
	DefaultPrometheusServerPort = 9090
	DefaultPrometheusServerPath = "/metrics"
)
View Source
const (
	Float64ObservableGauge instrumentType = iota
	Float64Histogram
	Float64UpDownCounter
	Float64ObservableUpDownCounter
	Int64ObservableGauge
	Int64UpDownCounter
	Int64Counter
)
View Source
const TestScopeName string = "argo-workflows-test"

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

Variables

This section is empty.

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 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 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(o metric.Observer, val float64, attribs InstAttribs)

func (*Instrument) ObserveInt

func (i *Instrument) ObserveInt(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 {
	// Evil context for compatibility with legacy context free interfaces
	Ctx context.Context
	// contains filtered or unexported fields
}

func NewMetrics

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

func (*Metrics) AddInstrument added in v3.6.3

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) 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 added in v3.6.3

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

func (*Metrics) IterateROInstruments added in v3.6.3

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

IterateROInstruments iterates over every instrument for Read-Only purposes

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) 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 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(name string, attribs *attribute.Set) (float64, error)

GetFloat64CounterValue returns an otel float64 counter value for test reads

func (*TestMetricsExporter) GetFloat64GaugeValue

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

GetFloat64GaugeValue returns an otel float64 gauge value for test reads

func (*TestMetricsExporter) GetFloat64HistogramData

func (t *TestMetricsExporter) GetFloat64HistogramData(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(name string, attribs *attribute.Set) (int64, error)

GetInt64CounterValue returns an otel int64 counter value for test reads

func (*TestMetricsExporter) GetInt64GaugeValue

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

GetInt64GaugeValue returns an otel int64 gauge value for test reads

Jump to

Keyboard shortcuts

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