PrivatebuildReturns a statistical summary of a histogram metric.
Computes count, sum, average, and p50 / p95 / p99 percentiles from
the stored samples. Returns undefined if the metric does not exist,
is not a histogram, or has no samples yet.
Summary object with count, sum, avg, p50, p95, p99,
or undefined if no histogram data exists
Returns the current scalar value of a counter or gauge metric.
Returns undefined for histogram metrics (use getHistogramSummary
instead) and for metrics that have not been recorded yet.
Current numeric value, or undefined if not found / is a histogram
Increments a counter metric by the given value.
Creates the counter at zero if it does not exist yet, then adds value.
Counters are monotonically increasing — use setGauge for
values that can decrease.
Metric name (use a MetricName enum value for type safety)
Amount to add to the counter (default: 1)
Optionallabels: Record<string, string>Optional key/value label dimensions (e.g., { endpoint: '/meps' })
Records a single observation into a histogram metric.
Uses reservoir sampling to keep sample count bounded at
maxHistogramSamples. Use getHistogramSummary to retrieve
computed percentiles.
Metric name (use a MetricName enum value for type safety)
Observed value (e.g., response time in milliseconds)
Optionallabels: Record<string, string>Optional key/value label dimensions
PrivatepartitionPartition helper for quickselect (Lomuto-style) Cyclomatic complexity: 4
Array to partition
Left bound
Right bound
Pivot index
New pivot index
PrivatepercentileCompute a percentile value from an unsorted array using quickselect Cyclomatic complexity: 3
Array of samples
Percentile to compute (0-100)
Percentile value
PrivateselectSelect the k-th smallest element using quickselect Cyclomatic complexity: 5
Array to select from (will be mutated)
Index of element to select (0-based)
The k-th smallest element
Sets a gauge metric to an absolute value.
Unlike counters, gauges can be set to any value including decreasing values (e.g., current queue depth, active connection count).
Metric name (use a MetricName enum value for type safety)
Absolute gauge value to record
Optionallabels: Record<string, string>Optional key/value label dimensions
Performance Metrics Service Cyclomatic complexity: 8