-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
Instrument vis_type_vislib, lens and vis_type_timeseries with execution context service #105206
Merged
Merged
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
e79b36c
export executionContext types
mshustov 9f80622
pass execution context for expressions and bsearch
mshustov 00ae806
instrument lens
mshustov 105bc80
remove duplicated imports
mshustov 36891cd
fix type
mshustov 73e4be0
instrument tsvb
mshustov 70c070e
pass data as container
mshustov 1def5a3
attach request.id to elasticsearch response logs
mshustov 09333ba
emits execution context to the debug logs
mshustov 9cb03e4
update es client test
mshustov cc41571
attach url to the execution context
mshustov 3bedbb6
update executionContext mock
mshustov b1efd7f
fix type errors in tests
mshustov 628227d
update docs
mshustov 0fd1909
Merge branch 'master' into inspect-vis
mshustov 7b19c74
encode id when send x-opaque-id header to elasticsearch server
mshustov b938fbc
Merge branch 'master' into inspect-vis
mshustov e9e9ca0
add comment and mark readonly
mshustov e432f3b
remove leftovers of an alternative approach
mshustov 58a3886
update docs
mshustov 944ce6d
Merge branch 'master' into inspect-vis
mshustov c8f3752
include name in x-opaque-id header
mshustov 6011737
make expressions executionContext getter
mshustov 859caf2
but interface back for ExecutionContext type
mshustov e0a2ddf
update docs
mshustov 997c63e
Merge remote-tracking branch 'upstream/master' into inspect-vis
joshdover 166a4e1
Update unicode encoding test
joshdover 35c041d
Merge remote-tracking branch 'upstream/master' into inspect-vis
joshdover File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
...ment/core/public/kibana-plugin-core-public.iexecutioncontextcontainer.tojson.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [kibana-plugin-core-public](./kibana-plugin-core-public.md) > [IExecutionContextContainer](./kibana-plugin-core-public.iexecutioncontextcontainer.md) > [toJSON](./kibana-plugin-core-public.iexecutioncontextcontainer.tojson.md) | ||
|
||
## IExecutionContextContainer.toJSON property | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
toJSON: () => Readonly<KibanaExecutionContext>; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
...ata/public/kibana-plugin-plugins-data-public.isearchoptions.executioncontext.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [ISearchOptions](./kibana-plugin-plugins-data-public.isearchoptions.md) > [executionContext](./kibana-plugin-plugins-data-public.isearchoptions.executioncontext.md) | ||
|
||
## ISearchOptions.executionContext property | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
executionContext?: KibanaExecutionContext; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
...ata/server/kibana-plugin-plugins-data-server.isearchoptions.executioncontext.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [ISearchOptions](./kibana-plugin-plugins-data-server.isearchoptions.md) > [executionContext](./kibana-plugin-plugins-data-server.isearchoptions.executioncontext.md) | ||
|
||
## ISearchOptions.executionContext property | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
executionContext?: KibanaExecutionContext; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
...ibana-plugin-plugins-expressions-public.executioncontext.getexecutioncontext.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [kibana-plugin-plugins-expressions-public](./kibana-plugin-plugins-expressions-public.md) > [ExecutionContext](./kibana-plugin-plugins-expressions-public.executioncontext.md) > [getExecutionContext](./kibana-plugin-plugins-expressions-public.executioncontext.getexecutioncontext.md) | ||
|
||
## ExecutionContext.getExecutionContext property | ||
|
||
Contains the meta-data about the source of the expression. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
getExecutionContext: () => IExecutionContextContainer | undefined; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
...a-plugin-plugins-expressions-public.iexpressionloaderparams.executioncontext.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [kibana-plugin-plugins-expressions-public](./kibana-plugin-plugins-expressions-public.md) > [IExpressionLoaderParams](./kibana-plugin-plugins-expressions-public.iexpressionloaderparams.md) > [executionContext](./kibana-plugin-plugins-expressions-public.iexpressionloaderparams.executioncontext.md) | ||
|
||
## IExpressionLoaderParams.executionContext property | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
executionContext?: IExecutionContextContainer; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
...ibana-plugin-plugins-expressions-server.executioncontext.getexecutioncontext.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [kibana-plugin-plugins-expressions-server](./kibana-plugin-plugins-expressions-server.md) > [ExecutionContext](./kibana-plugin-plugins-expressions-server.executioncontext.md) > [getExecutionContext](./kibana-plugin-plugins-expressions-server.executioncontext.getexecutioncontext.md) | ||
|
||
## ExecutionContext.getExecutionContext property | ||
|
||
Contains the meta-data about the source of the expression. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
getExecutionContext: () => IExecutionContextContainer | undefined; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -186,16 +186,14 @@ export type { | |
|
||
export type { DeprecationsServiceStart, ResolveDeprecationResponse } from './deprecations'; | ||
|
||
export type { | ||
IExecutionContextContainer, | ||
ExecutionContextServiceStart, | ||
KibanaExecutionContext, | ||
} from './execution_context'; | ||
export type { IExecutionContextContainer, ExecutionContextServiceStart } from './execution_context'; | ||
|
||
export type { MountPoint, UnmountCallback, PublicUiSettingsParams } from './types'; | ||
|
||
export { URL_MAX_LENGTH } from './core_app'; | ||
|
||
export type { KibanaExecutionContext } from './execution_context'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is the additional type export from the same location needed? |
||
|
||
/** | ||
* Core services exposed to the `Plugin` setup lifecycle | ||
* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,11 @@ import { Buffer } from 'buffer'; | |
import { Readable } from 'stream'; | ||
|
||
import { RequestEvent, errors } from '@elastic/elasticsearch'; | ||
import { TransportRequestParams, RequestBody } from '@elastic/elasticsearch/lib/Transport'; | ||
import type { | ||
TransportRequestOptions, | ||
TransportRequestParams, | ||
RequestBody, | ||
} from '@elastic/elasticsearch/lib/Transport'; | ||
|
||
import { parseClientOptionsMock, ClientMock } from './configure_client.test.mocks'; | ||
import { loggingSystemMock } from '../../logging/logging_system.mock'; | ||
|
@@ -39,12 +43,14 @@ const createApiResponse = <T>({ | |
headers = {}, | ||
warnings = [], | ||
params, | ||
requestOptions = {}, | ||
}: { | ||
body: T; | ||
statusCode?: number; | ||
headers?: Record<string, string>; | ||
warnings?: string[]; | ||
params?: TransportRequestParams; | ||
requestOptions?: TransportRequestOptions; | ||
}): RequestEvent<T> => { | ||
return { | ||
body, | ||
|
@@ -54,6 +60,7 @@ const createApiResponse = <T>({ | |
meta: { | ||
request: { | ||
params: params!, | ||
options: requestOptions, | ||
} as any, | ||
} as any, | ||
}; | ||
|
@@ -146,6 +153,7 @@ describe('configureClient', () => { | |
"200 | ||
GET /foo?hello=dolly | ||
{\\"seq_no_primary_term\\":true,\\"query\\":{\\"term\\":{\\"user\\":\\"kimchy\\"}}}", | ||
undefined, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I decided to update the test instead of refactoring. |
||
], | ||
] | ||
`); | ||
|
@@ -170,6 +178,7 @@ describe('configureClient', () => { | |
"200 | ||
GET /foo?hello=dolly | ||
{\\"seq_no_primary_term\\":true,\\"query\\":{\\"term\\":{\\"user\\":\\"kimchy\\"}}}", | ||
undefined, | ||
], | ||
] | ||
`); | ||
|
@@ -196,6 +205,7 @@ describe('configureClient', () => { | |
"200 | ||
GET /foo?hello=dolly | ||
[buffer]", | ||
undefined, | ||
], | ||
] | ||
`); | ||
|
@@ -222,6 +232,7 @@ describe('configureClient', () => { | |
"200 | ||
GET /foo?hello=dolly | ||
[stream]", | ||
undefined, | ||
], | ||
] | ||
`); | ||
|
@@ -238,6 +249,7 @@ describe('configureClient', () => { | |
Array [ | ||
"200 | ||
GET /foo?hello=dolly", | ||
undefined, | ||
], | ||
] | ||
`); | ||
|
@@ -263,6 +275,7 @@ describe('configureClient', () => { | |
Array [ | ||
"200 | ||
GET /foo?city=M%C3%BCnich", | ||
undefined, | ||
], | ||
] | ||
`); | ||
|
@@ -298,6 +311,7 @@ describe('configureClient', () => { | |
"500 | ||
GET /foo?hello=dolly | ||
{\\"seq_no_primary_term\\":true,\\"query\\":{\\"term\\":{\\"user\\":\\"kimchy\\"}}} [internal server error]: internal server error", | ||
undefined, | ||
], | ||
] | ||
`); | ||
|
@@ -313,6 +327,7 @@ describe('configureClient', () => { | |
Array [ | ||
Array [ | ||
"[TimeoutError]: message", | ||
undefined, | ||
], | ||
] | ||
`); | ||
|
@@ -343,6 +358,7 @@ describe('configureClient', () => { | |
Array [ | ||
"400 | ||
GET /_path?hello=dolly [illegal_argument_exception]: request [/_path] contains unrecognized parameter: [name]", | ||
undefined, | ||
], | ||
] | ||
`); | ||
|
@@ -369,6 +385,7 @@ describe('configureClient', () => { | |
Array [ | ||
"400 | ||
GET /_path [undefined]: Response Error", | ||
undefined, | ||
], | ||
] | ||
`); | ||
|
@@ -391,10 +408,67 @@ describe('configureClient', () => { | |
Array [ | ||
"400 | ||
GET /_path [undefined]: Response Error", | ||
undefined, | ||
], | ||
] | ||
`); | ||
}); | ||
|
||
it('adds meta information to logs', () => { | ||
const client = configureClient(createFakeConfig(), { logger, type: 'test', scoped: false }); | ||
|
||
let response = createApiResponse({ | ||
statusCode: 400, | ||
headers: {}, | ||
params: { | ||
method: 'GET', | ||
path: '/_path', | ||
}, | ||
requestOptions: { | ||
opaqueId: 'opaque-id', | ||
}, | ||
body: { | ||
error: {}, | ||
}, | ||
}); | ||
client.emit('response', null, response); | ||
|
||
expect(loggingSystemMock.collect(logger).debug[0][1]).toMatchInlineSnapshot(` | ||
Object { | ||
"http": Object { | ||
"request": Object { | ||
"id": "opaque-id", | ||
}, | ||
}, | ||
} | ||
`); | ||
|
||
logger.debug.mockClear(); | ||
|
||
response = createApiResponse({ | ||
statusCode: 400, | ||
headers: {}, | ||
params: { | ||
method: 'GET', | ||
path: '/_path', | ||
}, | ||
requestOptions: { | ||
opaqueId: 'opaque-id', | ||
}, | ||
body: {} as any, | ||
}); | ||
client.emit('response', new errors.ResponseError(response), response); | ||
|
||
expect(loggingSystemMock.collect(logger).debug[0][1]).toMatchInlineSnapshot(` | ||
Object { | ||
"http": Object { | ||
"request": Object { | ||
"id": "opaque-id", | ||
}, | ||
}, | ||
} | ||
`); | ||
}); | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mshustov It looks like the generated docs have lost some comments- can you bring them back?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm..it's how our doc generator handles
interface
conversion intotype
. Let me see what I can do with it.