Search and commands

↑ ↓ to select · Enter to open · Esc to close

Type to search packages.

cicdconv

v1.47.0
go.opentelemetry.io/otel/semconv/v1.32.0/cicdconv

Documentation

pkg.go.dev ↗

Table of contents

↓ to select · Enter to jump· Shift+Enter for source

55 matches

Top ↑

Package cicdconv provides types and functionality for OpenTelemetry semantic conventions in the "cicd" namespace.

Types

ErrorTypeAttr

type ErrorTypeAttr string

ErrorTypeAttr is an attribute conforming to the error.type semantic conventions. It represents the describes a class of error the operation ended with.

ErrorTypeOther

var ErrorTypeOther ErrorTypeAttr = "_OTHER"

ErrorTypeOther is a fallback error value to be used when the instrumentation doesn't define a custom value.

PipelineResultAttr

type PipelineResultAttr string

PipelineResultAttr is an attribute conforming to the cicd.pipeline.result semantic conventions. It represents the result of a pipeline run.

PipelineResultSuccess (6 declarations)

var (
	// PipelineResultSuccess is the pipeline run finished successfully.
	PipelineResultSuccess PipelineResultAttr = "success"
	// PipelineResultFailure is the pipeline run did not finish successfully, eg.
	// due to a compile error or a failing test. Such failures are usually detected
	// by non-zero exit codes of the tools executed in the pipeline run.
	PipelineResultFailure PipelineResultAttr = "failure"
	// PipelineResultError is the pipeline run failed due to an error in the CICD
	// system, eg. due to the worker being killed.
	PipelineResultError PipelineResultAttr = "error"
	// PipelineResultTimeout is a timeout caused the pipeline run to be interrupted.
	PipelineResultTimeout PipelineResultAttr = "timeout"
	// PipelineResultCancellation is the pipeline run was cancelled, eg. by a user
	// manually cancelling the pipeline run.
	PipelineResultCancellation PipelineResultAttr = "cancellation"
	// PipelineResultSkip is the pipeline run was skipped, eg. due to a precondition
	// not being met.
	PipelineResultSkip PipelineResultAttr = "skip"
)

PipelineRunActive

type PipelineRunActive struct {
	metric.Int64UpDownCounter
}

PipelineRunActive is an instrument used to record metric values conforming to the "cicd.pipeline.run.active" semantic conventions. It represents the number of pipeline runs currently active in the system by state.

NewPipelineRunActive

func NewPipelineRunActive(
	m metric.Meter,
	opt ...metric.Int64UpDownCounterOption,
) (PipelineRunActive, error)

NewPipelineRunActive returns a new PipelineRunActive instrument.

PipelineRunActive.Add

func (m PipelineRunActive) Add(
	ctx context.Context,
	incr int64,
	pipelineName string,
	pipelineRunState PipelineRunStateAttr,
	attrs ...attribute.KeyValue,
)

Add adds incr to the existing count.

The pipelineName is the the human readable name of the pipeline within a CI/CD system.

The pipelineRunState is the the pipeline run goes through these states during its lifecycle.

PipelineRunActive.Description

func (PipelineRunActive) Description() string

Description returns the semantic convention description of the instrument

PipelineRunActive.Inst

func (m PipelineRunActive) Inst() metric.Int64UpDownCounter

Inst returns the underlying metric instrument.

PipelineRunActive.Name

func (PipelineRunActive) Name() string

Name returns the semantic convention name of the instrument.

PipelineRunActive.Unit

func (PipelineRunActive) Unit() string

Unit returns the semantic convention unit of the instrument

PipelineRunDuration

type PipelineRunDuration struct {
	metric.Float64Histogram
}

PipelineRunDuration is an instrument used to record metric values conforming to the "cicd.pipeline.run.duration" semantic conventions. It represents the duration of a pipeline run grouped by pipeline, state and result.

NewPipelineRunDuration

func NewPipelineRunDuration(
	m metric.Meter,
	opt ...metric.Float64HistogramOption,
) (PipelineRunDuration, error)

NewPipelineRunDuration returns a new PipelineRunDuration instrument.

PipelineRunDuration.AttrErrorType

func (PipelineRunDuration) AttrErrorType(val ErrorTypeAttr) attribute.KeyValue

AttrErrorType returns an optional attribute for the "error.type" semantic convention. It represents the describes a class of error the operation ended with.

PipelineRunDuration.AttrPipelineResult

func (PipelineRunDuration) AttrPipelineResult(val PipelineResultAttr) attribute.KeyValue

AttrPipelineResult returns an optional attribute for the "cicd.pipeline.result" semantic convention. It represents the result of a pipeline run.

PipelineRunDuration.Description

func (PipelineRunDuration) Description() string

Description returns the semantic convention description of the instrument

PipelineRunDuration.Inst

func (m PipelineRunDuration) Inst() metric.Float64Histogram

Inst returns the underlying metric instrument.

PipelineRunDuration.Name

func (PipelineRunDuration) Name() string

Name returns the semantic convention name of the instrument.

PipelineRunDuration.Record

func (m PipelineRunDuration) Record(
	ctx context.Context,
	val float64,
	pipelineName string,
	pipelineRunState PipelineRunStateAttr,
	attrs ...attribute.KeyValue,
)

Record records val to the current distribution.

The pipelineName is the the human readable name of the pipeline within a CI/CD system.

The pipelineRunState is the the pipeline run goes through these states during its lifecycle.

All additional attrs passed are included in the recorded value.

PipelineRunDuration.Unit

func (PipelineRunDuration) Unit() string

Unit returns the semantic convention unit of the instrument

PipelineRunErrors

type PipelineRunErrors struct {
	metric.Int64Counter
}

