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

fix(app): negative duration in search #28

Merged
merged 6 commits into from
Sep 24, 2023

Conversation

mark-omarov
Copy link
Contributor

@mark-omarov mark-omarov commented Sep 22, 2023

Closes #15

Proposed change:
Display "N/A" instead of negative numbers for columns not supporting the duration property.

Alternatives considered:

  • Update APIs to return null or omit the field - it would still require changes on the UI
  • Change the DB model to use null or 0 as a value when end_timestamp is missing - requires a DB migration for all existing users, probably not a good idea
  • Reformat data on the API response in the useSearchEventStream - complicates already complicated hook, plus the LogTable component already had to use the accessorFn, might as well use it

@changeset-bot
Copy link

changeset-bot bot commented Sep 22, 2023

🦋 Changeset detected

Latest commit: ee3e6a3

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@hyperdx/app Patch

Not sure what this means? Click here to learn what changesets are.

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

@mark-omarov
Copy link
Contributor Author

The issue is going to be resolved differently, as mentioned in the #15

@wrn14897 wrn14897 reopened this Sep 23, 2023
@wrn14897
Copy link
Contributor

Hey @mark-omarov ,

If you are still interested, we'd love to get this fix out.
We still want to keep the current behavior on the ingestor side and the way we think about duration field for logs (should be nullable).
Thanks for contributing to the repo 🙏

MikeShi42
MikeShi42 previously approved these changes Sep 23, 2023
Copy link
Contributor

@MikeShi42 MikeShi42 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks awesome! It's good to merge as-is.

I have two minor suggestions we can do later if you'd like:

  1. It'd be awesome if the value is N/A, that we assign the class as text-muted so it's less distracting in the UI.
  2. I think null might work better than N/A in the UI, since it is technically null (though I know in the DB it isn't actually nullable, due to performance reasons)

@@ -13,6 +13,7 @@ import cx from 'classnames';
import { Button, Modal } from 'react-bootstrap';
import stripAnsi from 'strip-ansi';
import { CSVLink } from 'react-csv';
import { curry } from 'lodash';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

optional nit: we don't have any tree-shaking for lodash built in the build chain so it'd be preferable to do import curry from lodash/curry. However, we already import all of lodash in a few other components and it needs to be made consistent across the entire code base.

We can merge this as-is, since we're already inconsistent, and I made a follow-up issue addressing the broader issue in our code base #36

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking a look! I just pushed the update
I could work on #36 as well, if you don't mind

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MikeShi42 I went ahead and opened an issue based on your comment to make things better down the line. Hope that's cool with you. Ref: #37

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for #37! And it looks like someone already jumped on #36 with a PR (#38)

Copy link
Contributor

@MikeShi42 MikeShi42 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks awesome, thank you! 😄

@MikeShi42 MikeShi42 merged commit 8b103f3 into hyperdxio:main Sep 24, 2023
2 checks passed
@mark-omarov mark-omarov deleted the fix/negative-duration-in-search branch September 24, 2023 22:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Duration column in search shows negative number if only timestamp present
3 participants