telemetry

package
v1.6.4-pre.1 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2026 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ControllerUser = "packagerevision-controller"

	ResourcePackageRevision          = "PackageRevision"
	ResourcePackageRevisionResources = "PackageRevisionResources"
	ResourceExternalRepo             = "ExternalRepo"
)
View Source
const PProfPortEnvVar = "PORCH_PPROF_PORT"

Variables

View Source
var (
	APIVersionV1Alpha1 = v1alpha1.SchemeGroupVersion.Version
	APIVersionV1Alpha2 = v1alpha2.SchemeGroupVersion.Version
)

Functions

func InitMetrics

func InitMetrics() (err error)

func RecordAPICallDuration

func RecordAPICallDuration(resource, verb, apiVersion string, durationSeconds float64)

Porch server and function runner metric recording functions

func RecordControllerOperation

func RecordControllerOperation(resource, verb string, start time.Time)

RecordControllerOperation records duration and request count for a v1alpha2 controller operation.

func RecordControllerRequestCount

func RecordControllerRequestCount(resource, op, apiVersion string)

func RecordExternalRepoOperation

func RecordExternalRepoOperation(ctx context.Context, op string, start time.Time)

External git operations are shared infrastructure and are not tagged with api_version.

func RecordExternalRepoRequestCount

func RecordExternalRepoRequestCount(ctx context.Context, op string)

func RecordPackageRevisionResourcesSize

func RecordPackageRevisionResourcesSize(ctx context.Context, prKey repository.PackageRevisionKey, resourcesSize int64)

func RecordRequestCount

func RecordRequestCount(ctx context.Context, resource, op, apiVersion string)

Types

type OTelResources

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

OTelResources holds all OpenTelemetry resources that need lifecycle management. Use Shutdown() to cleanly release all resources.

func SetupOpenTelemetry

func SetupOpenTelemetry(ctx context.Context) (*OTelResources, error)

SetupOpenTelemetry is the single entry point for all OpenTelemetry setup. It configures tracing, metrics (including the Prometheus HTTP server if OTEL_EXPORTER_PROMETHEUS_HOST and OTEL_EXPORTER_PROMETHEUS_PORT are set), and initializes all Porch metric instruments. Returns OTelResources for lifecycle management.

func (*OTelResources) Shutdown

func (r *OTelResources) Shutdown(ctx context.Context) error

Shutdown gracefully shuts down all OpenTelemetry resources.

func (*OTelResources) ShutdownWithTimeout

func (r *OTelResources) ShutdownWithTimeout(timeout time.Duration) error

ShutdownWithTimeout is a convenience wrapper around Shutdown with a timeout.

type Profiling

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

func (*Profiling) Start

func (p *Profiling) Start()

func (*Profiling) Stop

func (p *Profiling) Stop()

Jump to

Keyboard shortcuts

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