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

Timeseries to table transformation: Update Output Changes #77415

Merged
merged 12 commits into from
Nov 2, 2023

Conversation

codeincarnate
Copy link
Contributor

@codeincarnate codeincarnate commented Oct 31, 2023

What is this feature?

When addressing issues with the Time Series to table transformation we accidentally broke backwards compatibility. This PR attempts to address that while still fixing the underlying issue. Namely that multiple series being returned from a single query were not being handled correctly.

This can be seen with the React Table gdev-dashboard which previously would only show one row, even though it should be showing 3 as each query has 3 series returned.

This also returns the functionality of breaking out labels into individual fields.

showing all timeseries

Why do we need this feature?

To preserve backwards compatability of this transform while still working for cases with multiple series.

Please check that:

  • It works as expected from a user's perspective.
  • If this is a pre-GA feature, it is behind a feature toggle.
  • The docs are updated, and if this is a notable improvement, it's added to our What's New doc.

@domasx2
Copy link
Contributor

domasx2 commented Oct 31, 2023

Tested, app o11y back to normal 👍

Namely that multiple series being returned from a single query were not being handled correctly.
This can be seen with the React Table gdev-dashboard which previously would only show one row, even though it should be showing 3 as each query has 3 series returned.

It was definitely handling multiple series from a single query. I think I get it now, the case that it wasn't handling is multiple series with the same exact label values. Did not know that can happen with "real" data sources

Not related to app o11y, but looks weird:
image

It seems it's picking up all time fields of all data frames, ending up with at least as many identical options as there are series returned. I'm guess the intention here is to handle the case when there are multiple time fields in a single data frame, so should probably only contain distinctly named fields

Copy link
Member

@torkelo torkelo left a comment

Choose a reason for hiding this comment

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

Would be good to restore the unit tests changed in #76801

and add additional tests for the new scenarios/cases added in that PR

I do agree that the transform could be improved for queries that return multiple series with same labels (or no labels) but different display names (For value field), the old behavior there was too limited to only look at labels and not also take into account display name for the value field (or frame name).

@codeincarnate
Copy link
Contributor Author

Thanks for the feedback @domasx2 and @torkelo 🙂. I'm going to be getting this implemented asap.

@codeincarnate
Copy link
Contributor Author

codeincarnate commented Oct 31, 2023

I put the original tests back in with very slight updates to some of the tests, in particular the order of frames is coming out differently than originally. I don't believe this has an impact beyond the indexes for referencing the results.

@domasx2 I did have a question about this test. I'm a bit surprised this is expecting two frames. Seems like it should be one frame since incoming frames are mapped onto fields instead. Feel like I'm missing something here?

@domasx2
Copy link
Contributor

domasx2 commented Oct 31, 2023

I'm a bit surprised this is expecting two frames. Seems like it should be one frame since incoming frames are mapped onto fields instead. Feel like I'm missing something here?

It maps each refId (query) onto a separate data frame. Same behavior as with prometheus "table" queries. Different queries may have separate, even non overlapping, sets of labels. It may not make sense to smush them into a single table. But "join" or "merge" transforms can be used to further merge into a single data frame based on some join criteria if wanted

@codeincarnate
Copy link
Contributor Author

Thanks for the feedback @domasx2. Working through that now

@codeincarnate codeincarnate added no-backport Skip backport of PR no-changelog Skip including change in changelog/release notes labels Oct 31, 2023
@codeincarnate codeincarnate marked this pull request as ready for review October 31, 2023 18:20
@codeincarnate codeincarnate requested review from a team, oscarkilhed and mdvictor and removed request for a team October 31, 2023 18:21
@codeincarnate
Copy link
Contributor Author

codeincarnate commented Oct 31, 2023

Worked out the tests and I believe that this should be good to go now

Oops: realized I forgot about the time field selection. Looking at that right now

@codeincarnate
Copy link
Contributor Author

Added code to restrict time field selection as well. It assumes that all time fields within frames with the same refId are the same. This may not always be true, but seems like it should be in the majority of circumstances. Would definitely appreciate another look @domasx2 and @torkelo 🙏

@bfmatei
Copy link
Contributor

bfmatei commented Nov 1, 2023

Hey @codeincarnate !

I don't have the context for reviewing the code but I would like to mention that I did test out your branch w/ the app observability plugin and it seems that the fix is working fine for our cases.

@domasx2
Copy link
Contributor

domasx2 commented Nov 2, 2023

please merge ASAP, it's currently broken for customers

Copy link
Contributor

@mdvictor mdvictor left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@oscarkilhed oscarkilhed left a comment

Choose a reason for hiding this comment

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

Tested this out, and it seem to work as expected.

@mdvictor
Copy link
Contributor

mdvictor commented Nov 2, 2023

@torkelo would you like to add anything to this or are we good to merge?

@codeincarnate codeincarnate merged commit e714c93 into main Nov 2, 2023
10 checks passed
@codeincarnate codeincarnate deleted the transform/time-series-more-table branch November 2, 2023 15:25
zserge pushed a commit that referenced this pull request Nov 9, 2023
* Break out labels into separate fields

* More Updates

* Minor test changes

* Use 'A' for transformed refId

* Make sure tests pass

* Add additional test

* Prettier

* Remove dead comment

* Update time field selection options

* remove console.log

---------

Co-authored-by: Victor Marin <victor.marin@grafana.com>
@aangelisc aangelisc modified the milestones: 10.3.x, 10.2.3 Dec 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/frontend no-backport Skip backport of PR no-changelog Skip including change in changelog/release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants