Skip to content

Traces - Update custom source display, add toast. #2403

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 3 commits into from
Apr 4, 2025

Conversation

TackAdam
Copy link
Collaborator

@TackAdam TackAdam commented Apr 4, 2025

Description

  1. Add a specific toast message for when a bucket exception happens indicating the query was to large. Was previously silently failing as the server side did not display anything for this exception.
  2. Updatd the traces display to also display the totel number of hits included in the query

Toast message:
Screenshot 2025-04-04 at 12 10 21 PM

Updated warning in corner:
Screenshot 2025-04-04 at 12 10 39 PM

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 marked this pull request as ready for review April 4, 2025 19:13
@@ -187,7 +187,7 @@ export const getTracesQuery = (
},
},
},
track_total_hits: false,
track_total_hits: true,
Copy link
Member

Choose a reason for hiding this comment

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

nit. This is true by default if we don't provide the field here.

Comment on lines 58 to 60
} catch {
// not JSON, skip
}
Copy link
Member

Choose a reason for hiding this comment

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

Should this be empty?

Copy link
Member

Choose a reason for hiding this comment

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

I think we don't a separate try catch here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Removed empty catch

@@ -35,6 +36,50 @@ export async function handleDslRequest(
const query = {
dataSourceMDSId,
};

const handleError = (error: any) => {
Copy link
Member

Choose a reason for hiding this comment

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

this function might need unit tests to make it easier to understand the examples of error variable, and to ensure there's no regression

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Extraced handleError to a helper_functions file and included tested for it
public/components/trace_analytics/requests/tests/helper_funtions.test.tsx

 PASS  public/components/trace_analytics/requests/__tests__/helper_funtions.test.tsx (5.281 s)
  handleError in handleDslRequest
    ✓ displays danger toast for too_many_buckets_exception (1 ms)
    ✓ logs error for non-bucket exceptions
    ✓ parses nested message JSON string (1 ms)

Signed-off-by: Adam Tackett <[email protected]>
@TackAdam TackAdam merged commit 74ad512 into opensearch-project:main Apr 4, 2025
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants