Skip to content

Commit 930161f

Browse files
committed
fix: Use TSIncrBy instead of non-existent TSAdd in test data generation
TSAdd method doesn't exist in RedisClient, use TSIncrBy which is the correct method for incrementing TimeSeries values with specific timestamps.
1 parent 9201117 commit 930161f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

pkg/server/errorshandler/test_helpers.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ func (handler *Handler) GenerateTestTimeSeriesData(projectId string) error {
3333
eventsCount := int64((hash % 11))
3434
for i := int64(0); i < eventsCount; i++ {
3535
timestamp := t.UnixNano()/int64(time.Millisecond) + i*100
36-
if err := handler.RedisClient.TSAdd(minutelyKey, 1, timestamp, labels); err != nil {
36+
if err := handler.RedisClient.TSIncrBy(minutelyKey, 1, timestamp, labels); err != nil {
3737
return fmt.Errorf("failed to add minutely test data: %w", err)
3838
}
3939
}
@@ -48,7 +48,7 @@ func (handler *Handler) GenerateTestTimeSeriesData(projectId string) error {
4848
eventsCount := int64(5 + (hash % 90))
4949
for i := int64(0); i < eventsCount; i++ {
5050
timestamp := t.UnixNano()/int64(time.Millisecond) + i*1000
51-
if err := handler.RedisClient.TSAdd(hourlyKey, 1, timestamp, labels); err != nil {
51+
if err := handler.RedisClient.TSIncrBy(hourlyKey, 1, timestamp, labels); err != nil {
5252
return fmt.Errorf("failed to add hourly test data: %w", err)
5353
}
5454
}
@@ -63,7 +63,7 @@ func (handler *Handler) GenerateTestTimeSeriesData(projectId string) error {
6363
eventsCount := int64(100 + (hash % 1800))
6464
for i := int64(0); i < eventsCount; i++ {
6565
timestamp := t.UnixNano()/int64(time.Millisecond) + i*10000
66-
if err := handler.RedisClient.TSAdd(dailyKey, 1, timestamp, labels); err != nil {
66+
if err := handler.RedisClient.TSIncrBy(dailyKey, 1, timestamp, labels); err != nil {
6767
return fmt.Errorf("failed to add daily test data: %w", err)
6868
}
6969
}

0 commit comments

Comments
 (0)