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

Custom Traces- Sorting/Toast #2397

Merged
merged 4 commits into from
Apr 3, 2025
Merged

Conversation

TackAdam
Copy link
Collaborator

@TackAdam TackAdam commented Apr 1, 2025

Description

  1. Add a default sorting of descending time while in the custom trace mode for spans/traces.
  2. Fix the sorting of the tracing table under custom source to use the paginated results for 'trace_group', 'percentile_in_trace_group', 'trace_id' as they can not be ran in the query. (Matching behavior of old memory table)
  3. Add early return to the traces/custom traces request handlers to prevent toast messages on empty data.
  4. Update cypress testing for the custom source to account for the results being sorted now.

Before with invalid/empty span
Before
After
InvalidSpan

Invalid sorting that required it to be local only:
InvalidSort

Issues Resolved

Check List

  • New functionality includes testing.
    • All tests pass, including unit test, integration test and doctest
  • New functionality has been documented.
    • New functionality has javadoc added
    • New functionality has user manual doc added
  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@TackAdam TackAdam added bug Something isn't working backport 2.x labels Apr 1, 2025
@TackAdam TackAdam marked this pull request as ready for review April 1, 2025 21:31
@TackAdam TackAdam changed the title Traces- Sorting/Toast Custom Traces- Sorting/Toast Apr 1, 2025
@@ -95,43 +101,40 @@ export function TracesContent(props: TracesProps) {

setSortingColumns(sortColumns);

const localOnlyFields = ['trace_group', 'percentile_in_trace_group', 'trace_id'];
Copy link
Member

Choose a reason for hiding this comment

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

maybe add some comments to explain what local only means, for future reference

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Added comment
// The columns that can not be used in a query, only rendered on page

page
);

const isUnderOneHour = datemath.parse(endTime)?.diff(datemath.parse(startTime), 'hours')! < 1;
Copy link
Member

Choose a reason for hiding this comment

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

util functions like this can be extracted, i see the same logic is also used in other places

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

added helper function isUnderOneHourRange

export const isUnderOneHourRange = (startTime: string, endTime: string): boolean => {
  const start = dateMath.parse(startTime);
  const end = dateMath.parse(endTime);

  if (!start || !end) return false;

  return end.diff(start, 'hours')! < 1;
};

Signed-off-by: Adam Tackett <[email protected]>
Copy link

codecov bot commented Apr 1, 2025

Codecov Report

Attention: Patch coverage is 17.33333% with 62 lines in your changes missing coverage. Please review.

Project coverage is 55.88%. Comparing base (5cfbba1) to head (8198f57).
Report is 30 commits behind head on main.

Files with missing lines Patch % Lines
...ace_analytics/components/traces/traces_content.tsx 16.66% 35 Missing ⚠️
...trace_analytics/requests/traces_request_handler.ts 3.57% 27 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2397      +/-   ##
==========================================
- Coverage   56.53%   55.88%   -0.65%     
==========================================
  Files         393      397       +4     
  Lines       15574    16061     +487     
  Branches     4284     4467     +183     
==========================================
+ Hits         8804     8976     +172     
- Misses       6705     7015     +310     
- Partials       65       70       +5     
Flag Coverage Δ
dashboards-observability 55.88% <17.33%> (-0.65%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@TackAdam TackAdam merged commit fc2fd14 into opensearch-project:main Apr 3, 2025
18 of 20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants