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

import (
	"context"

	"go.opentelemetry.io/otel/metric"
)

// DeprecatedFeatureOption is a functional option for configuring optional attributes on DeprecatedFeature
type DeprecatedFeatureOption func(*InstAttribs)

// WithWorkflowNamespace sets the namespace attribute
func WithWorkflowNamespace(workflowNamespace string) DeprecatedFeatureOption {
	return func(a *InstAttribs) {
		*a = append(*a, InstAttrib{
			Name:  AttribWorkflowNamespace,
			Value: workflowNamespace,
		})
	}
}

// PodRestartsTotalOption is a functional option for configuring optional attributes on PodRestartsTotal
type PodRestartsTotalOption func(*InstAttribs)

// WithPodRestartCondition sets the condition attribute
func WithPodRestartCondition(podRestartCondition string) PodRestartsTotalOption {
	return func(a *InstAttribs) {
		*a = append(*a, InstAttrib{
			Name:  AttribPodRestartCondition,
			Value: podRestartCondition,
		})
	}
}

// AddCronworkflowsConcurrencypolicyTriggered adds a value to the cronworkflows_concurrencypolicy_triggered counter
func (m *Metrics) AddCronworkflowsConcurrencypolicyTriggered(ctx context.Context, val int64, cronWFName string, cronWFNamespace string, concurrencyPolicy string) {
	attribs := InstAttribs{
		{Name: AttribCronWFName, Value: cronWFName},
		{Name: AttribCronWFNamespace, Value: cronWFNamespace},
		{Name: AttribConcurrencyPolicy, Value: concurrencyPolicy},
	}
	m.AddInt(ctx, InstrumentCronworkflowsConcurrencypolicyTriggered.Name(), val, attribs)
}

// AddCronworkflowsTriggeredTotal adds a value to the cronworkflows_triggered_total counter
func (m *Metrics) AddCronworkflowsTriggeredTotal(ctx context.Context, val int64, cronWFName string, cronWFNamespace string) {
	attribs := InstAttribs{
		{Name: AttribCronWFName, Value: cronWFName},
		{Name: AttribCronWFNamespace, Value: cronWFNamespace},
	}
	m.AddInt(ctx, InstrumentCronworkflowsTriggeredTotal.Name(), val, attribs)
}

// AddDeprecatedFeature adds a value to the deprecated_feature counter
func (m *Metrics) AddDeprecatedFeature(ctx context.Context, val int64, deprecatedFeature string, opts ...DeprecatedFeatureOption) {
	attribs := InstAttribs{
		{Name: AttribDeprecatedFeature, Value: deprecatedFeature},
	}
	for _, opt := range opts {
		opt(&attribs)
	}
	m.AddInt(ctx, InstrumentDeprecatedFeature.Name(), val, attribs)
}

// AddErrorCount adds a value to the error_count counter
func (m *Metrics) AddErrorCount(ctx context.Context, val int64, errorCause string) {
	attribs := InstAttribs{
		{Name: AttribErrorCause, Value: errorCause},
	}
	m.AddInt(ctx, InstrumentErrorCount.Name(), val, attribs)
}

// ObserveGauge observes a value for the gauge gauge
// This is a helper method for use inside RegisterCallback functions
func (m *Metrics) ObserveGauge(ctx context.Context, o metric.Observer, val int64, workflowPhase string) {
	inst := m.GetInstrument(InstrumentGauge.Name())
	if inst == nil {
		return
	}
	attribs := InstAttribs{
		{Name: AttribWorkflowPhase, Value: workflowPhase},
	}
	inst.ObserveInt(ctx, o, val, attribs)
}

// ObserveIsLeader observes a value for the is_leader gauge
// This is a helper method for use inside RegisterCallback functions
func (m *Metrics) ObserveIsLeader(ctx context.Context, o metric.Observer, val int64) {
	inst := m.GetInstrument(InstrumentIsLeader.Name())
	if inst == nil {
		return
	}
	inst.ObserveInt(ctx, o, val, InstAttribs{})
}

// RecordK8sRequestDuration records a value to the k8s_request_duration histogram
func (m *Metrics) RecordK8sRequestDuration(ctx context.Context, val float64, requestKind string, requestVerb string, requestCode int) {
	attribs := InstAttribs{
		{Name: AttribRequestKind, Value: requestKind},
		{Name: AttribRequestVerb, Value: requestVerb},
		{Name: AttribRequestCode, Value: requestCode},
	}
	m.Record(ctx, InstrumentK8sRequestDuration.Name(), val, attribs)
}

