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

Ability to select order (Desc/Asc) for "raw data" metrics aggregations #88

Merged
merged 5 commits into from
May 24, 2023

Conversation

lvta0909
Copy link
Contributor

What?
Add ability to select the query order for "raw data" metric agreggation.

Why?
Sometimes it is needed to query the firsts X documents starting from a defined time. With the default query order as Descending it was not directly possible as it would give the lasts X documents from the ending time.
The ability to choose the order solves this limitation.
This functionality is available only to "raw data" and "raw document" metric queries.

order_example

@lvta0909 lvta0909 requested a review from a team as a code owner November 19, 2022 16:44
@CLAassistant
Copy link

CLAassistant commented Nov 19, 2022

CLA assistant check
All committers have signed the CLA.

@matyax matyax changed the title Hability to select order (Desc/Asc) for "raw data" metrics agreggations Ability to select order (Desc/Asc) for "raw data" metrics agreggations Nov 19, 2022
@gabor gabor requested review from a team, fridgepoet and iwysiu and removed request for a team March 13, 2023 09:04
@gabor gabor removed the request for review from a team March 23, 2023 08:25
@fridgepoet fridgepoet removed their request for review April 13, 2023 14:15
@sarahzinger sarahzinger requested a review from a team as a code owner May 18, 2023 19:38
@sarahzinger sarahzinger requested review from sarahzinger and removed request for a team May 18, 2023 19:38
@sarahzinger
Copy link
Member

@lvta0909 sorry for the delay in reviewing, this looks really good to me! I merged in master and made some minor changes if you'd like to take a look!

@sarahzinger sarahzinger self-assigned this May 18, 2023
@sarahzinger
Copy link
Member

@iwysiu mind reviewing this since I added a few more commits? I can merge/release once you think it looks good.

@sarahzinger
Copy link
Member

Also I believe the build is failing because the levity check fails for all external contributors right now.

Copy link
Contributor

@iwysiu iwysiu left a comment

Choose a reason for hiding this comment

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

Beyond a couple style comments, nice! Though as a note, do we want desc to be in the label when the order isn't settable? While it's still true, it's a bit confusing
Screenshot 2023-05-18 at 5 31 18 PM

const newOrderValue = 'asc';
await userEvent.click(screen.getByText('Ascending'));
expect(onChange).toHaveBeenCalledTimes(2);
// expect(onChange).toHaveBeenCalledWith(expect.objectContaining({'order' : 'asc'}));
Copy link
Contributor

Choose a reason for hiding this comment

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

should this be removed/uncommented?

@@ -28,6 +28,8 @@ interface Props {
previousMetrics: MetricAggregation[];
}

const orderLabel = 'Test Order select Container';
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think this needs to be a separate variable

Copy link
Contributor

Choose a reason for hiding this comment

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

Removed this altogether, since afaik InlineField doesn't need an explicit arial-label

@@ -256,3 +258,9 @@ export const getChildren = (metric: MetricAggregation, metrics: MetricAggregatio

return [...children, ...children.flatMap(child => getChildren(child, metrics))];
};

// TODO: Define better types for the following
export const orderOptions = [
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
export const orderOptions = [
export const orderOptions: Array<SelectableValue<string>> = [

@sarahzinger sarahzinger removed their request for review May 22, 2023 14:01
@idastambuk idastambuk requested a review from iwysiu May 23, 2023 10:12
@idastambuk idastambuk merged commit 21ad7a1 into grafana:main May 24, 2023
3 of 4 checks passed
@fridgepoet fridgepoet mentioned this pull request May 25, 2023
@fridgepoet fridgepoet changed the title Ability to select order (Desc/Asc) for "raw data" metrics agreggations Ability to select order (Desc/Asc) for "raw data" metrics aggregations May 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

6 participants