Skip to content

Commit

Permalink
telemetry and reference extraction/injection for expression service (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
ppisljar authored Oct 12, 2020
1 parent 82478c3 commit 1a3c059
Show file tree
Hide file tree
Showing 57 changed files with 674 additions and 268 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-plugins-expressions-public](./kibana-plugin-plugins-expressions-public.md) &gt; [Executor](./kibana-plugin-plugins-expressions-public.executor.md) &gt; [extract](./kibana-plugin-plugins-expressions-public.executor.extract.md)

## Executor.extract() method

<b>Signature:</b>

```typescript
extract(ast: ExpressionAstExpression): {
state: ExpressionAstExpression;
references: SavedObjectReference[];
};
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| ast | <code>ExpressionAstExpression</code> | |

<b>Returns:</b>

`{
state: ExpressionAstExpression;
references: SavedObjectReference[];
}`

Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-plugins-expressions-public](./kibana-plugin-plugins-expressions-public.md) &gt; [Executor](./kibana-plugin-plugins-expressions-public.executor.md) &gt; [inject](./kibana-plugin-plugins-expressions-public.executor.inject.md)

## Executor.inject() method

<b>Signature:</b>

```typescript
inject(ast: ExpressionAstExpression, references: SavedObjectReference[]): ExpressionAstExpression;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| ast | <code>ExpressionAstExpression</code> | |
| references | <code>SavedObjectReference[]</code> | |

<b>Returns:</b>

`ExpressionAstExpression`

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<b>Signature:</b>

```typescript
export declare class Executor<Context extends Record<string, unknown> = Record<string, unknown>>
export declare class Executor<Context extends Record<string, unknown> = Record<string, unknown>> implements PersistableState<ExpressionAstExpression>
```
## Constructors
Expand All @@ -32,12 +32,15 @@ export declare class Executor<Context extends Record<string, unknown> = Record<s
| [createExecution(ast, context, { debug })](./kibana-plugin-plugins-expressions-public.executor.createexecution.md) | | |
| [createWithDefaults(state)](./kibana-plugin-plugins-expressions-public.executor.createwithdefaults.md) | <code>static</code> | |
| [extendContext(extraContext)](./kibana-plugin-plugins-expressions-public.executor.extendcontext.md) | | |
| [extract(ast)](./kibana-plugin-plugins-expressions-public.executor.extract.md) | | |
| [fork()](./kibana-plugin-plugins-expressions-public.executor.fork.md) | | |
| [getFunction(name)](./kibana-plugin-plugins-expressions-public.executor.getfunction.md) | | |
| [getFunctions()](./kibana-plugin-plugins-expressions-public.executor.getfunctions.md) | | |
| [getType(name)](./kibana-plugin-plugins-expressions-public.executor.gettype.md) | | |
| [getTypes()](./kibana-plugin-plugins-expressions-public.executor.gettypes.md) | | |
| [inject(ast, references)](./kibana-plugin-plugins-expressions-public.executor.inject.md) | | |
| [registerFunction(functionDefinition)](./kibana-plugin-plugins-expressions-public.executor.registerfunction.md) | | |
| [registerType(typeDefinition)](./kibana-plugin-plugins-expressions-public.executor.registertype.md) | | |
| [run(ast, input, context)](./kibana-plugin-plugins-expressions-public.executor.run.md) | | Execute expression and return result. |
| [telemetry(ast, telemetryData)](./kibana-plugin-plugins-expressions-public.executor.telemetry.md) | | |
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-plugins-expressions-public](./kibana-plugin-plugins-expressions-public.md) &gt; [Executor](./kibana-plugin-plugins-expressions-public.executor.md) &gt; [telemetry](./kibana-plugin-plugins-expressions-public.executor.telemetry.md)

## Executor.telemetry() method

<b>Signature:</b>

```typescript
telemetry(ast: ExpressionAstExpression, telemetryData: Record<string, any>): Record<string, any>;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| ast | <code>ExpressionAstExpression</code> | |
| telemetryData | <code>Record&lt;string, any&gt;</code> | |

<b>Returns:</b>

`Record<string, any>`

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,13 @@

[Home](./index.md) &gt; [kibana-plugin-plugins-expressions-public](./kibana-plugin-plugins-expressions-public.md) &gt; [ExpressionAstExpression](./kibana-plugin-plugins-expressions-public.expressionastexpression.md)

## ExpressionAstExpression interface
## ExpressionAstExpression type

<b>Signature:</b>

```typescript
export interface ExpressionAstExpression
export declare type ExpressionAstExpression = {
type: 'expression';
chain: ExpressionAstFunction[];
};
```

## Properties

| Property | Type | Description |
| --- | --- | --- |
| [chain](./kibana-plugin-plugins-expressions-public.expressionastexpression.chain.md) | <code>ExpressionAstFunction[]</code> | |
| [type](./kibana-plugin-plugins-expressions-public.expressionastexpression.type.md) | <code>'expression'</code> | |

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,15 @@

[Home](./index.md) &gt; [kibana-plugin-plugins-expressions-public](./kibana-plugin-plugins-expressions-public.md) &gt; [ExpressionAstFunction](./kibana-plugin-plugins-expressions-public.expressionastfunction.md)

## ExpressionAstFunction interface
## ExpressionAstFunction type

<b>Signature:</b>

```typescript
export interface ExpressionAstFunction
export declare type ExpressionAstFunction = {
type: 'function';
function: string;
arguments: Record<string, ExpressionAstArgument[]>;
debug?: ExpressionAstFunctionDebug;
};
```

## Properties

| Property | Type | Description |
| --- | --- | --- |
| [arguments](./kibana-plugin-plugins-expressions-public.expressionastfunction.arguments.md) | <code>Record&lt;string, ExpressionAstArgument[]&gt;</code> | |
| [debug](./kibana-plugin-plugins-expressions-public.expressionastfunction.debug.md) | <code>ExpressionAstFunctionDebug</code> | Debug information added to each function when expression is executed in \*debug mode\*. |
| [function](./kibana-plugin-plugins-expressions-public.expressionastfunction.function.md) | <code>string</code> | |
| [type](./kibana-plugin-plugins-expressions-public.expressionastfunction.type.md) | <code>'function'</code> | |

Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-plugins-expressions-public](./kibana-plugin-plugins-expressions-public.md) &gt; [ExpressionAstFunction](./kibana-plugin-plugins-expressions-public.expressionastfunction.md) &gt; [type](./kibana-plugin-plugins-expressions-public.expressionastfunction.type.md)
[Home](./index.md) &gt; [kibana-plugin-plugins-expressions-public](./kibana-plugin-plugins-expressions-public.md) &gt; [ExpressionFunction](./kibana-plugin-plugins-expressions-public.expressionfunction.md) &gt; [disabled](./kibana-plugin-plugins-expressions-public.expressionfunction.disabled.md)

## ExpressionAstFunction.type property
## ExpressionFunction.disabled property

<b>Signature:</b>

```typescript
type: 'function';
disabled: boolean;
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-plugins-expressions-public](./kibana-plugin-plugins-expressions-public.md) &gt; [ExpressionFunction](./kibana-plugin-plugins-expressions-public.expressionfunction.md) &gt; [extract](./kibana-plugin-plugins-expressions-public.expressionfunction.extract.md)

## ExpressionFunction.extract property

<b>Signature:</b>

```typescript
extract: (state: ExpressionAstFunction['arguments']) => {
state: ExpressionAstFunction['arguments'];
references: SavedObjectReference[];
};
```
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) &gt; [kibana-plugin-plugins-expressions-public](./kibana-plugin-plugins-expressions-public.md) &gt; [ExpressionFunction](./kibana-plugin-plugins-expressions-public.expressionfunction.md) &gt; [inject](./kibana-plugin-plugins-expressions-public.expressionfunction.inject.md)

## ExpressionFunction.inject property

<b>Signature:</b>

```typescript
inject: (state: ExpressionAstFunction['arguments'], references: SavedObjectReference[]) => ExpressionAstFunction['arguments'];
```
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<b>Signature:</b>

```typescript
export declare class ExpressionFunction
export declare class ExpressionFunction implements PersistableState<ExpressionAstFunction['arguments']>
```
## Constructors
Expand All @@ -23,9 +23,13 @@ export declare class ExpressionFunction
| [accepts](./kibana-plugin-plugins-expressions-public.expressionfunction.accepts.md) | | <code>(type: string) =&gt; boolean</code> | |
| [aliases](./kibana-plugin-plugins-expressions-public.expressionfunction.aliases.md) | | <code>string[]</code> | Aliases that can be used instead of <code>name</code>. |
| [args](./kibana-plugin-plugins-expressions-public.expressionfunction.args.md) | | <code>Record&lt;string, ExpressionFunctionParameter&gt;</code> | Specification of expression function parameters. |
| [disabled](./kibana-plugin-plugins-expressions-public.expressionfunction.disabled.md) | | <code>boolean</code> | |
| [extract](./kibana-plugin-plugins-expressions-public.expressionfunction.extract.md) | | <code>(state: ExpressionAstFunction['arguments']) =&gt; {</code><br/><code> state: ExpressionAstFunction['arguments'];</code><br/><code> references: SavedObjectReference[];</code><br/><code> }</code> | |
| [fn](./kibana-plugin-plugins-expressions-public.expressionfunction.fn.md) | | <code>(input: ExpressionValue, params: Record&lt;string, any&gt;, handlers: object) =&gt; ExpressionValue</code> | Function to run function (context, args) |
| [help](./kibana-plugin-plugins-expressions-public.expressionfunction.help.md) | | <code>string</code> | A short help text. |
| [inject](./kibana-plugin-plugins-expressions-public.expressionfunction.inject.md) | | <code>(state: ExpressionAstFunction['arguments'], references: SavedObjectReference[]) =&gt; ExpressionAstFunction['arguments']</code> | |
| [inputTypes](./kibana-plugin-plugins-expressions-public.expressionfunction.inputtypes.md) | | <code>string[] &#124; undefined</code> | Type of inputs that this function supports. |
| [name](./kibana-plugin-plugins-expressions-public.expressionfunction.name.md) | | <code>string</code> | Name of function |
| [telemetry](./kibana-plugin-plugins-expressions-public.expressionfunction.telemetry.md) | | <code>(state: ExpressionAstFunction['arguments'], telemetryData: Record&lt;string, any&gt;) =&gt; Record&lt;string, any&gt;</code> | |
| [type](./kibana-plugin-plugins-expressions-public.expressionfunction.type.md) | | <code>string</code> | Return type of function. This SHOULD be supplied. We use it for UI and autocomplete hinting. We may also use it for optimizations in the future. |
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) &gt; [kibana-plugin-plugins-expressions-public](./kibana-plugin-plugins-expressions-public.md) &gt; [ExpressionFunction](./kibana-plugin-plugins-expressions-public.expressionfunction.md) &gt; [telemetry](./kibana-plugin-plugins-expressions-public.expressionfunction.telemetry.md)

