Documentation ¶
Index ¶
- Constants
- func AddVersion(ctx context.Context, m *Metrics) error
- func WithAsBuiltIn() instrumentOption
- func WithDefaultBuckets(buckets []float64) instrumentOption
- type AddMetric
- type Config
- type InstAttrib
- type InstAttribs
- type Instrument
- func (i *Instrument) AddInt(ctx context.Context, val int64, attribs InstAttribs)
- func (i *Instrument) GetDescription() string
- func (i *Instrument) GetName() string
- func (i *Instrument) GetOtel() interface{}
- func (i *Instrument) GetUserdata() interface{}
- func (i *Instrument) ObserveFloat(o metric.Observer, val float64, attribs InstAttribs)
- func (i *Instrument) ObserveInt(o metric.Observer, val int64, attribs InstAttribs)
- func (i *Instrument) Record(ctx context.Context, val float64, attribs InstAttribs)
- func (i *Instrument) RegisterCallback(m *Metrics, f metric.Callback) error
- func (i *Instrument) SetUserdata(data interface{})
- type Metrics
- func (m *Metrics) AddInt(ctx context.Context, name string, val int64, attribs InstAttribs)
- func (m *Metrics) CreateInstrument(instType instrumentType, name, desc, unit string, options ...instrumentOption) error
- func (m *Metrics) Populate(ctx context.Context, adders ...AddMetric) error
- func (m *Metrics) Record(ctx context.Context, name string, val float64, attribs InstAttribs)
- func (m *Metrics) RunPrometheusServer(ctx context.Context, isDummy bool)
- type Modifier
- type TestMetricsExporter
- func (t *TestMetricsExporter) GetFloat64CounterValue(name string, attribs *attribute.Set) (float64, error)
- func (t *TestMetricsExporter) GetFloat64GaugeValue(name string, attribs *attribute.Set) (float64, error)
- func (t *TestMetricsExporter) GetFloat64HistogramData(name string, attribs *attribute.Set) (*metricdata.HistogramDataPoint[float64], error)
- func (t *TestMetricsExporter) GetInt64CounterValue(name string, attribs *attribute.Set) (int64, error)
- func (t *TestMetricsExporter) GetInt64GaugeValue(name string, attribs *attribute.Set) (int64, error)
Constants ¶
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` 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` )
const ( DefaultPrometheusServerPort = 9090 DefaultPrometheusServerPath = "/metrics" )
const ( Float64ObservableGauge instrumentType = iota Float64Histogram Float64UpDownCounter Float64ObservableUpDownCounter Int64ObservableGauge Int64UpDownCounter Int64Counter )
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 WithAsBuiltIn ¶
func WithAsBuiltIn() instrumentOption
func WithDefaultBuckets ¶
func WithDefaultBuckets(buckets []float64) instrumentOption
Types ¶
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 { // Ensures mutual exclusion in workflows map Mutex sync.RWMutex // Evil context for compatibility with legacy context free interfaces Ctx context.Context AllInstruments map[string]*Instrument // contains filtered or unexported fields }
func NewMetrics ¶
func (*Metrics) CreateInstrument ¶
type TestMetricsExporter ¶
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