mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-11-30 01:32:00 +01:00
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.
36 lines
1.2 KiB
Go
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)
|
|
}
|
|
}
|
|
}
|
|
}
|