Documentation
¶
Index ¶
- func BandwidthMbpsBuckets() []float64
- func ByteBuckets() []float64
- func FastLatencyBuckets() []float64
- func LatencyBuckets() []float64
- func NewHistogram(meter metric.Meter, path, unit, description string, buckets []float64) metric.Float64Histogram
- func NewMetric[OM any](meter metric.Meter, path, unit, description string) OM
- func SmallCountBuckets() []float64
- type Client
- type Config
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BandwidthMbpsBuckets ¶
func BandwidthMbpsBuckets() []float64
BandwidthMbpsBuckets is for per-request throughput in MiB/s, covering everything from slow long-tail clients (a few MiB/s) up through saturated 10 GbE links (~1.2 GiB/s) and the parallel-stream-on-localhost ceiling.
func ByteBuckets ¶
func ByteBuckets() []float64
ByteBuckets covers cachew payload sizes, which range from tiny bundles (a few KiB) to multi-GiB snapshot tarballs.
func FastLatencyBuckets ¶
func FastLatencyBuckets() []float64
FastLatencyBuckets is for operations expected to complete in well under a minute (spool follower waits, ensure-refs round trips).
func LatencyBuckets ¶
func LatencyBuckets() []float64
LatencyBuckets covers operations that span sub-millisecond cache hits all the way to multi-minute clone/repack/generation work. The default OTel histogram boundaries (0..10 seconds) compress everything beyond 10s into the +Inf bucket, which makes p50/p90/avg unusable for cachew's git path.
func NewHistogram ¶
func NewHistogram(meter metric.Meter, path, unit, description string, buckets []float64) metric.Float64Histogram
NewHistogram creates a Float64Histogram with explicit bucket boundaries. Prefer this over NewMetric for histograms: the OTel SDK default boundaries only go up to 10 seconds, which is far too narrow for most cachew metrics.
func SmallCountBuckets ¶
func SmallCountBuckets() []float64
SmallCountBuckets is for low-cardinality integer counts (e.g. number of pack files on a mirror), where the values of interest are mostly in the 1–100 range with a long tail.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client provides OpenTelemetry metrics with configurable exporters.
type Config ¶
type Config struct {
ServiceName string `hcl:"service-name" help:"Service name for metrics." default:"cachew"`
Port int `hcl:"port" help:"Port for Prometheus metrics server." default:"9102"`
EnablePrometheus bool `hcl:"enable-prometheus" help:"Enable Prometheus exporter." default:"true"`
EnableOTLP bool `hcl:"enable-otlp" help:"Enable OTLP exporter." default:"false"`
OTLPEndpoint string `hcl:"otlp-endpoint" help:"OTLP endpoint URL." default:"http://localhost:4318"`
OTLPInsecure bool `hcl:"otlp-insecure" help:"Use insecure connection for OTLP." default:"false"`
OTLPExportInterval int `hcl:"otlp-export-interval" help:"OTLP export interval in seconds." default:"60"`
}
Config holds metrics configuration.