telemetry

package
v1.6.4-pre.3 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: Apache-2.0 Imports: 27 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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 key.PackageRevisionKey, resourcesSize int64)

RecordPackageRevisionResourcesSize records the resource size of a single package revision.

To keep metric cardinality bounded, the labels are deliberately limited:

  • The histogram (porch_package_size_bytes) is aggregated per namespace only, so it stays a meaningful distribution with at most one series set per namespace, regardless of the number of package revisions.
  • The gauge (porch_package_size_bytes_total) is aggregated per namespace and repository by default. Only when PORCH_METRICS_PACKAGE_SIZE_DETAILED is enabled does it additionally carry the high-cardinality package and workspace_name labels, producing one series per package revision.

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