Skip to content

Commit

Permalink
chore: make time macros available for all query types (#5092)
Browse files Browse the repository at this point in the history
  • Loading branch information
srikanthccv committed May 27, 2024
1 parent 96162d7 commit 10b543d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pkg/query-service/postprocess/formula.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,9 @@ func joinAndCalculate(
for _, timestamp := range timestamps {
values := make(map[string]interface{})
for queryName, series := range seriesMap {
values[queryName] = series[timestamp]
if _, ok := series[timestamp]; ok {
values[queryName] = series[timestamp]
}
}

// If the value is not present in the values map, set it to 0
Expand Down
3 changes: 3 additions & 0 deletions pkg/query-service/utils/queryTemplate/vars.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ func AssignReservedVarsV3(queryRangeParams *v3.QueryRangeParamsV3) {
queryRangeParams.Variables["start_timestamp_ms"] = queryRangeParams.Start
queryRangeParams.Variables["end_timestamp_ms"] = queryRangeParams.End

queryRangeParams.Variables["SIGNOZ_START_TIME"] = queryRangeParams.Start
queryRangeParams.Variables["SIGNOZ_END_TIME"] = queryRangeParams.End

queryRangeParams.Variables["start_timestamp_nano"] = queryRangeParams.Start * 1e6
queryRangeParams.Variables["end_timestamp_nano"] = queryRangeParams.End * 1e6

Expand Down

0 comments on commit 10b543d

Please sign in to comment.