mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-12 06:39:03 +08:00
fix: use fill gaps only for time series panel types (#5387)
This commit is contained in:
parent
02106277a6
commit
b0b69c83db
@ -46,6 +46,9 @@ func fillGap(series *v3.Series, start, end, step int64) *v3.Series {
|
||||
|
||||
// TODO(srikanthccv): can WITH FILL be perfect substitute for all cases https://clickhouse.com/docs/en/sql-reference/statements/select/order-by#order-by-expr-with-fill-modifier
|
||||
func FillGaps(results []*v3.Result, params *v3.QueryRangeParamsV3) {
|
||||
if params.CompositeQuery.PanelType != v3.PanelTypeGraph {
|
||||
return
|
||||
}
|
||||
for _, result := range results {
|
||||
// A `result` item in `results` contains the query result for individual query.
|
||||
// If there are no series in the result, we add empty series and `fillGap` adds all zeros
|
||||
|
@ -43,6 +43,7 @@ func TestFillGaps(t *testing.T) {
|
||||
Start: 1000,
|
||||
End: 5000,
|
||||
CompositeQuery: &v3.CompositeQuery{
|
||||
PanelType: v3.PanelTypeGraph,
|
||||
BuilderQueries: map[string]*v3.BuilderQuery{
|
||||
"query1": {
|
||||
QueryName: "query1",
|
||||
@ -82,6 +83,7 @@ func TestFillGaps(t *testing.T) {
|
||||
Start: 1000,
|
||||
End: 5000,
|
||||
CompositeQuery: &v3.CompositeQuery{
|
||||
PanelType: v3.PanelTypeGraph,
|
||||
BuilderQueries: map[string]*v3.BuilderQuery{
|
||||
"query1": {
|
||||
QueryName: "query1",
|
||||
@ -121,6 +123,7 @@ func TestFillGaps(t *testing.T) {
|
||||
Start: 1000,
|
||||
End: 5000,
|
||||
CompositeQuery: &v3.CompositeQuery{
|
||||
PanelType: v3.PanelTypeGraph,
|
||||
BuilderQueries: map[string]*v3.BuilderQuery{
|
||||
"query1": {
|
||||
QueryName: "query1",
|
||||
@ -142,6 +145,39 @@ func TestFillGaps(t *testing.T) {
|
||||
}),
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "Single series with gaps and panel type is not graph",
|
||||
results: []*v3.Result{
|
||||
createResult("query1", []*v3.Series{
|
||||
createSeries([]v3.Point{
|
||||
{Timestamp: 1000, Value: 1.0},
|
||||
{Timestamp: 3000, Value: 3.0},
|
||||
}),
|
||||
}),
|
||||
},
|
||||
params: &v3.QueryRangeParamsV3{
|
||||
Start: 1000,
|
||||
End: 5000,
|
||||
CompositeQuery: &v3.CompositeQuery{
|
||||
PanelType: v3.PanelTypeList,
|
||||
BuilderQueries: map[string]*v3.BuilderQuery{
|
||||
"query1": {
|
||||
QueryName: "query1",
|
||||
Expression: "query1",
|
||||
StepInterval: 1,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
expected: []*v3.Result{
|
||||
createResult("query1", []*v3.Series{
|
||||
createSeries([]v3.Point{
|
||||
{Timestamp: 1000, Value: 1.0},
|
||||
{Timestamp: 3000, Value: 3.0},
|
||||
}),
|
||||
}),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
// Execute test cases
|
||||
|
Loading…
x
Reference in New Issue
Block a user