8000 [FEATURE] Add Join and Merge transformations to Table panel by Gladorme · Pull Request #2359 · perses/perses · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[FEATURE] Add Join and Merge transformations to Table panel #2359

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

Merged
merged 20 commits into from
Oct 28, 2024

Conversation

Gladorme
Copy link
Member
@Gladorme Gladorme commented Oct 21, 2024

Description

Add transformations to Table panel, made it common so other panels could implement it too.
BREAKING CHANGE: on Table panel, columns are not merged anymore by default. If there are multiple queries returning same labels, columns name will be indexed (#1, #2 #...)

Two transformations available for now:

Merge Columns: Merge multiple columns to 1 column

timestamp value #1 value #2 mount #1 mount #2
1630000000 1 /
1630000000 2 /boot/efi
1630000000 3 /
1630000000 4 /boot/efi

Example with "value #1" and "value #2" merged to "MERGED":

timestamp MERGED mount #1 mount #2
1630000000 1 /
1630000000 2 /boot/efi
1630000000 2 /
1630000000 3 /boot/efi

Merge series: It will merge series (join by too) all columns except "value #..."

timestamp value #1 value #2 mount #1 mount #2 instance #1 instance #2 env #1 env #2
1630000000 1 / test:44 prd
1630000000 2 /boot/efi test:44 prd
1630000000 5 / test:44 prd
1630000000 6 /boot/efi test:44 prd

Result:

timestamp value #1 value #2 mount instance env
1630000000 1 5 / test:44 prd
1630000000 2 6 /boot/efi test:44 prd

Merge Indexed Columns: All indexed columns are merged to one column

timestamp #1 timestamp #2 value #1 value #2 instance #1 instance #2
1630000000 55 toto
1630000000 33 toto
1630000000 45 toto
1630000000 112 titi
1630000000 20 titi
1630000000 10 titi

If merge with column: "value":

timestamp #1 timestamp #2 value instance #1 instance #2
1630000000 55 toto
1630000000 33 toto
1630000000 45 toto
1630000000 112 titi
1630000000 20 titi
1630000000 10 titi

Join: Regroup rows with equal cell value in a column.

If there are multiple line with same value, next row values override the current one

timestamp #1 timestamp #2 value #1 value #2 instance
1630000000 150 toto
1630000000 10 toto
1630000000 45 toto
1630000000 1 titi
1630000000 99 titi
1630000000 10 titi

If join on column "instance":

timestamp #1 timestamp #2 value #1 value #2 instance
1630000000 45 toto
1630000000 10 titi

Other example with join on "mount":

timestamp value #1 value #3 mount
1630000000 1 /
1630000000 2 /boot/efi
1630000000 3 /
1630000000 4 /boot/efi

Result:

timestamp value #1 value #3 mount
1630000000 1 3 /
1630000000 2 4 /boot/efi

Then you can use column setting to rename :)

Screenshots

image

Merge series:
#2359

Checklist

  • Pull request has a descriptive title and context useful to a reviewer.
  • Pull request title follows the [<catalog_entry>] <commit message> naming convention using one of the
    following catalog_entry values: FEATURE, ENHANCEMENT, BUGFIX, BREAKINGCHANGE, DOC,IGNORE.
  • All commits have DCO signoffs.

UI Changes

  • Changes that impact the UI include screenshots and/or screencasts of the relevant changes.
  • Code follows the UI guidelines.
  • Visual tests are stable and unlikely to be flaky.
    See Storybook
    and e2e docs for more details. Common issues
    include:
    • Is the data inconsistent? You need to mock API requests.
    • Does the time change? You need to use consistent time values or mock time utilities.
    • Does it have loading states? You need to wait for loading to complete.

