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

make timeout and terminate_after configurable #17423

Closed
wants to merge 6 commits into from

Conversation

nreese
Copy link
Contributor

@nreese nreese commented Mar 27, 2018

fixes #17388 and #17156

Add inputs to configure timeout and terminate_after parameters used when fetching terms for the options list.

screen shot 2018-03-27 at 11 20 07 am

Generated search request

{"index":["logstash*"],"ignore_unavailable":true,"preference":1522170987330}
{"timeout":"5s","terminate_after":10000000,"size":0,"aggs":{"termsAgg":{"terms":{"size":5,"order":{"_count":"desc"},"field":"bytes"}}},"_source":{"excludes":[]},"stored_fields":["*"],"script_fields":{},"docvalue_fields":["@timestamp","relatedContent.article:modified_time","relatedContent.article:published_time","utc_time"],"query":{"bool":{"must":[],"filter":[],"should":[],"must_not":[]}}}

PR also adds visual notification when terms search terminated early.
screen shot 2018-03-27 at 1 35 48 pm

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@chrisdavies
Copy link
Contributor

Might be an EUI thing (?) but the icons in your screenshots seem crammed right up to the text:

image

Maybe you should put a {' '} in your markup to force a space at the end of the text?

Copy link
Contributor

@chrisdavies chrisdavies left a comment

Choose a reason for hiding this comment

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

LGTM w/ possible tweaks.

<EuiIconTip
content={`Terms search timeout (seconds),
bounding the terms request to be executed within the specified time value and
bail with the hits accumulated up to that point when expired.`}
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm an Elasticsearch n00b, so this is probably my fault, but I find this verbiage a bit confusing. I'm happy to kick around ideas for how to clear it up.

label={(
<Fragment>
Terminate After
<EuiIconTip
Copy link
Contributor

Choose a reason for hiding this comment

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

This is fine. But "Terminate After" might be clearer if it was "Max Number of Documents" or something like that. To me, "Terminate After" implies a duration, such as "Terminate after so many seconds of execution" or something like that.

@@ -16,9 +17,24 @@ export function FormRow(props) {
);
}

let label = props.label;
Copy link
Contributor

Choose a reason for hiding this comment

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

Might consider moving the conditional out into a helper function:

function renderLabel({ label, control }) {
  if (!control.warning || control.warning.length === 0) {
    return label;
  }

  return (
    <Fragment>
      {label}
      <EuiIconTip
        content={control.warning}
        position="right"
        type="alert"
        aria-label="Warning"
      />
    </Fragment>
  );
}

So this would become:

  return (
    <EuiFormRow
      label={renderLabel(props)}
      id={props.id}
      data-test-subj={'inputControl' + props.controlIndex}
    >
      {control}
    </EuiFormRow>
  );

Same goes for the let control = props.children section.

timeout: '1s',
terminate_after: 100000
timeout: `${_.get(this.options, 'timeout', DEFAULT_TIMEOUT)}s`,
terminate_after: _.get(this.options, 'terminateAfter', DEFAULT_TERMINATE_AFTER)
Copy link
Contributor

Choose a reason for hiding this comment

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

Same comment here, I think terminate_after is a bit misleading. max_result_set_size or max_num_docs or something might be clearer. Also, should it be camelCased instead of snake_cased?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have to use terminate_after here because it is an Elasticsearch parameter, https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-body.html#_parameters_4.

But I can change the label and description in the UI. Although, it might make sense to stay with Elasticsearch naming schemes since there are really just ways to allow users to configure elasticsearh parameters.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yup. Agreed that it's best to stick w/ the Elasticsearch terminology. I wasn't aware of that!

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Copy link
Contributor

@Bargs Bargs left a comment

Choose a reason for hiding this comment

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

I’m concerned with giving every single kibana user the power to turn off the only safeguards we have preventing them from accidentally taking down a cluster.

I quickly scanned the linked issues, it looked to me like the main issue was the return of partial results, is that correct? If so, we could take advantage of elasticsearch’s new capabilities to return an error instead of partial results when a timeout is hit. We could put these settings in kibana.yml, and if a user needs it they could ask their admin to increase the limit.

Perhaps there are better solutions too, my primary concern is with putting these settings in the hands of users who do not fully understand them.

@nreese
Copy link
Contributor Author

nreese commented Apr 9, 2018

@stacey-gammon Is this possible to get into 6.3 as is? @lukasolson posted a comment about using the suggestions API for fetching the terms and maybe adding support for dynamic terminate_after and timeout.

Regardless of underlying implementation, users need to able to configure terminate_after and timeout. This PR solves the immediate need and the underlying implementation for fetching terms could be swapped out at a later time.

@nreese
Copy link
Contributor Author

nreese commented Apr 9, 2018

I’m concerned with giving every single kibana user the power to turn off the only safeguards we have preventing them from accidentally taking down a cluster.

How is this any different than letting a user create a visualization with a terms aggregation over a large time range?

@Bargs
Copy link
Contributor

Bargs commented Apr 9, 2018

How is this any different than letting a user create a visualization with a terms aggregation over a large time range?

That request is still constrained by the admin configured elasticsearch.shardTimeout setting in kibana.yml. This PR will give regular users the ability to circumvent safeguards the admin has put in place.

Even if that weren't the case, we're trying to reduce the number of ways users can take down a cluster, not increase them.

@stacey-gammon
Copy link
Contributor

I don't think we should rush this into 6.3 because of the concerns mentioned. What do you think about solving this issue by letting user type in a value that doesn't appear in the drop down like the discover input text box does? I don't think we have to rush a fix for this into 6.3 that could have some pretty bad side affects.

This PR solves the immediate need and the underlying implementation for fetching terms could be swapped out at a later time.

As soon as we expose these options, we can't get rid of them without BWC issues. So even if we later solve the problem by letting users type in a value that doesn't show up in the drop down, we still can't easily remove these settings with first deprecating them, then waiting for a major version release to get rid of completely.

@nreese nreese added v6.4.0 and removed v6.3.0 labels Apr 9, 2018
@nreese
Copy link
Contributor Author

nreese commented Jun 29, 2018

Closing, #18985 updates dropdown suggestions when filtered. This should help avoid the problem of early termination.

@nreese nreese closed this Jun 29, 2018
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.

Controls visualization should have configurable timeout and terminate_after
5 participants