Files
Pulse/pkg/metrics/docker_observation_contract.go
rcourtman 03adb23556 Avoid unused extrema and copies in persisted chart reads
Use the canonical timestamp/value model directly from the shared retained
read engine. Preserve the full extrema reader, tier reconciliation, Docker
observation provenance, filters and chart sampling while eliminating unused
column transport and a second series copy.

Verify both projections, detached reads and chart sampling equivalence.
Record the measured memory reduction and retain inconclusive timing and
failed capacity evidence. The idle-worker 90 ms proof remains open.
2026-10-18 21:37:54 +01:00

36 lines
1.2 KiB
Go

package metrics
// Docker history written before explicit counter presence mixed unavailable
// readings with measured zero. Its disk percentage also measured image-layer
// composition rather than filesystem capacity. Keep those rows for retention
// and rollback, but never reinterpret them as observations under this contract.
//
// The app-container storage family is shared with other providers. Their valid
// new capacity readings remain supported. Public metric names are unchanged.
func hasDockerObservationContract(resourceType string) bool {
return resourceType == "dockercontainer" || resourceType == "docker"
}
func storedObservationMetric(resourceType, metricType string) string {
if hasDockerObservationContract(resourceType) {
switch metricType {
case "disk", "diskread", "diskwrite":
return metricType + ".observed"
}
}
return metricType
}
func projectDockerObservations[T any](result map[string]map[string][]T) {
for _, series := range result {
for _, metric := range []string{"disk", "diskread", "diskwrite"} {
delete(series, metric)
stored := metric + ".observed"
if points, ok := series[stored]; ok {
series[metric] = points
delete(series, stored)
}
}
}
}