Signed-off-by: Guillaume LADORME <Gladorme@users.noreply.github.com>
Signed-off-by: Guillaume LADORME <Gladorme@users.noreply.github.com>
Signed-off-by: Guillaume LADORME <Gladorme@users.noreply.github.com>
Signed-off-by: Guillaume LADORME <Gladorme@users.noreply.github.com>
Signed-off-by: Guillaume LADORME <Gladorme@users.noreply.github.com>
Signed-off-by: Guillaume LADORME <Gladorme@users.noreply.github.com>
Signed-off-by: Guillaume LADORME <Gladorme@users.noreply.github.com>
Signed-off-by: Guillaume LADORME <Gladorme@users.noreply.github.com>
@Gladorme
Copy link
Member Author

Should close #2341 too

Signed-off-by: Guillaume LADORME <Gladorme@users.noreply.github.com>
Signed-off-by: Guillaume LADORME <Gladorme@users.noreply.github.com>
@Gladorme
Copy link
Member Author
Gladorme commented Oct 21, 2024

Adding kind: "Transform" is maybe overkill, I was thinking of the future: if we allow plugin to inject their own transformations? 🤔

@Gladorme Gladorme marked this pull request as ready for review October 21, 2024 14:16
Signed-off-by: Guillaume LADORME <Gladorme@users.noreply.github.com>
Signed-off-by: Guillaume LADORME <Gladorme@users.noreply.github.com>
Signed-off-by: Guillaume LADORME <Gladorme@users.noreply.github.com>
Signed-off-by: Guillaume LADORME <Gladorme@users.noreply.github.com>
@Gladorme Gladorme force-pushed the gladorme/table-merge branch 2 times, most recently from c996d08 to d490e6e Compare October 24, 2024 10:28
Signed-off-by: Guillaume LADORME <Gladorme@users.noreply.github.com>
@Gladorme Gladorme force-pushed the gladorme/table-merge branch from d490e6e to 412e062 Compare October 24, 2024 10:50
@andreasgerstmayr
Copy link
Contributor

I just tested the "Merge series" transformation with RED metrics. Works great! 🚀
In a follow-up PR we can evaluate if we can also show range queries / embed other panels in the cell of the table (ref #2290 (reply in thread))

Signed-off-by: Guillaume LADORME <Gladorme@users.noreply.github.com>
Signed-off-by: Guillaume LADORME <Gladorme@users.noreply.github.com>
Signed-off-by: Guillaume LADORME <Gladorme@users.noreply.github.com>
@Gladorme Gladorme force-pushed the gladorme/table-merge branch from 5e0accb to 235db1c Compare October 25, 2024 16:42
@Gladorme Gladorme force-pushed the gladorme/table-merge branch 2 times, most recently from 0800f4e to ae4bd74 Compare October 28, 2024 09:45
Signed-off-by: Guillaume LADORME <Gladorme@users.noreply.github.com>
@Gladorme Gladorme force-pushed the gladorme/table-merge branch 2 times, most recently from 042b267 to 456bcab Compare October 28, 2024 11:11
Copy link
Member
@Nexucis Nexucis left a comment

Choose a reason for hiding this comment

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

well done @Gladorme, cool to see this arriving in Perses !

@Gladorme Gladorme force-pushed the gladorme/table-merge branch from 456bcab to 48d9dd4 Compare October 28, 2024 12:53
Signed-off-by: Guillaume LADORME <Gladorme@users.noreply.github.com>
@Gladorme Gladorme force-pushed the gladorme/table-merge branch from 48d9dd4 to cd48da9 Compare October 28, 2024 13:04
Copy link
Contributor
@AntoineThebaud AntoineThebaud left a comment

Choose a reason for hiding this comment

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

Awesome let's goo🚀

@Gladorme Gladorme enabled auto-merge October 28, 2024 13:12
@Gladorme Gladorme added this pull request to the merge queue Oct 28, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Oct 28, 2024
@Gladorme Gladorme added this pull request to the merge queue Oct 28, 2024
Merged via the queue into main with commit 6b30f25 Oct 28, 2024
18 checks passed
@Gladorme Gladorme deleted the gladorme/table-merge branch October 28, 2024 13:34
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.

4 participants
0