Skip to content

Commit 50ce38f

Browse files
authored
test: histogram metric query integration tests (#692)
Pulls a set of test cases from the v1 code base that checks histogram metric queries against different quantile and queries for edge bounds as well. Ref: HDX-1425
1 parent 2e350e2 commit 50ce38f

File tree

6 files changed

+506
-47
lines changed

6 files changed

+506
-47
lines changed

.changeset/breezy-humans-crash.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@hyperdx/common-utils": patch
3+
"@hyperdx/api": patch
4+
---
5+
6+
Histogram metric query test cases

packages/api/src/clickhouse/__tests__/__snapshots__/renderChartConfig.test.ts.snap

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,3 +157,85 @@ Array [
157157
},
158158
]
159159
`;
160+
161+
exports[`renderChartConfig Query Metrics three_timestamps_bounded histogram with reset (p50) 1`] = `
162+
Array [
163+
Object {
164+
"__hdx_time_bucket": "2022-01-05T00:00:00Z",
165+
"sum(toFloat64OrNull(toString(Rate)))": 10,
166+
},
167+
Object {
168+
"__hdx_time_bucket": "2022-01-05T00:01:00Z",
169+
"sum(toFloat64OrNull(toString(Rate)))": 10,
170+
},
171+
Object {
172+
"__hdx_time_bucket": "2022-01-05T00:02:00Z",
173+
"sum(toFloat64OrNull(toString(Rate)))": 30,
174+
},
175+
]
176+
`;
177+
178+
exports[`renderChartConfig Query Metrics two_timestamps_bounded histogram (p25) 1`] = `
179+
Array [
180+
Object {
181+
"__hdx_time_bucket": "2022-01-05T00:00:00Z",
182+
"sum(toFloat64OrNull(toString(Rate)))": 0,
183+
},
184+
Object {
185+
"__hdx_time_bucket": "2022-01-05T00:01:00Z",
186+
"sum(toFloat64OrNull(toString(Rate)))": 10,
187+
},
188+
]
189+
`;
190+
191+
exports[`renderChartConfig Query Metrics two_timestamps_bounded histogram (p50) 1`] = `
192+
Array [
193+
Object {
194+
"__hdx_time_bucket": "2022-01-05T00:00:00Z",
195+
"sum(toFloat64OrNull(toString(Rate)))": 0,
196+
},
197+
Object {
198+
"__hdx_time_bucket": "2022-01-05T00:01:00Z",
199+
"sum(toFloat64OrNull(toString(Rate)))": 20,
200+
},
201+
]
202+
`;
203+
204+
exports[`renderChartConfig Query Metrics two_timestamps_bounded histogram (p90) 1`] = `
205+
Array [
206+
Object {
207+
"__hdx_time_bucket": "2022-01-05T00:00:00Z",
208+
"sum(toFloat64OrNull(toString(Rate)))": 0,
209+
},
210+
Object {
211+
"__hdx_time_bucket": "2022-01-05T00:01:00Z",
212+
"sum(toFloat64OrNull(toString(Rate)))": 30,
213+
},
214+
]
215+
`;
216+
217+
exports[`renderChartConfig Query Metrics two_timestamps_lower_bound_inf histogram (p50) 1`] = `
218+
Array [
219+
Object {
220+
"__hdx_time_bucket": "2022-01-05T00:00:00Z",
221+
"sum(toFloat64OrNull(toString(Rate)))": 0,
222+
},
223+
Object {
224+
"__hdx_time_bucket": "2022-01-05T00:01:00Z",
225+
"sum(toFloat64OrNull(toString(Rate)))": 1,
226+
},
227+
]
228+
`;
229+
230+
exports[`renderChartConfig Query Metrics two_timestamps_upper_bound_inf histogram (p50) 1`] = `
231+
Array [
232+
Object {
233+
"__hdx_time_bucket": "2022-01-05T00:00:00Z",
234+
"sum(toFloat64OrNull(toString(Rate)))": 0,
235+
},
236+
Object {
237+
"__hdx_time_bucket": "2022-01-05T00:01:00Z",
238+
"sum(toFloat64OrNull(toString(Rate)))": 30,
239+
},
240+
]
241+
`;

0 commit comments

Comments
 (0)