// AddK8sRequestTotal adds a value to the k8s_request_total counter
func (m *Metrics) AddK8sRequestTotal(ctx context.Context, val int64, requestKind string, requestVerb string, requestCode int) {
	attribs := InstAttribs{
		{Name: AttribRequestKind, Value: requestKind},
		{Name: AttribRequestVerb, Value: requestVerb},
		{Name: AttribRequestCode, Value: requestCode},
	}
	m.AddInt(ctx, InstrumentK8sRequestTotal.Name(), val, attribs)
}

// AddLogMessages adds a value to the log_messages counter
func (m *Metrics) AddLogMessages(ctx context.Context, val int64, logLevel string) {
	attribs := InstAttribs{
		{Name: AttribLogLevel, Value: logLevel},
	}
	m.AddInt(ctx, InstrumentLogMessages.Name(), val, attribs)
}

// RecordOperationDurationSeconds records a value to the operation_duration_seconds histogram
func (m *Metrics) RecordOperationDurationSeconds(ctx context.Context, val float64) {
	m.Record(ctx, InstrumentOperationDurationSeconds.Name(), val, InstAttribs{})
}

// AddPodMissing adds a value to the pod_missing counter
func (m *Metrics) AddPodMissing(ctx context.Context, val int64, nodePhase string, recentlyStarted bool) {
	attribs := InstAttribs{
		{Name: AttribNodePhase, Value: nodePhase},
		{Name: AttribRecentlyStarted, Value: recentlyStarted},
	}
	m.AddInt(ctx, InstrumentPodMissing.Name(), val, attribs)
}

// AddPodPendingCount adds a value to the pod_pending_count counter
func (m *Metrics) AddPodPendingCount(ctx context.Context, val int64, podPendingReason string, podNamespace string) {
	attribs := InstAttribs{
		{Name: AttribPodPendingReason, Value: podPendingReason},
		{Name: AttribPodNamespace, Value: podNamespace},
	}
	m.AddInt(ctx, InstrumentPodPendingCount.Name(), val, attribs)
}

// AddPodRestartsTotal adds a value to the pod_restarts_total counter
func (m *Metrics) AddPodRestartsTotal(ctx context.Context, val int64, podRestartReason string, podNamespace string, opts ...PodRestartsTotalOption) {
	attribs := InstAttribs{
		{Name: AttribPodRestartReason, Value: podRestartReason},
		{Name: AttribPodNamespace, Value: podNamespace},
	}
	for _, opt := range opts {
		opt(&attribs)
	}
	m.AddInt(ctx, InstrumentPodRestartsTotal.Name(), val, attribs)
}

// ObservePodsGauge observes a value for the pods_gauge gauge
// This is a helper method for use inside RegisterCallback functions
func (m *Metrics) ObservePodsGauge(ctx context.Context, o metric.Observer, val int64, podPhase string) {
	inst := m.GetInstrument(InstrumentPodsGauge.Name())
	if inst == nil {
		return
	}
	attribs := InstAttribs{
		{Name: AttribPodPhase, Value: podPhase},
	}
	inst.ObserveInt(ctx, o, val, attribs)
}

// AddPodsTotalCount adds a value to the pods_total_count counter
func (m *Metrics) AddPodsTotalCount(ctx context.Context, val int64, podPhase string, podNamespace string) {
	attribs := InstAttribs{
		{Name: AttribPodPhase, Value: podPhase},
		{Name: AttribPodNamespace, Value: podNamespace},
	}
	m.AddInt(ctx, InstrumentPodsTotalCount.Name(), val, attribs)
}

// AddQueueAddsCount adds a value to the queue_adds_count counter
func (m *Metrics) AddQueueAddsCount(ctx context.Context, val int64, queueName string) {
	attribs := InstAttribs{
		{Name: AttribQueueName, Value: queueName},
	}
	m.AddInt(ctx, InstrumentQueueAddsCount.Name(), val, attribs)
}

// AddQueueDepthGauge adds a value to the queue_depth_gauge counter
func (m *Metrics) AddQueueDepthGauge(ctx context.Context, val int64, queueName string) {
	attribs := InstAttribs{
		{Name: AttribQueueName, Value: queueName},
	}
	m.AddInt(ctx, InstrumentQueueDepthGauge.Name(), val, attribs)
}

// RecordQueueDuration records a value to the queue_duration histogram
func (m *Metrics) RecordQueueDuration(ctx context.Context, val float64, queueName string) {
	attribs := InstAttribs{
		{Name: AttribQueueName, Value: queueName},
	}
	m.Record(ctx, InstrumentQueueDuration.Name(), val, attribs)
}

// RecordQueueLatency records a value to the queue_latency histogram
func (m *Metrics) RecordQueueLatency(ctx context.Context, val float64, queueName string) {
	attribs := InstAttribs{
		{Name: AttribQueueName, Value: queueName},
	}
	m.Record(ctx, InstrumentQueueLatency.Name(), val, attribs)
}

