From bdcae62bf98e260dbafb171c7b8678ea27078816 Mon Sep 17 00:00:00 2001 From: Ekansh Gupta Date: Mon, 28 Oct 2024 22:32:04 +0530 Subject: [PATCH] fix: fixed the step interval which was being perculated to list view (#6260) * fix: fixed the step interval which was being perculated to list view * fix: fixed the step interval which was being perculated to list view * fix: fixed the step interval which was being perculated to list view * fix: fixed the step interval which was being perculated to list view * fix: fixed the step interval which was being perculated to list view * fix: fixed the step interval which was being perculated to list view * chore: bump signoz-otel-collector version (#6290) * Chore: bump signoz otel collector dependency to 0.111.5 (#6302) * chore: bump signoz-otel-collector dependency version to 0.111.5 * chore: logs filter suggestions: update import for ResourceHierarchy from signoz-otel-collector * fix: fixed the step interval which was being perculated to list view --------- Co-authored-by: Srikanth Chekuri Co-authored-by: Raj Kamal Singh <1133322+raj-k-singh@users.noreply.github.com> --- pkg/query-service/app/querier/querier_test.go | 2 +- pkg/query-service/app/querier/v2/querier_test.go | 2 +- pkg/query-service/app/traces/v3/query_builder.go | 8 ++++++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/pkg/query-service/app/querier/querier_test.go b/pkg/query-service/app/querier/querier_test.go index c30841546e..6a28c2c267 100644 --- a/pkg/query-service/app/querier/querier_test.go +++ b/pkg/query-service/app/querier/querier_test.go @@ -753,7 +753,7 @@ func TestQueryRangeValueType(t *testing.T) { // No caching expectedTimeRangeInQueryString := []string{ fmt.Sprintf("unix_milli >= %d AND unix_milli < %d", 1675115520000, 1675115580000+120*60*1000), - fmt.Sprintf("timestamp >= '%d' AND timestamp <= '%d'", (1675115580000+60*60*1000)*int64(1000000), (1675115580000+180*60*1000)*int64(1000000)), + fmt.Sprintf("timestamp >= '%d' AND timestamp <= '%d'", 1675119196722000000, 1675126396722000000), } for i, param := range params { diff --git a/pkg/query-service/app/querier/v2/querier_test.go b/pkg/query-service/app/querier/v2/querier_test.go index 6dfc921183..62e18d244d 100644 --- a/pkg/query-service/app/querier/v2/querier_test.go +++ b/pkg/query-service/app/querier/v2/querier_test.go @@ -800,7 +800,7 @@ func TestV2QueryRangeValueType(t *testing.T) { expectedTimeRangeInQueryString := []string{ fmt.Sprintf("unix_milli >= %d AND unix_milli < %d", 1675115520000, 1675115580000+120*60*1000), // 31st Jan, 03:23:00 to 31st Jan, 05:23:00 fmt.Sprintf("unix_milli >= %d AND unix_milli < %d", 1675115580000+120*60*1000, 1675115580000+180*60*1000), // 31st Jan, 05:23:00 to 31st Jan, 06:23:00 - fmt.Sprintf("timestamp >= '%d' AND timestamp <= '%d'", (1675115580000+60*60*1000)*int64(1000000), (1675115580000+180*60*1000)*int64(1000000)), // 31st Jan, 05:23:00 to 31st Jan, 06:23:00 + fmt.Sprintf("timestamp >= '%d' AND timestamp <= '%d'", (1675119196722)*int64(1000000), (1675126396722)*int64(1000000)), // 31st Jan, 05:23:00 to 31st Jan, 06:23:00 } for i, param := range params { diff --git a/pkg/query-service/app/traces/v3/query_builder.go b/pkg/query-service/app/traces/v3/query_builder.go index ce9c54573c..ad5b69229b 100644 --- a/pkg/query-service/app/traces/v3/query_builder.go +++ b/pkg/query-service/app/traces/v3/query_builder.go @@ -501,8 +501,12 @@ func addOffsetToQuery(query string, offset uint64) string { // step is in seconds func PrepareTracesQuery(start, end int64, panelType v3.PanelType, mq *v3.BuilderQuery, options v3.QBOptions) (string, error) { // adjust the start and end time to the step interval - start = start - (start % (mq.StepInterval * 1000)) - end = end - (end % (mq.StepInterval * 1000)) + if panelType == v3.PanelTypeGraph { + // adjust the start and end time to the step interval for graph panel types + start = start - (start % (mq.StepInterval * 1000)) + end = end - (end % (mq.StepInterval * 1000)) + } + if options.GraphLimitQtype == constants.FirstQueryGraphLimit { // give me just the group by names query, err := buildTracesQuery(start, end, mq.StepInterval, mq, constants.SIGNOZ_SPAN_INDEX_TABLENAME, panelType, options)