PipelineRunErrors is an instrument used to record metric values conforming to the "cicd.pipeline.run.errors" semantic conventions. It represents the number of errors encountered in pipeline runs (eg. compile, test failures).

NewPipelineRunErrors

func NewPipelineRunErrors(
	m metric.Meter,
	opt ...metric.Int64CounterOption,
) (PipelineRunErrors, error)

NewPipelineRunErrors returns a new PipelineRunErrors instrument.

PipelineRunErrors.Add

func (m PipelineRunErrors) Add(
	ctx context.Context,
	incr int64,
	pipelineName string,
	errorType ErrorTypeAttr,
	attrs ...attribute.KeyValue,
)

Add adds incr to the existing count.

The pipelineName is the the human readable name of the pipeline within a CI/CD system.

The errorType is the describes a class of error the operation ended with.

There might be errors in a pipeline run that are non fatal (eg. they are suppressed) or in a parallel stage multiple stages could have a fatal error. This means that this error count might not be the same as the count of metric `cicd.pipeline.run.duration` with run result `failure`.

PipelineRunErrors.Description

func (PipelineRunErrors) Description() string

Description returns the semantic convention description of the instrument

PipelineRunErrors.Inst

func (m PipelineRunErrors) Inst() metric.Int64Counter

Inst returns the underlying metric instrument.

PipelineRunErrors.Name

func (PipelineRunErrors) Name() string

Name returns the semantic convention name of the instrument.

PipelineRunErrors.Unit

func (PipelineRunErrors) Unit() string

Unit returns the semantic convention unit of the instrument

PipelineRunStateAttr

type PipelineRunStateAttr string

PipelineRunStateAttr is an attribute conforming to the cicd.pipeline.run.state semantic conventions. It represents the pipeline run goes through these states during its lifecycle.

PipelineRunStatePending (3 declarations)

var (
	// PipelineRunStatePending is the run pending state spans from the event
	// triggering the pipeline run until the execution of the run starts (eg. time
	// spent in a queue, provisioning agents, creating run resources).
	PipelineRunStatePending PipelineRunStateAttr = "pending"
	// PipelineRunStateExecuting is the executing state spans the execution of any
	// run tasks (eg. build, test).
	PipelineRunStateExecuting PipelineRunStateAttr = "executing"
	// PipelineRunStateFinalizing is the finalizing state spans from when the run
	// has finished executing (eg. cleanup of run resources).
	PipelineRunStateFinalizing PipelineRunStateAttr = "finalizing"
)

SystemErrors

type SystemErrors struct {
	metric.Int64Counter
}

SystemErrors is an instrument used to record metric values conforming to the "cicd.system.errors" semantic conventions. It represents the number of errors in a component of the CICD system (eg. controller, scheduler, agent).

NewSystemErrors

func NewSystemErrors(
	m metric.Meter,
	opt ...metric.Int64CounterOption,
) (SystemErrors, error)

NewSystemErrors returns a new SystemErrors instrument.

SystemErrors.Add

func (m SystemErrors) Add(
	ctx context.Context,
	incr int64,
	systemComponent string,
	errorType ErrorTypeAttr,
	attrs ...attribute.KeyValue,
)

Add adds incr to the existing count.

The systemComponent is the the name of a component of the CICD system.

The errorType is the describes a class of error the operation ended with.

Errors in pipeline run execution are explicitly excluded. Ie a test failure is not counted in this metric.

SystemErrors.Description

func (SystemErrors) Description() string

Description returns the semantic convention description of the instrument

SystemErrors.Inst

func (m SystemErrors) Inst() metric.Int64Counter

Inst returns the underlying metric instrument.

SystemErrors.Name

func (SystemErrors) Name() string

Name returns the semantic convention name of the instrument.

SystemErrors.Unit

func (SystemErrors) Unit() string

Unit returns the semantic convention unit of the instrument

WorkerCount

type WorkerCount struct {
	metric.Int64UpDownCounter
}

WorkerCount is an instrument used to record metric values conforming to the "cicd.worker.count" semantic conventions. It represents the number of workers on the CICD system by state.

NewWorkerCount

func NewWorkerCount(
	m metric.Meter,
	opt ...metric.Int64UpDownCounterOption,
) (WorkerCount, error)

NewWorkerCount returns a new WorkerCount instrument.

WorkerCount.Add

func (m WorkerCount) Add(
	ctx context.Context,
	incr int64,
	workerState WorkerStateAttr,
	attrs ...attribute.KeyValue,
)

Add adds incr to the existing count.

The workerState is the the state of a CICD worker / agent.

WorkerCount.Description

func (WorkerCount) Description() string

Description returns the semantic convention description of the instrument

WorkerCount.Inst

func (m WorkerCount) Inst() metric.Int64UpDownCounter

Inst returns the underlying metric instrument.

WorkerCount.Name

func (WorkerCount) Name() string

Name returns the semantic convention name of the instrument.

WorkerCount.Unit

func (WorkerCount) Unit() string

Unit returns the semantic convention unit of the instrument

WorkerStateAttr

type WorkerStateAttr string

WorkerStateAttr is an attribute conforming to the cicd.worker.state semantic conventions. It represents the state of a CICD worker / agent.

WorkerStateAvailable (3 declarations)

var (
	// WorkerStateAvailable is the worker is not performing work for the CICD
	// system. It is available to the CICD system to perform work on (online /
	// idle).
	WorkerStateAvailable WorkerStateAttr = "available"
	// WorkerStateBusy is the worker is performing work for the CICD system.
	WorkerStateBusy WorkerStateAttr = "busy"
	// WorkerStateOffline is the worker is not available to the CICD system
	// (disconnected / down).
	WorkerStateOffline WorkerStateAttr = "offline"
)

Dependency graph