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

Diagnostic API and service for Inputs #20958

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Conversation

patrickmann
Copy link
Contributor

/nocl new feature
Relates to issue #20683

A new API and service to provide data for the Input Setup Wizard.
The new endpoint:
GET system/inputs/diagnostics/{inputId}

Returns a JSON data structure, currently only with a single object representing the message count by stream. We may add to this in future. E.g.:

{
  "stream_message_count": {
    "Default Stream": 204,
    "RandomGET": 179
  }
}

In case of no data we return an empty map:

{
  "stream_message_count": {}
}

@patrickmann patrickmann marked this pull request as ready for review November 14, 2024 14:53
if (errors != null && !errors.isEmpty()) {
LOG.error("An error occurred while executing aggregation: {}",
errors.stream().map(SearchError::description).collect(Collectors.joining(", ")));
return EMPTY_DIAGNOSTICS;
Copy link
Contributor

Choose a reason for hiding this comment

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

It may be better to pass the error message to the UI here, otherwise it would be a bit confusing for the user

private static AbstractMap.SimpleEntry<String, Long> extractValues(PivotResult.Row r) {
if (r.values().size() != 1) {
LOG.warn("Expected 1 value in aggregation result, but received [{}].", r.values().size());
return null;
Copy link
Contributor

Choose a reason for hiding this comment

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

Here, too, it might make more sense to throw an exception instead of displaying incomplete data.

final String streamId = r.key().get(0);
if (StringUtils.isEmpty(streamId)) {
LOG.warn("Expected a stream ID to be returned.");
return null;
Copy link
Contributor

Choose a reason for hiding this comment

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

same

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.

2 participants