cicdconv

package
v1.36.0 Latest Latest
Warning

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

Go to latest
Published: May 21, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type 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.

var (
	// ErrorTypeOther is a fallback error value to be used when the instrumentation
	// doesn't define a custom value.
	ErrorTypeOther ErrorTypeAttr = "_OTHER"
)

type PipelineResultAttr

type PipelineResultAttr string

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

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"
)

type 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.

func NewPipelineRunActive

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

NewPipelineRunActive returns a new PipelineRunActive instrument.

func (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.

func (PipelineRunActive) Description

func (PipelineRunActive) Description() string

Description returns the semantic convention description of the instrument

func (PipelineRunActive) Inst

Inst returns the underlying metric instrument.

func (PipelineRunActive) Name

func (PipelineRunActive) Name() string

Name returns the semantic convention name of the instrument.

func (PipelineRunActive) Unit

func (PipelineRunActive) Unit() string

Unit returns the semantic convention unit of the instrument

type 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.

func NewPipelineRunDuration

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

NewPipelineRunDuration returns a new PipelineRunDuration instrument.

func (PipelineRunDuration) AttrErrorType

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

func (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.

func (PipelineRunDuration) Description

func (PipelineRunDuration) Description() string

Description returns the semantic convention description of the instrument

func (PipelineRunDuration) Inst

Inst returns the underlying metric instrument.

func (PipelineRunDuration) Name

func (PipelineRunDuration) Name() string

Name returns the semantic convention name of the instrument.

func (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.

func (PipelineRunDuration) Unit

func (PipelineRunDuration) Unit() string

Unit returns the semantic convention unit of the instrument

type 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).

func NewPipelineRunErrors

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

NewPipelineRunErrors returns a new PipelineRunErrors instrument.

func (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`.

func (PipelineRunErrors) Description

func (PipelineRunErrors) Description() string

Description returns the semantic convention description of the instrument

func (PipelineRunErrors) Inst

Inst returns the underlying metric instrument.

func (PipelineRunErrors) Name

func (PipelineRunErrors) Name() string

Name returns the semantic convention name of the instrument.

func (PipelineRunErrors) Unit

func (PipelineRunErrors) Unit() string

Unit returns the semantic convention unit of the instrument

type 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.

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"
)

type 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).

func NewSystemErrors

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

NewSystemErrors returns a new SystemErrors instrument.

func (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.

func (SystemErrors) Description

func (SystemErrors) Description() string

Description returns the semantic convention description of the instrument

func (SystemErrors) Inst

func (m SystemErrors) Inst() metric.Int64Counter

Inst returns the underlying metric instrument.

func (SystemErrors) Name

func (SystemErrors) Name() string

Name returns the semantic convention name of the instrument.

func (SystemErrors) Unit

func (SystemErrors) Unit() string

Unit returns the semantic convention unit of the instrument

type 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.

func NewWorkerCount

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

NewWorkerCount returns a new WorkerCount instrument.

func (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.

func (WorkerCount) Description

func (WorkerCount) Description() string

Description returns the semantic convention description of the instrument

func (WorkerCount) Inst

Inst returns the underlying metric instrument.

func (WorkerCount) Name

func (WorkerCount) Name() string

Name returns the semantic convention name of the instrument.

func (WorkerCount) Unit

func (WorkerCount) Unit() string

Unit returns the semantic convention unit of the instrument

type 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.

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"
)

Jump to

Keyboard shortcuts

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