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

[Feedback Needed][Search] Use session service on a dashboard #81192

Closed
wants to merge 1 commit into from

Conversation

Dosant
Copy link
Contributor

@Dosant Dosant commented Oct 20, 2020

Summary

Follow up on #76889
Uses session service on a dashboard.

Notes:

  1. Explicitly passes sessionId as embeddable input
  • Visualize
  • Lens
  • Search
  • Maps
  • Anything else?
  1. Added sessionId displayed in inspector. Plan to use it in a functional test.
  2. (For now session id is only needed to group errors)

Checklist

Delete any items that are not applicable to this PR.

For maintainers

@Dosant Dosant added Feature:Search Querying infrastructure in Kibana Team:AppArch labels Oct 20, 2020
@Dosant Dosant changed the title [discuss][Search] Pass session id on a dashboard [discuss][Search] Use session service on a dashboard Oct 20, 2020
@@ -1109,12 +1111,6 @@ export class DashboardAppController {
$scope.model.filters = filterManager.getFilters();
$scope.model.query = queryStringManager.getQuery();
dashboardStateManager.applyFilters($scope.model.query, $scope.model.filters);
if (dashboardContainer) {
dashboardContainer.updateInput({
Copy link
Contributor Author

@Dosant Dosant Oct 20, 2020

Choose a reason for hiding this comment

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

This is not needed and handled by refreshDashboardContainer. Looking forward to this file being refactored.
If keep it as is, the it would create redundant session ids.

@@ -590,7 +591,8 @@ export class DashboardAppController {
const refreshDashboardContainer = () => {
const changes = getChangesFromAppStateForContainerState();
if (changes && dashboardContainer) {
dashboardContainer.updateInput(changes);
const sessionId = searchService.session.start();
dashboardContainer.updateInput({ ...changes, searchSessionId: sessionId });
Copy link
Contributor Author

@Dosant Dosant Oct 20, 2020

Choose a reason for hiding this comment

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

@lizozom, @lukasolson, @ppisljar, I am passing the sessionId down the pipeline (#76889 (comment)). Is this the correct approach or do we want sessionService to be accessed somewhere down the pipe directly?


If this is the preferred approach, then what is the need for global sessionService ?

Copy link
Member

Choose a reason for hiding this comment

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

Ideally, we wouldn't need the global sessionService state. We'd just be passing the sessionId around. However, I think the intent of the global state was in case we didn't have the necessary pipeline to send the sessionId all the way from the application, through embeddables and expression service, to the search service. @lizozom Correct me if I'm wrong.

Copy link
Member

Choose a reason for hiding this comment

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

if i remember correctly initially we were discussing accessing the session directly but since we figured we will have searches which we don't want to be part of the session, so we'll need to be passing them down

@Dosant Dosant changed the title [discuss][Search] Use session service on a dashboard [Feedback Needed][Search] Use session service on a dashboard Oct 20, 2020
@kibanamachine
Copy link
Contributor

kibanamachine commented Oct 20, 2020

💔 Build Failed

Failed CI Steps


Test Failures

Chrome UI Functional Tests.test/functional/apps/management/_test_huge_fields·js.management test large number of fields "before all" hook for "test_huge data should have expected number of fields"

Link to Jenkins

Standard Out

Failed Tests Reporter:
  - Test has not failed recently on tracked branches

[00:00:00]       │
[00:00:00]         └-: management
[00:00:00]           └-> "before all" hook
[00:00:00]           └-> "before all" hook
[00:00:00]             │ info [logstash_functional] Unloading indices from "mappings.json"
[00:00:00]             │ info [logstash_functional] Unloading indices from "data.json.gz"
[00:00:03]             │ info [empty_kibana] Loading "mappings.json"
[00:00:03]             │ info [empty_kibana] Loading "data.json.gz"
[00:00:03]             │ info [o.e.c.m.MetadataDeleteIndexService] [kibana-ci-immutable-debian-tests-xxl-1603209437866213065] [.kibana_1/yqeBUOU7R4mFz6zHgnIWxA] deleting index
[00:00:03]             │ info [empty_kibana] Deleted existing index [".kibana_1"]
[00:00:03]             │ info [o.e.c.m.MetadataCreateIndexService] [kibana-ci-immutable-debian-tests-xxl-1603209437866213065] [.kibana] creating index, cause [api], templates [], shards [1]/[1]
[00:00:04]             │ info [empty_kibana] Created index ".kibana"
[00:00:04]             │ debg [empty_kibana] ".kibana" settings {"index":{"number_of_replicas":"1","number_of_shards":"1"}}
[00:00:04]             │ info [empty_kibana] Indexed 1 docs into ".kibana"
[00:00:04]             │ info [o.e.c.m.MetadataMappingService] [kibana-ci-immutable-debian-tests-xxl-1603209437866213065] [.kibana/gNy6zBwCS0GCmYGeXouViA] update_mapping [_doc]
[00:00:04]             │ debg Migrating saved objects
[00:00:04]             │ proc [kibana]   log   [16:14:14.560] [info][savedobjects-service] Creating index .kibana_2.
[00:00:04]             │ info [o.e.c.m.MetadataCreateIndexService] [kibana-ci-immutable-debian-tests-xxl-1603209437866213065] [.kibana_2] creating index, cause [api], templates [], shards [1]/[1]
[00:00:04]             │ info [o.e.c.r.a.AllocationService] [kibana-ci-immutable-debian-tests-xxl-1603209437866213065] updating number_of_replicas to [0] for indices [.kibana_2]
[00:00:04]             │ proc [kibana]   log   [16:14:14.797] [info][savedobjects-service] Reindexing .kibana to .kibana_1
[00:00:04]             │ info [o.e.c.m.MetadataCreateIndexService] [kibana-ci-immutable-debian-tests-xxl-1603209437866213065] [.kibana_1] creating index, cause [api], templates [], shards [1]/[1]
[00:00:04]             │ info [o.e.c.r.a.AllocationService] [kibana-ci-immutable-debian-tests-xxl-1603209437866213065] updating number_of_replicas to [0] for indices [.kibana_1]
[00:00:04]             │ info [o.e.c.m.MetadataCreateIndexService] [kibana-ci-immutable-debian-tests-xxl-1603209437866213065] [.tasks] creating index, cause [auto(task api)], templates [], shards [1]/[1]
[00:00:04]             │ info [o.e.c.r.a.AllocationService] [kibana-ci-immutable-debian-tests-xxl-1603209437866213065] updating number_of_replicas to [0] for indices [.tasks]
[00:00:05]             │ info [o.e.t.LoggingTaskListener] [kibana-ci-immutable-debian-tests-xxl-1603209437866213065] 109 finished with response BulkByScrollResponse[took=122.4ms,timed_out=false,sliceId=null,updated=0,created=1,deleted=0,batches=1,versionConflicts=0,noops=0,retries=0,throttledUntil=0s,bulk_failures=[],search_failures=[]]
[00:00:05]             │ info [o.e.c.m.MetadataDeleteIndexService] [kibana-ci-immutable-debian-tests-xxl-1603209437866213065] [.kibana/gNy6zBwCS0GCmYGeXouViA] deleting index
[00:00:05]             │ proc [kibana]   log   [16:14:15.651] [info][savedobjects-service] Migrating .kibana_1 saved objects to .kibana_2
[00:00:05]             │ info [o.e.c.m.MetadataMappingService] [kibana-ci-immutable-debian-tests-xxl-1603209437866213065] [.kibana_2/YcBmFmg7RpedOTlnX5QEpw] update_mapping [_doc]
[00:00:05]             │ proc [kibana]   log   [16:14:15.829] [info][savedobjects-service] Pointing alias .kibana to .kibana_2.
[00:00:05]             │ proc [kibana]   log   [16:14:15.922] [info][savedobjects-service] Finished in 1367ms.
[00:00:05]             │ debg applying update to kibana config: {"accessibility:disableAnimations":true,"dateFormat:tz":"UTC"}
[00:00:07]             │ info [makelogs] Loading "mappings.json"
[00:00:07]             │ info [makelogs] Loading "data.json.gz"
[00:00:07]             │ info [o.e.c.m.MetadataCreateIndexService] [kibana-ci-immutable-debian-tests-xxl-1603209437866213065] [logstash-2015.09.17] creating index, cause [api], templates [], shards [1]/[0]
[00:00:07]             │ info [o.e.c.r.a.AllocationService] [kibana-ci-immutable-debian-tests-xxl-1603209437866213065] current.health="GREEN" message="Cluster health status changed from [YELLOW] to [GREEN] (reason: [shards started [[logstash-2015.09.17][0]]])." previous.health="YELLOW" reason="shards started [[logstash-2015.09.17][0]]"
[00:00:07]             │ info [makelogs] Created index "logstash-2015.09.17"
[00:00:07]             │ debg [makelogs] "logstash-2015.09.17" settings {"index":{"analysis":{"analyzer":{"url":{"max_token_length":"1000","tokenizer":"uax_url_email","type":"standard"}}},"number_of_replicas":"0","number_of_shards":"1"}}
[00:00:07]             │ info [o.e.c.m.MetadataCreateIndexService] [kibana-ci-immutable-debian-tests-xxl-1603209437866213065] [logstash-2015.09.18] creating index, cause [api], templates [], shards [1]/[0]
[00:00:07]             │ info [o.e.c.r.a.AllocationService] [kibana-ci-immutable-debian-tests-xxl-1603209437866213065] current.health="GREEN" message="Cluster health status changed from [YELLOW] to [GREEN] (reason: [shards started [[logstash-2015.09.18][0]]])." previous.health="YELLOW" reason="shards started [[logstash-2015.09.18][0]]"
[00:00:07]             │ info [makelogs] Created index "logstash-2015.09.18"
[00:00:07]             │ debg [makelogs] "logstash-2015.09.18" settings {"index":{"analysis":{"analyzer":{"url":{"max_token_length":"1000","tokenizer":"uax_url_email","type":"standard"}}},"number_of_replicas":"0","number_of_shards":"1"}}
[00:00:11]             │ info [makelogs] Indexed 101 docs into "logstash-2015.09.17"
[00:00:11]             │ info [makelogs] Indexed 301 docs into "logstash-2015.09.18"
[00:00:11]           └-: 
[00:00:11]             └-> "before all" hook
[00:10:13]             └-: test large number of fields
[00:10:13]               └-> "before all" hook
[00:10:13]               └-> "before all" hook
[00:10:13]                 │ info [large_fields] Loading "mappings.json"
[00:10:13]                 │ info [large_fields] Loading "data.json.gz"
[00:10:13]                 │ info [o.e.c.m.MetadataCreateIndexService] [kibana-ci-immutable-debian-tests-xxl-1603209437866213065] [testhuge] creating index, cause [api], templates [], shards [5]/[1]
[00:10:14]                 │ info [large_fields] Created index "testhuge"
[00:10:14]                 │ debg [large_fields] "testhuge" settings {"index":{"mapping":{"total_fields":{"limit":"50000"}},"number_of_replicas":"1","number_of_shards":"5"}}
[00:10:15]                 │ info [o.e.c.m.MetadataMappingService] [kibana-ci-immutable-debian-tests-xxl-1603209437866213065] [testhuge/kOV8nbGxT-e_M1Sf3BpEhw] update_mapping [_doc]
[00:10:15]                 │ info [large_fields] Indexed 1 docs into "testhuge"
[00:10:15]                 │ debg isGlobalLoadingIndicatorVisible
[00:10:15]                 │ debg TestSubjects.exists(globalLoadingIndicator)
[00:10:15]                 │ debg Find.existsByDisplayedByCssSelector('[data-test-subj="globalLoadingIndicator"]') with timeout=1500
[00:10:17]                 │ debg --- retry.tryForTime error: [data-test-subj="globalLoadingIndicator"] is not displayed
[00:10:18]                 │ debg TestSubjects.exists(globalLoadingIndicator-hidden)
[00:10:18]                 │ debg Find.existsByCssSelector('[data-test-subj="globalLoadingIndicator-hidden"]') with timeout=100000
[00:10:18]                 │ debg clickKibanaIndexPatterns link
[00:10:18]                 │ debg TestSubjects.click(indexPatterns)
[00:10:18]                 │ debg Find.clickByCssSelector('[data-test-subj="indexPatterns"]') with timeout=10000
[00:10:18]                 │ debg Find.findByCssSelector('[data-test-subj="indexPatterns"]') with timeout=10000
[00:10:18]                 │ debg isGlobalLoadingIndicatorVisible
[00:10:18]                 │ debg TestSubjects.exists(globalLoadingIndicator)
[00:10:18]                 │ debg Find.existsByDisplayedByCssSelector('[data-test-subj="globalLoadingIndicator"]') with timeout=1500
[00:10:19]                 │ debg --- retry.tryForTime error: [data-test-subj="globalLoadingIndicator"] is not displayed
[00:10:20]                 │ debg TestSubjects.exists(globalLoadingIndicator-hidden)
[00:10:20]                 │ debg Find.existsByCssSelector('[data-test-subj="globalLoadingIndicator-hidden"]') with timeout=100000
[00:10:20]                 │ debg Find.existsByLinkText('testhuge')  with timeout=2500
[00:10:22]                 │ debg isGlobalLoadingIndicatorVisible
[00:10:22]                 │ debg TestSubjects.exists(globalLoadingIndicator)
[00:10:22]                 │ debg Find.existsByDisplayedByCssSelector('[data-test-subj="globalLoadingIndicator"]') with timeout=1500
[00:10:24]                 │ debg --- retry.tryForTime error: [data-test-subj="globalLoadingIndicator"] is not displayed
[00:10:24]                 │ debg TestSubjects.exists(globalLoadingIndicator-hidden)
[00:10:24]                 │ debg Find.existsByCssSelector('[data-test-subj="globalLoadingIndicator-hidden"]') with timeout=100000
[00:10:24]                 │ debg TestSubjects.click(createIndexPatternButton)
[00:10:24]                 │ debg Find.clickByCssSelector('[data-test-subj="createIndexPatternButton"]') with timeout=10000
[00:10:24]                 │ debg Find.findByCssSelector('[data-test-subj="createIndexPatternButton"]') with timeout=10000
[00:10:24]                 │ debg isGlobalLoadingIndicatorVisible
[00:10:24]                 │ debg TestSubjects.exists(globalLoadingIndicator)
[00:10:24]                 │ debg Find.existsByDisplayedByCssSelector('[data-test-subj="globalLoadingIndicator"]') with timeout=1500
[00:10:26]                 │ debg --- retry.tryForTime error: [data-test-subj="globalLoadingIndicator"] is not displayed
[00:10:26]                 │ debg TestSubjects.exists(globalLoadingIndicator-hidden)
[00:10:26]                 │ debg Find.existsByCssSelector('[data-test-subj="globalLoadingIndicator-hidden"]') with timeout=100000
[00:10:26]                 │ debg setIndexPatternField(testhuge)
[00:10:26]                 │ debg TestSubjects.find(createIndexPatternNameInput)
[00:10:26]                 │ debg Find.findByCssSelector('[data-test-subj="createIndexPatternNameInput"]') with timeout=10000
[00:10:28]                 │ debg setIndexPatternField set to testhuge
[00:10:28]                 │ debg ... sleep(2000) start
[00:10:30]                 │ debg ... sleep(2000) end
[00:10:30]                 │ debg TestSubjects.find(createIndexPatternGoToStep2Button)
[00:10:30]                 │ debg Find.findByCssSelector('[data-test-subj="createIndexPatternGoToStep2Button"]') with timeout=10000
[00:10:30]                 │ debg ... sleep(2000) start
[00:10:32]                 │ debg ... sleep(2000) end
[00:10:32]                 │ debg TestSubjects.click(createIndexPatternTimeFieldSelect)
[00:10:32]                 │ debg Find.clickByCssSelector('[data-test-subj="createIndexPatternTimeFieldSelect"]') with timeout=10000
[00:10:32]                 │ debg Find.findByCssSelector('[data-test-subj="createIndexPatternTimeFieldSelect"]') with timeout=10000
[00:10:42]                 │ debg --- retry.try error: Waiting for element to be located By(css selector, [data-test-subj="createIndexPatternTimeFieldSelect"])
[00:10:42]                 │      Wait timed out after 10032ms
[00:10:42]                 │ debg Find.findByCssSelector('[data-test-subj="createIndexPatternTimeFieldSelect"]') with timeout=10000
[00:10:52]                 │ debg --- retry.try error: Waiting for element to be located By(css selector, [data-test-subj="createIndexPatternTimeFieldSelect"])
[00:10:52]                 │      Wait timed out after 10050ms
[00:10:53]                 │ debg Find.findByCssSelector('[data-test-subj="createIndexPatternTimeFieldSelect"]') with timeout=10000
[00:11:03]                 │ debg --- retry.try error: Waiting for element to be located By(css selector, [data-test-subj="createIndexPatternTimeFieldSelect"])
[00:11:03]                 │      Wait timed out after 10016ms
[00:11:03]                 │ debg Find.findByCssSelector('[data-test-subj="createIndexPatternTimeFieldSelect"]') with timeout=10000
[00:11:08]                 │ info [o.e.c.m.MetadataMappingService] [kibana-ci-immutable-debian-tests-xxl-1603209437866213065] [.kibana/fdHwv0sVSDihoViK-Rx6XA] update_mapping [_doc]
[00:11:08]                 │ info [o.e.c.m.MetadataMappingService] [kibana-ci-immutable-debian-tests-xxl-1603209437866213065] [.kibana/fdHwv0sVSDihoViK-Rx6XA] update_mapping [_doc]
[00:11:13]                 │ debg --- retry.try error: Waiting for element to be located By(css selector, [data-test-subj="createIndexPatternTimeFieldSelect"])
[00:11:13]                 │      Wait timed out after 10055ms
[00:11:14]                 │ debg Find.findByCssSelector('[data-test-subj="createIndexPatternTimeFieldSelect"]') with timeout=10000
[00:11:24]                 │ debg --- retry.try error: Waiting for element to be located By(css selector, [data-test-subj="createIndexPatternTimeFieldSelect"])
[00:11:24]                 │      Wait timed out after 10049ms
[00:11:24]                 │ debg Find.findByCssSelector('[data-test-subj="createIndexPatternTimeFieldSelect"]') with timeout=10000
[00:11:35]                 │ debg --- retry.try error: Waiting for element to be located By(css selector, [data-test-subj="createIndexPatternTimeFieldSelect"])
[00:11:35]                 │      Wait timed out after 10030ms
[00:11:35]                 │ debg Find.findByCssSelector('[data-test-subj="createIndexPatternTimeFieldSelect"]') with timeout=10000
[00:11:45]                 │ debg --- retry.try error: Waiting for element to be located By(css selector, [data-test-subj="createIndexPatternTimeFieldSelect"])
[00:11:45]                 │      Wait timed out after 10053ms
[00:11:46]                 │ debg Find.findByCssSelector('[data-test-subj="createIndexPatternTimeFieldSelect"]') with timeout=10000
[00:11:56]                 │ debg --- retry.try error: Waiting for element to be located By(css selector, [data-test-subj="createIndexPatternTimeFieldSelect"])
[00:11:56]                 │      Wait timed out after 10022ms
[00:11:56]                 │ debg Find.findByCssSelector('[data-test-subj="createIndexPatternTimeFieldSelect"]') with timeout=10000
[00:12:06]                 │ debg --- retry.try error: Waiting for element to be located By(css selector, [data-test-subj="createIndexPatternTimeFieldSelect"])
[00:12:06]                 │      Wait timed out after 10036ms
[00:12:07]                 │ debg Find.findByCssSelector('[data-test-subj="createIndexPatternTimeFieldSelect"]') with timeout=10000
[00:12:17]                 │ debg --- retry.try error: Waiting for element to be located By(css selector, [data-test-subj="createIndexPatternTimeFieldSelect"])
[00:12:17]                 │      Wait timed out after 10022ms
[00:12:17]                 │ debg Find.findByCssSelector('[data-test-subj="createIndexPatternTimeFieldSelect"]') with timeout=10000
[00:12:27]                 │ debg --- retry.try error: Waiting for element to be located By(css selector, [data-test-subj="createIndexPatternTimeFieldSelect"])
[00:12:27]                 │      Wait timed out after 10032ms
[00:12:28]                 │ debg Find.findByCssSelector('[data-test-subj="createIndexPatternTimeFieldSelect"]') with timeout=10000
[00:12:38]                 │ debg --- retry.try failed again with the same message...
[00:12:38]                 │ debg --- retry.try error: retry.try timeout: TimeoutError: Waiting for element to be located By(css selector, [data-test-subj="createIndexPatternTimeFieldSelect"])
[00:12:38]                 │      Wait timed out after 10032ms
[00:12:38]                 │          at /dev/shm/workspace/kibana/node_modules/selenium-webdriver/lib/webdriver.js:842:17
[00:12:38]                 │          at process._tickCallback (internal/process/next_tick.js:68:7)
[00:12:39]                 │ info Taking screenshot "/dev/shm/workspace/parallel/7/kibana/test/functional/screenshots/failure/management  test large number of fields _before all_ hook.png"
[00:12:39]                 │ info Current URL is: http://localhost:6171/app/management/kibana/indexPatterns/create
[00:12:39]                 │ info Saving page source to: /dev/shm/workspace/parallel/7/kibana/test/functional/failure_debug/html/management  test large number of fields _before all_ hook.html
[00:12:39]                 └- ✖ fail: management  test large number of fields "before all" hook for "test_huge data should have expected number of fields"
[00:12:39]                 │      retry.try timeout: Error: retry.try timeout: TimeoutError: Waiting for element to be located By(css selector, [data-test-subj="createIndexPatternTimeFieldSelect"])
[00:12:39]                 │ Wait timed out after 10032ms
[00:12:39]                 │     at /dev/shm/workspace/kibana/node_modules/selenium-webdriver/lib/webdriver.js:842:17
[00:12:39]                 │     at process._tickCallback (internal/process/next_tick.js:68:7)
[00:12:39]                 │     at onFailure (/dev/shm/workspace/parallel/7/kibana/test/common/services/retry/retry_for_success.ts:28:9)
[00:12:39]                 │     at retryForSuccess (/dev/shm/workspace/parallel/7/kibana/test/common/services/retry/retry_for_success.ts:68:13)
[00:12:39]                 │   Error: retry.try timeout: Error: retry.try timeout: TimeoutError: Waiting for element to be located By(css selector, [data-test-subj="createIndexPatternTimeFieldSelect"])
[00:12:39]                 │   Wait timed out after 10032ms
[00:12:39]                 │       at /dev/shm/workspace/kibana/node_modules/selenium-webdriver/lib/webdriver.js:842:17
[00:12:39]                 │       at process._tickCallback (internal/process/next_tick.js:68:7)
[00:12:39]                 │       at onFailure (test/common/services/retry/retry_for_success.ts:28:9)
[00:12:39]                 │       at retryForSuccess (test/common/services/retry/retry_for_success.ts:68:13)
[00:12:39]                 │       at onFailure (test/common/services/retry/retry_for_success.ts:28:9)
[00:12:39]                 │       at retryForSuccess (test/common/services/retry/retry_for_success.ts:68:13)
[00:12:39]                 │ 
[00:12:39]                 │ 

Stack Trace

Error: retry.try timeout: Error: retry.try timeout: TimeoutError: Waiting for element to be located By(css selector, [data-test-subj="createIndexPatternTimeFieldSelect"])
Wait timed out after 10032ms
    at /dev/shm/workspace/kibana/node_modules/selenium-webdriver/lib/webdriver.js:842:17
    at process._tickCallback (internal/process/next_tick.js:68:7)
    at onFailure (test/common/services/retry/retry_for_success.ts:28:9)
    at retryForSuccess (test/common/services/retry/retry_for_success.ts:68:13)
    at onFailure (test/common/services/retry/retry_for_success.ts:28:9)
    at retryForSuccess (test/common/services/retry/retry_for_success.ts:68:13)

Metrics [docs]

async chunks size

id before after diff
dashboard 221.2KB 221.5KB +300.0B
lens 1.1MB 1.1MB +166.0B
total +466.0B

page load bundle size

id before after diff
dashboard 344.3KB 344.4KB +76.0B
data 1.1MB 1.1MB +167.0B
inspector 130.6KB 131.1KB +503.0B
visualizations 272.2KB 272.5KB +262.0B
total +1008.0B

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@@ -590,7 +591,8 @@ export class DashboardAppController {
const refreshDashboardContainer = () => {
const changes = getChangesFromAppStateForContainerState();
if (changes && dashboardContainer) {
dashboardContainer.updateInput(changes);
const sessionId = searchService.session.start();
dashboardContainer.updateInput({ ...changes, searchSessionId: sessionId });
Copy link
Member

Choose a reason for hiding this comment

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

Ideally, we wouldn't need the global sessionService state. We'd just be passing the sessionId around. However, I think the intent of the global state was in case we didn't have the necessary pipeline to send the sessionId all the way from the application, through embeddables and expression service, to the search service. @lizozom Correct me if I'm wrong.

@@ -84,4 +84,5 @@ export interface ExecutionContextSearch {
filters?: Filter[];
query?: Query | Query[];
timeRange?: TimeRange;
sessionId?: string;
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 it's probably best if we stick to searchSessionId here and below. I think it's more explicit.

@@ -248,7 +252,7 @@ export const esaggs = (): EsaggsExpressionFunctionDefinition => ({
multi: true,
},
},
async fn(input, args, { inspectorAdapters, abortSignal }) {
async fn(input, args, { inspectorAdapters, abortSignal, search }) {
Copy link
Member

Choose a reason for hiding this comment

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

Does it make sense to add this as part of args instead of handlers? Or is it even feasible?

I guess I'm not even sure how this is being passed in... Was search being passed in prior to this PR inside the third argument here?

Copy link
Member

Choose a reason for hiding this comment

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

it will need to be a handler, i wouldn't include it as part of initial input however to make it more explicit and would prefer a separate getter function on the handlers

/**
* Search session id to group searches
*/
searchSessionId?: string;
Copy link
Member

Choose a reason for hiding this comment

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

lets make a separate handler for this getSessionId(): string | undefined ...

I actually started looking into this last week, but then got distracted by some type cleanup: #80643

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍 Rebuilding this pr on top of #80643

@Dosant
Copy link
Contributor Author

Dosant commented Oct 21, 2020

Closing in favour of #81297 (wip).
Thanks for the feedback!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Search Querying infrastructure in Kibana
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants