Files
pulse/pkg/metrics/docker_observation_contract.go
T
rcourtman f48c806718 Preserve observed Docker storage evidence
Missing block I/O and container image sizes could become false evidence
for diagnosis. Preserve per-direction counter presence and measured zero
through collection, resource conversion and browser rendering. Separate
new observed history from ambiguous retained disk series without deleting
old rows or changing public metric names.

Keep partial host rates distinct and persist a newly enabled Disk I/O
column across the first preference reload.
2026-09-06 12:45:40 +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(result map[string]map[string][]MetricPoint) {
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)
}
}
}
}