Skip to content
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

Merged
merged 3 commits into from Mar 3, 2024
Merged

feat: Allow metrics and ratios in NumberChart #314

merged 3 commits into from Mar 3, 2024

Conversation

svc-shorpo
Copy link
Contributor

@svc-shorpo svc-shorpo commented Feb 18, 2024

Screenshot 2024-02-19 at 11 37 52 PM

Screenshot 2024-02-19 at 11 37 57 PM

Screenshot 2024-02-19 at 11 33 42 PM

Screenshot 2024-02-19 at 11 35 08 PM

  • make sure backwards compatible
  • make sure previously created number charts can be edited
  • make sure it works on chart explorer page

Copy link

changeset-bot bot commented Feb 18, 2024

⚠️ No Changeset found

Latest commit: e5bdf5d

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@svc-shorpo svc-shorpo force-pushed the sr/hdx-506 branch 2 times, most recently from dfed288 to 04acfe2 Compare February 19, 2024 22:37
@svc-shorpo svc-shorpo changed the title sr/hdx 506 feat: Allow metrics and ratios in NumberChart Feb 19, 2024
@svc-shorpo svc-shorpo marked this pull request as ready for review February 19, 2024 22:40
MikeShi42
MikeShi42 previously approved these changes Feb 19, 2024
);
const isLogsChartApi = table === 'logs' && series.length === 1;

const { data, isError, isLoading } = isLogsChartApi
Copy link
Contributor

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?

Copy link
Contributor Author

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?

Copy link
Contributor

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.

Copy link
Contributor Author

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?

Copy link
Contributor

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?

Copy link
Contributor Author

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

Copy link
Contributor Author

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)

kodiakhq bot pushed a commit that referenced this pull request Mar 3, 2024
Going to remove `NumberChart` and `api.useMetricsChart` in #314
@kodiakhq kodiakhq bot merged commit a7abd2c into main Mar 3, 2024
4 checks passed
@kodiakhq kodiakhq bot deleted the sr/hdx-506 branch March 3, 2024 10:13
colehpage pushed a commit to colehpage/hyperdx that referenced this pull request Mar 7, 2024
colehpage pushed a commit to colehpage/hyperdx that referenced this pull request Mar 7, 2024
![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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants