New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Allow metrics and ratios in NumberChart #314
Conversation
svc-shorpo
commented
Feb 18, 2024
•
edited
edited
- make sure backwards compatible
- make sure previously created number charts can be edited
- make sure it works on chart explorer page
|
dfed288
to
04acfe2
Compare
packages/app/src/HDXNumberChart.tsx
Outdated
); | ||
const isLogsChartApi = table === 'logs' && series.length === 1; | ||
|
||
const { data, isError, isLoading } = isLogsChartApi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think we can just use the multi-series for everything here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
technically we can, but would it make sense performance-wise? locally multi-series api is slower
now that i think about it, would it make sense to pass startDate: endDate - granularity
here to only get latest value?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yeah definitely it makes sense to only send one window's worth of data over.
One thing that might be weird is that the backend ts bucketing is based on fixed windows (ex. 0:05, 0:10, 0:15) whereas endDate - granularity might give you something like 0:07 - 0:12
, which would incorrectly straddle two windows. I think there's a TS function to get the right granularity window, but alternatively you can just subtract 2x granularity to make sure we have at least 1 full granularity window.
The other weird thing would be the latest granularity window might have incomplete data... (ex. it's 0:12, and the last window is 0:10 to 0:12) I'm not sure what we can do about that per-se.
For multi-series, if we can, we should try to migrate as much possible into multi-series as possible, just from the maintenance perspective. Will ping you about the perf issues you're seeing though, as it shouldn't be noticeably slower.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pushed changes. i think it works, but ran into this edge case:
if I use count
or count_distinct
aggfn, the data is different between useLogsChart
and useMultiSeriesChart
, since we don't pass granularity
to useLogsChart
. should we pass full startDate - endDate
window and granularity: null
for certain AggFn or what would be desired behavior be?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahhh okay, now that I think about it more, I think it makes sense to actually continue to use the entire time range and set granularity to undefined. Does that break any of the metric charts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, i think that works
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rebased and pushed changes (use entire time range and set granularity to undefined)
Going to remove `NumberChart` and `api.useMetricsChart` in #314
…perdxio#329) Going to remove `NumberChart` and `api.useMetricsChart` in hyperdxio#314
![Screenshot 2024-02-19 at 11 37 52 PM](https://github.com/hyperdxio/hyperdx/assets/149748269/74a28fd3-8a25-46c6-af88-85762cc51b5e) ![Screenshot 2024-02-19 at 11 37 57 PM](https://github.com/hyperdxio/hyperdx/assets/149748269/ff57756a-ed73-4f9c-bac3-20c265751447) ![Screenshot 2024-02-19 at 11 33 42 PM](https://github.com/hyperdxio/hyperdx/assets/149748269/beebcaf4-f6b1-423c-9c3b-580ddeb1bfe0) ![Screenshot 2024-02-19 at 11 35 08 PM](https://github.com/hyperdxio/hyperdx/assets/149748269/631159ec-d2ec-45cd-97db-0d2243675c93) - [x] make sure backwards compatible - [x] make sure previously created number charts can be edited - [x] make sure it works on chart explorer page