## ExpressionFunction.telemetry property

<b>Signature:</b>

```typescript
telemetry: (state: ExpressionAstFunction['arguments'], telemetryData: Record<string, any>) => Record<string, any>;
```
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) &gt; [kibana-plugin-plugins-expressions-public](./kibana-plugin-plugins-expressions-public.md) &gt; [ExpressionFunctionDefinition](./kibana-plugin-plugins-expressions-public.expressionfunctiondefinition.md) &gt; [disabled](./kibana-plugin-plugins-expressions-public.expressionfunctiondefinition.disabled.md)

## ExpressionFunctionDefinition.disabled property

if set to true function will be disabled (but its migrate function will still be available)

<b>Signature:</b>

```typescript
disabled?: boolean;
```
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<b>Signature:</b>

```typescript
export interface ExpressionFunctionDefinition<Name extends string, Input, Arguments extends Record<string, any>, Output, Context extends ExecutionContext = ExecutionContext>
export interface ExpressionFunctionDefinition<Name extends string, Input, Arguments extends Record<string, any>, Output, Context extends ExecutionContext = ExecutionContext> extends PersistableStateDefinition<ExpressionAstFunction['arguments']>
```
## Properties
Expand All @@ -19,6 +19,7 @@ export interface ExpressionFunctionDefinition<Name extends string, Input, Argume
| [aliases](./kibana-plugin-plugins-expressions-public.expressionfunctiondefinition.aliases.md) | <code>string[]</code> | What is this? |
| [args](./kibana-plugin-plugins-expressions-public.expressionfunctiondefinition.args.md) | <code>{</code><br/><code> [key in keyof Arguments]: ArgumentType&lt;Arguments[key]&gt;;</code><br/><code> }</code> | Specification of arguments that function supports. This list will also be used for autocomplete functionality when your function is being edited. |
| [context](./kibana-plugin-plugins-expressions-public.expressionfunctiondefinition.context.md) | <code>{</code><br/><code> types: AnyExpressionFunctionDefinition['inputTypes'];</code><br/><code> }</code> | |
| [disabled](./kibana-plugin-plugins-expressions-public.expressionfunctiondefinition.disabled.md) | <code>boolean</code> | if set to true function will be disabled (but its migrate function will still be available) |
| [help](./kibana-plugin-plugins-expressions-public.expressionfunctiondefinition.help.md) | <code>string</code> | Help text displayed in the Expression editor. This text should be internationalized. |
| [inputTypes](./kibana-plugin-plugins-expressions-public.expressionfunctiondefinition.inputtypes.md) | <code>Array&lt;TypeToString&lt;Input&gt;&gt;</code> | List of allowed type names for input value of this function. If this property is set the input of function will be cast to the first possible type in this list. If this property is missing the input will be provided to the function as-is. |
| [name](./kibana-plugin-plugins-expressions-public.expressionfunctiondefinition.name.md) | <code>Name</code> | The name of the function, as will be used in expression. |
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-plugins-expressions-public](./kibana-plugin-plugins-expressions-public.md) &gt; [ExpressionsService](./kibana-plugin-plugins-expressions-public.expressionsservice.md) &gt; [extract](./kibana-plugin-plugins-expressions-public.expressionsservice.extract.md)

## ExpressionsService.extract property

Extracts saved object references from expression AST

<b>Signature:</b>

```typescript
readonly extract: (state: ExpressionAstExpression) => {
state: ExpressionAstExpression;
references: SavedObjectReference[];
};
```
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) &gt; [kibana-plugin-plugins-expressions-public](./kibana-plugin-plugins-expressions-public.md) &gt; [ExpressionsService](./kibana-plugin-plugins-expressions-public.expressionsservice.md) &gt; [inject](./kibana-plugin-plugins-expressions-public.expressionsservice.inject.md)

## ExpressionsService.inject property

Injects saved object references into expression AST

<b>Signature:</b>

```typescript
readonly inject: (state: ExpressionAstExpression, references: SavedObjectReference[]) => ExpressionAstExpression;
```
Loading

0 comments on commit 1a3c059

Please sign in to comment.