metrics

package
v0.0.0-...-164faee Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MetricsNamespace                = "redhat_appstudio"
	MetricsSubsystem                = "integrationservice"
	IntegrationServiceNamespaceName = "integration-service"
	// Pipelines as Code GitHub appliaction configuration secret name.
	// The secret is located in integration-service namespace.
	PipelinesAsCodeGitHubAppSecretName = "pipelines-as-code-secret"
	// Keys of the GitHub app ID and the app private key in the pipelines-as-code-secret
	PipelinesAsCodeGithubAppIdKey   = "github-application-id"
	PipelinesAsCodeGithubPrivateKey = "github-private-key"
)

Variables

View Source
var (
	IntegrationSvcResponseSeconds = prometheus.NewHistogram(
		prometheus.HistogramOpts{
			Name:    "integration_svc_response_seconds",
			Help:    "Integration service response time from the moment the buildPipelineRun is completed till the snapshot is marked as in progress status",
			Buckets: []float64{0.5, 1, 2, 3, 4, 5, 6, 7, 10, 15, 30, 60, 120, 240},
		},
	)

	//This metric should be dropped once SnapshotCreatedToPipelineRunStartedSeconds is merged in prod
	SnapshotCreatedToPipelineRunStartedStaticEnvSeconds = prometheus.NewHistogram(
		prometheus.HistogramOpts{
			Name:    "integration_svc_snapshot_created_to_pipelinerun_with_static_env_started_seconds",
			Help:    "Time duration from the moment the snapshot resource was created till a integration pipelineRun is started in a static environment",
			Buckets: []float64{0.05, 0.1, 0.5, 1, 2, 3, 4, 5, 10, 15, 30},
		},
	)

	SnapshotCreatedToPipelineRunStartedSeconds = prometheus.NewHistogram(
		prometheus.HistogramOpts{
			Name:    "integration_svc_snapshot_created_to_pipelinerun_started_seconds",
			Help:    "Time duration from the moment the snapshot resource was created till a integration pipelineRun is started in the environment",
			Buckets: []float64{0.05, 0.1, 0.5, 1, 2, 3, 4, 5, 10, 15, 30},
		},
	)

	IntegrationPipelineRunTotal = prometheus.NewCounter(
		prometheus.CounterOpts{
			Name: "integration_svc_integration_pipelinerun_total",
			Help: "Total number of integration PipelineRun created",
		},
	)

	SnapshotDurationSeconds = prometheus.NewHistogramVec(
		prometheus.HistogramOpts{
			Name:    "integration_svc_snapshot_attempt_duration_seconds",
			Help:    "Snapshot durations from the moment the Snapshot was created till the Snapshot is marked as finished",
			Buckets: []float64{7, 15, 30, 60, 150, 300, 450, 600, 750, 900, 1050},
		},
		[]string{"type", "reason"},
	)

	SnapshotTotal = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Name: "integration_svc_snapshot_attempt_total",
			Help: "Total number of snapshots processed by the operator",
		},
		[]string{"type", "reason"},
	)

	ReleaseLatencySeconds = prometheus.NewHistogram(
		prometheus.HistogramOpts{
			Name:    "integration_svc_release_latency_seconds",
			Help:    "Latency between integration tests completion and release creation",
			Buckets: []float64{0.05, 0.1, 0.5, 1, 2, 3, 4, 5, 10, 15, 30},
		},
	)
)

Functions

func RegisterCompletedSnapshot

func RegisterCompletedSnapshot(conditiontype, reason string, startTime metav1.Time, completionTime *metav1.Time)

func RegisterIntegrationResponse

func RegisterIntegrationResponse(duration time.Duration)

func RegisterInvalidSnapshot

func RegisterInvalidSnapshot(conditiontype, reason string)

func RegisterNewIntegrationPipelineRun

func RegisterNewIntegrationPipelineRun()

func RegisterPipelineRunStarted

func RegisterPipelineRunStarted(snapshotCreatedTime metav1.Time, pipelineRunStartTime *metav1.Time)

func RegisterReleaseLatency

func RegisterReleaseLatency(startTime metav1.Time)

Types

type AvailabilityProbe

type AvailabilityProbe interface {
	CheckAvailability(ctx context.Context) bool
	AvailabilityGauge() prometheus.Gauge
}

AvailabilityProbe represents a probe that checks the availability of a certain aspects of the service

type GithubAppAvailabilityProbe

type GithubAppAvailabilityProbe struct {
	// contains filtered or unexported fields
}

func NewGithubAppAvailabilityProbe

func NewGithubAppAvailabilityProbe(client client.Client) *GithubAppAvailabilityProbe

func (*GithubAppAvailabilityProbe) AvailabilityGauge

func (g *GithubAppAvailabilityProbe) AvailabilityGauge() prometheus.Gauge

func (*GithubAppAvailabilityProbe) CheckAvailability

func (g *GithubAppAvailabilityProbe) CheckAvailability(ctx context.Context) bool

type IntegrationMetrics

type IntegrationMetrics struct {
	// contains filtered or unexported fields
}

IntegrationMetrics represents a collection of metrics to be registered on a Prometheus metrics registry for a integration service.

func NewIntegrationMetrics

func NewIntegrationMetrics(probes []AvailabilityProbe) *IntegrationMetrics

func (*IntegrationMetrics) InitMetrics

func (m *IntegrationMetrics) InitMetrics(registerer prometheus.Registerer) error

func (*IntegrationMetrics) StartAvailabilityProbes

func (m *IntegrationMetrics) StartAvailabilityProbes(ctx context.Context)

Jump to

Keyboard shortcuts

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