// ObserveQueueLongestRunning observes a value for the queue_longest_running gauge
// This is a helper method for use inside RegisterCallback functions
func (m *Metrics) ObserveQueueLongestRunning(ctx context.Context, o metric.Observer, val float64, queueName string) {
	inst := m.GetInstrument(InstrumentQueueLongestRunning.Name())
	if inst == nil {
		return
	}
	attribs := InstAttribs{
		{Name: AttribQueueName, Value: queueName},
	}
	inst.ObserveFloat(ctx, o, val, attribs)
}

// AddQueueRetries adds a value to the queue_retries counter
func (m *Metrics) AddQueueRetries(ctx context.Context, val int64, queueName string) {
	attribs := InstAttribs{
		{Name: AttribQueueName, Value: queueName},
	}
	m.AddInt(ctx, InstrumentQueueRetries.Name(), val, attribs)
}

// ObserveQueueUnfinishedWork observes a value for the queue_unfinished_work gauge
// This is a helper method for use inside RegisterCallback functions
func (m *Metrics) ObserveQueueUnfinishedWork(ctx context.Context, o metric.Observer, val float64, queueName string) {
	inst := m.GetInstrument(InstrumentQueueUnfinishedWork.Name())
	if inst == nil {
		return
	}
	attribs := InstAttribs{
		{Name: AttribQueueName, Value: queueName},
	}
	inst.ObserveFloat(ctx, o, val, attribs)
}

// AddTotalCount adds a value to the total_count counter
func (m *Metrics) AddTotalCount(ctx context.Context, val int64, workflowPhase string, workflowNamespace string) {
	attribs := InstAttribs{
		{Name: AttribWorkflowPhase, Value: workflowPhase},
		{Name: AttribWorkflowNamespace, Value: workflowNamespace},
	}
	m.AddInt(ctx, InstrumentTotalCount.Name(), val, attribs)
}

// AddVersion adds a value to the version counter
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) {
	attribs := InstAttribs{
		{Name: AttribBuildVersion, Value: buildVersion},
		{Name: AttribBuildPlatform, Value: buildPlatform},
		{Name: AttribBuildGoVersion, Value: buildGoVersion},
		{Name: AttribBuildDate, Value: buildDate},
		{Name: AttribBuildCompiler, Value: buildCompiler},
		{Name: AttribBuildGitCommit, Value: buildGitCommit},
		{Name: AttribBuildGitTreeState, Value: buildGitTreeState},
		{Name: AttribBuildGitTag, Value: buildGitTag},
	}
	m.AddInt(ctx, InstrumentVersion.Name(), val, attribs)
}

// AddWorkersBusyCount adds a value to the workers_busy_count counter
func (m *Metrics) AddWorkersBusyCount(ctx context.Context, val int64, workerType string) {
	attribs := InstAttribs{
		{Name: AttribWorkerType, Value: workerType},
	}
	m.AddInt(ctx, InstrumentWorkersBusyCount.Name(), val, attribs)
}

// ObserveWorkflowCondition observes a value for the workflow_condition gauge
// This is a helper method for use inside RegisterCallback functions
func (m *Metrics) ObserveWorkflowCondition(ctx context.Context, o metric.Observer, val int64, workflowType string, workflowStatus string) {
	inst := m.GetInstrument(InstrumentWorkflowCondition.Name())
	if inst == nil {
		return
	}
	attribs := InstAttribs{
		{Name: AttribWorkflowType, Value: workflowType},
		{Name: AttribWorkflowStatus, Value: workflowStatus},
	}
	inst.ObserveInt(ctx, o, val, attribs)
}

// RecordWorkflowtemplateRuntime records a value to the workflowtemplate_runtime histogram
func (m *Metrics) RecordWorkflowtemplateRuntime(ctx context.Context, val float64, templateName string, templateNamespace string, templateCluster bool) {
	attribs := InstAttribs{
		{Name: AttribTemplateName, Value: templateName},
		{Name: AttribTemplateNamespace, Value: templateNamespace},
		{Name: AttribTemplateCluster, Value: templateCluster},
	}
	m.Record(ctx, InstrumentWorkflowtemplateRuntime.Name(), val, attribs)
}

// AddWorkflowtemplateTriggeredTotal adds a value to the workflowtemplate_triggered_total counter
func (m *Metrics) AddWorkflowtemplateTriggeredTotal(ctx context.Context, val int64, templateName string, templateNamespace string, templateCluster bool, workflowPhase string) {
	attribs := InstAttribs{
		{Name: AttribTemplateName, Value: templateName},
		{Name: AttribTemplateNamespace, Value: templateNamespace},
		{Name: AttribTemplateCluster, Value: templateCluster},
		{Name: AttribWorkflowPhase, Value: workflowPhase},
	}
	m.AddInt(ctx, InstrumentWorkflowtemplateTriggeredTotal.Name(), val, attribs)
}
