Verbose logs for DataDoesNotAlign error in CCMS

This commit is contained in:
Aditya Ujeniya
2026-03-26 14:13:12 +01:00
parent 97d65a9e5c
commit 6e97ac8b28
3 changed files with 10 additions and 6 deletions

View File

@@ -146,7 +146,9 @@ var (
// ErrDataDoesNotAlign indicates that aggregated data from child scopes // ErrDataDoesNotAlign indicates that aggregated data from child scopes
// does not align with the parent scope's expected timestamps/intervals. // does not align with the parent scope's expected timestamps/intervals.
ErrDataDoesNotAlign error = errors.New("[METRICSTORE]> data from lower granularities does not align") ErrDataDoesNotAlignMissingFront error = errors.New("[METRICSTORE]> data from lower granularities does not align (missing data prior to start of the buffers)")
ErrDataDoesNotAlignMissingBack error = errors.New("[METRICSTORE]> data from lower granularities does not align (missing data after the end of the buffers)")
ErrDataDoesNotAlignDataLenMismatch error = errors.New("[METRICSTORE]> data from lower granularities does not align (collected data length is different than expected data length)")
) )
// buffer stores time-series data for a single metric at a specific hierarchical level. // buffer stores time-series data for a single metric at a specific hierarchical level.

View File

@@ -712,16 +712,16 @@ func (m *MemoryStore) Read(selector util.Selector, metric string, from, to, reso
} else if from != cfrom || to != cto || len(data) != len(cdata) { } else if from != cfrom || to != cto || len(data) != len(cdata) {
missingfront, missingback := int((from-cfrom)/minfo.Frequency), int((to-cto)/minfo.Frequency) missingfront, missingback := int((from-cfrom)/minfo.Frequency), int((to-cto)/minfo.Frequency)
if missingfront != 0 { if missingfront != 0 {
return ErrDataDoesNotAlign return ErrDataDoesNotAlignMissingFront
} }
newlen := len(cdata) - missingback newlen := len(cdata) - missingback
if newlen < 1 { if newlen < 1 {
return ErrDataDoesNotAlign return ErrDataDoesNotAlignMissingBack
} }
cdata = cdata[0:newlen] cdata = cdata[0:newlen]
if len(cdata) != len(data) { if len(cdata) != len(data) {
return ErrDataDoesNotAlign return ErrDataDoesNotAlignDataLenMismatch
} }
from, to = cfrom, cto from, to = cfrom, cto

View File

@@ -91,8 +91,10 @@ func (m *MemoryStore) Stats(selector util.Selector, metric string, from, to int6
if n == 0 { if n == 0 {
from, to = cfrom, cto from, to = cfrom, cto
} else if from != cfrom || to != cto { } else if from != cfrom {
return ErrDataDoesNotAlign return ErrDataDoesNotAlignMissingFront
} else if to != cto {
return ErrDataDoesNotAlignMissingBack
} }
samples += stats.Samples samples += stats.Samples