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

Task manager enhancements for error handling in alerting and actions #39829

Merged
merged 62 commits into from
Jul 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
831ae84
Allow mtask definitions to overwrite default setting maxAttemps
mikecote Jun 25, 2019
05a2061
Leverage scheduledAt from task manager
mikecote Jun 25, 2019
d102bec
Treat maxAttempts like attempts and not retries
mikecote Jun 26, 2019
5dc80d7
Add support for second intervals
mikecote Jun 26, 2019
dbf5159
Min 1 attempt
mikecote Jun 26, 2019
557bff8
Reverse relying on scheduledAt
mikecote Jun 27, 2019
418b4e1
Add new startedAt attribute in task manager that keeps track when tas…
mikecote Jun 27, 2019
0da2cf3
Don't extend runAt when claiming a task
mikecote Jun 27, 2019
507f4e8
Remove startedAt from state
mikecote Jun 27, 2019
963d3a2
Merge branch 'master' of github.com:elastic/kibana into task-manager/…
mikecote Jun 27, 2019
bd7e281
Attempt trying to define custom getBackpressureDelay function
mikecote Jun 27, 2019
97811f9
Pass error object to getBackpressureDelay
mikecote Jul 2, 2019
baf9393
Cleanup processResultForRecurringTask code
mikecote Jul 2, 2019
dcc3c0f
Merge branch 'master' of github.com:elastic/kibana into task-manager/…
mikecote Jul 2, 2019
fa73ad9
Add backpressure to timed out tasks
mikecote Jul 2, 2019
b20665b
Change default timeout backpressure calculation
mikecote Jul 2, 2019
e8c2c6f
getBackpressureDelay to return seconds instead of milliseconds
mikecote Jul 2, 2019
27eabc1
Add comment for task store query
mikecote Jul 2, 2019
cf7006d
Compress query
mikecote Jul 2, 2019
38c1704
Merge with master
mikecote Jul 2, 2019
5e333bf
Revert alert / actions specific code
mikecote Jul 2, 2019
89cae1c
Add more interval tests
mikecote Jul 2, 2019
cc481a6
Fix failing jest tests
mikecote Jul 2, 2019
fc028a7
Fix test
mikecote Jul 2, 2019
9c278bb
Merge branch 'master' of github.com:elastic/kibana into task-manager/…
mikecote Jul 2, 2019
2c20b32
Add more unit tests
mikecote Jul 3, 2019
748a845
Fix integration tests
mikecote Jul 3, 2019
40e043a
Fix sorting of tasks to process
mikecote Jul 3, 2019
c813713
WIP
mikecote Jul 3, 2019
d239d09
Merge branch 'master' of github.com:elastic/kibana into task-manager/…
mikecote Jul 8, 2019
3b58bab
Always provide error when getBackpressureDelay is called
mikecote Jul 8, 2019
7929c8f
Rename getBackpressureDelay to getRetryDelay
mikecote Jul 8, 2019
c7f485a
retryAt to be calculated from timeout time by default
mikecote Jul 8, 2019
ea17a99
Merge branch 'master' of github.com:elastic/kibana into task-manager/…
mikecote Jul 9, 2019
e0a2436
Remove invalid test
mikecote Jul 9, 2019
94f07ac
Add unit tests
mikecote Jul 9, 2019
3f28c2d
Consider timeout before scheduling a retryAt
mikecote Jul 9, 2019
3ad1b79
Remove backpressure terminology
mikecote Jul 9, 2019
f08ccb6
Remove support for 0 based intervals and timeouts
mikecote Jul 9, 2019
308b582
Apply PR feedback
mikecote Jul 9, 2019
c54901d
Fix last place using Math.abs
mikecote Jul 9, 2019
4ae600b
Merge branch 'master' of github.com:elastic/kibana into task-manager/…
mikecote Jul 12, 2019
6c07dcf
Modify migrations to allow running a script when converting an index …
mikecote Jul 16, 2019
f9435af
Convert task manager to use saved objects
mikecote Jul 17, 2019
6ee7dbc
Fix broken test
mikecote Jul 17, 2019
48dbc82
Merge branch 'master' of github.com:elastic/kibana into task-manager/…
mikecote Jul 17, 2019
64cb12d
Fix broken tests pt1
mikecote Jul 17, 2019
66cb2bc
Remove index from task manager config schema
mikecote Jul 17, 2019
af07c3c
Accept platform changes
mikecote Jul 17, 2019
732a2b0
PR feedback
mikecote Jul 17, 2019
8e123ec
Merge branch 'master' of github.com:elastic/kibana into task-manager/…
mikecote Jul 17, 2019
53c57a9
Apply PR feedback
mikecote Jul 18, 2019
6ef4163
Merge branch 'master' of github.com:elastic/kibana into task-manager/…
mikecote Jul 18, 2019
bbdc7e2
Apply PR feedback pt2
mikecote Jul 18, 2019
61444ca
Apply PR feedback pt3
mikecote Jul 18, 2019
d07fee2
Apply PR feedback pt4
mikecote Jul 18, 2019
329202d
Merge branch 'master' of github.com:elastic/kibana into task-manager/…
mikecote Jul 18, 2019
ff78cf6
Fix feedback pt3
mikecote Jul 18, 2019
b57e60e
Merge with master
mikecote Jul 22, 2019
1dd9402
Merge branch 'master' of github.com:elastic/kibana into task-manager/…
mikecote Jul 23, 2019
ac490fd
Rename RawSavedObjectDoc to SavedObjectsRawDoc
mikecote Jul 23, 2019
48e6cb3
Merge wtih master
mikecote Jul 24, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docs/development/core/server/kibana-plugin-server.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ The plugin integrates with the core system via lifecycle events: `setup`<!-- -->
| [KibanaRequest](./kibana-plugin-server.kibanarequest.md) | Kibana specific abstraction for an incoming request. |
| [Router](./kibana-plugin-server.router.md) | |
| [SavedObjectsErrorHelpers](./kibana-plugin-server.savedobjectserrorhelpers.md) | |
| [SavedObjectsSchema](./kibana-plugin-server.savedobjectsschema.md) | |
| [SavedObjectsSerializer](./kibana-plugin-server.savedobjectsserializer.md) | |
| [ScopedClusterClient](./kibana-plugin-server.scopedclusterclient.md) | Serves the same purpose as "normal" <code>ClusterClient</code> but exposes additional <code>callAsCurrentUser</code> method that doesn't use credentials of the Kibana internal user (as <code>callAsInternalUser</code> does) to request Elasticsearch API, but rather passes HTTP headers extracted from the current user request to the API |

## Interfaces
Expand Down Expand Up @@ -60,6 +62,7 @@ The plugin integrates with the core system via lifecycle events: `setup`<!-- -->
| [SavedObjectsFindOptions](./kibana-plugin-server.savedobjectsfindoptions.md) | |
| [SavedObjectsFindResponse](./kibana-plugin-server.savedobjectsfindresponse.md) | |
| [SavedObjectsMigrationVersion](./kibana-plugin-server.savedobjectsmigrationversion.md) | A dictionary of saved object type -<!-- -->&gt; version used to determine what migrations need to be applied to a saved object. |
| [SavedObjectsRawDoc](./kibana-plugin-server.savedobjectsrawdoc.md) | A raw document as represented directly in the saved object index. |
| [SavedObjectsService](./kibana-plugin-server.savedobjectsservice.md) | |
| [SavedObjectsUpdateOptions](./kibana-plugin-server.savedobjectsupdateoptions.md) | |
| [SavedObjectsUpdateResponse](./kibana-plugin-server.savedobjectsupdateresponse.md) | |
Expand Down
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-server](./kibana-plugin-server.md) &gt; [SavedObjectsRawDoc](./kibana-plugin-server.savedobjectsrawdoc.md) &gt; [\_id](./kibana-plugin-server.savedobjectsrawdoc._id.md)

## SavedObjectsRawDoc.\_id property

<b>Signature:</b>

```typescript
_id: string;
```
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-server](./kibana-plugin-server.md) &gt; [SavedObjectsRawDoc](./kibana-plugin-server.savedobjectsrawdoc.md) &gt; [\_primary\_term](./kibana-plugin-server.savedobjectsrawdoc._primary_term.md)

## SavedObjectsRawDoc.\_primary\_term property

<b>Signature:</b>

```typescript
_primary_term?: number;
```
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-server](./kibana-plugin-server.md) &gt; [SavedObjectsRawDoc](./kibana-plugin-server.savedobjectsrawdoc.md) &gt; [\_seq\_no](./kibana-plugin-server.savedobjectsrawdoc._seq_no.md)

## SavedObjectsRawDoc.\_seq\_no property

<b>Signature:</b>

```typescript
_seq_no?: number;
```
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-server](./kibana-plugin-server.md) &gt; [SavedObjectsRawDoc](./kibana-plugin-server.savedobjectsrawdoc.md) &gt; [\_source](./kibana-plugin-server.savedobjectsrawdoc._source.md)

## SavedObjectsRawDoc.\_source property

<b>Signature:</b>

```typescript
_source: any;
```
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-server](./kibana-plugin-server.md) &gt; [SavedObjectsRawDoc](./kibana-plugin-server.savedobjectsrawdoc.md) &gt; [\_type](./kibana-plugin-server.savedobjectsrawdoc._type.md)

## SavedObjectsRawDoc.\_type property

<b>Signature:</b>

```typescript
_type?: string;
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [SavedObjectsRawDoc](./kibana-plugin-server.savedobjectsrawdoc.md)

## SavedObjectsRawDoc interface

A raw document as represented directly in the saved object index.

<b>Signature:</b>

```typescript
export interface RawDoc
```

## Properties

| Property | Type | Description |
| --- | --- | --- |
| [\_id](./kibana-plugin-server.savedobjectsrawdoc._id.md) | <code>string</code> | |
| [\_primary\_term](./kibana-plugin-server.savedobjectsrawdoc._primary_term.md) | <code>number</code> | |
| [\_seq\_no](./kibana-plugin-server.savedobjectsrawdoc._seq_no.md) | <code>number</code> | |
| [\_source](./kibana-plugin-server.savedobjectsrawdoc._source.md) | <code>any</code> | |
| [\_type](./kibana-plugin-server.savedobjectsrawdoc._type.md) | <code>string</code> | |

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

[Home](./index.md) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [SavedObjectsSchema](./kibana-plugin-server.savedobjectsschema.md) &gt; [(constructor)](./kibana-plugin-server.savedobjectsschema.(constructor).md)

## SavedObjectsSchema.(constructor)

Constructs a new instance of the `SavedObjectsSchema` class

<b>Signature:</b>

```typescript
constructor(schemaDefinition?: SavedObjectsSchemaDefinition);
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| schemaDefinition | <code>SavedObjectsSchemaDefinition</code> | |

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

[Home](./index.md) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [SavedObjectsSchema](./kibana-plugin-server.savedobjectsschema.md) &gt; [getIndexForType](./kibana-plugin-server.savedobjectsschema.getindexfortype.md)

## SavedObjectsSchema.getIndexForType() method

<b>Signature:</b>

```typescript
getIndexForType(type: string): string | undefined;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| type | <code>string</code> | |

<b>Returns:</b>

`string | undefined`

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

[Home](./index.md) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [SavedObjectsSchema](./kibana-plugin-server.savedobjectsschema.md) &gt; [isHiddenType](./kibana-plugin-server.savedobjectsschema.ishiddentype.md)

## SavedObjectsSchema.isHiddenType() method

<b>Signature:</b>

```typescript
isHiddenType(type: string): boolean;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| type | <code>string</code> | |

<b>Returns:</b>

`boolean`

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

[Home](./index.md) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [SavedObjectsSchema](./kibana-plugin-server.savedobjectsschema.md) &gt; [isNamespaceAgnostic](./kibana-plugin-server.savedobjectsschema.isnamespaceagnostic.md)

## SavedObjectsSchema.isNamespaceAgnostic() method

<b>Signature:</b>

```typescript
isNamespaceAgnostic(type: string): boolean;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| type | <code>string</code> | |

<b>Returns:</b>

`boolean`

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

[Home](./index.md) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [SavedObjectsSchema](./kibana-plugin-server.savedobjectsschema.md)

## SavedObjectsSchema class

<b>Signature:</b>

```typescript
export declare class SavedObjectsSchema
```

## Constructors

| Constructor | Modifiers | Description |
| --- | --- | --- |
| [(constructor)(schemaDefinition)](./kibana-plugin-server.savedobjectsschema.(constructor).md) | | Constructs a new instance of the <code>SavedObjectsSchema</code> class |

## Methods

| Method | Modifiers | Description |
| --- | --- | --- |
| [getIndexForType(type)](./kibana-plugin-server.savedobjectsschema.getindexfortype.md) | | |
| [isHiddenType(type)](./kibana-plugin-server.savedobjectsschema.ishiddentype.md) | | |
| [isNamespaceAgnostic(type)](./kibana-plugin-server.savedobjectsschema.isnamespaceagnostic.md) | | |

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

[Home](./index.md) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [SavedObjectsSerializer](./kibana-plugin-server.savedobjectsserializer.md) &gt; [(constructor)](./kibana-plugin-server.savedobjectsserializer.(constructor).md)

## SavedObjectsSerializer.(constructor)

Constructs a new instance of the `SavedObjectsSerializer` class

<b>Signature:</b>

```typescript
constructor(schema: SavedObjectsSchema);
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| schema | <code>SavedObjectsSchema</code> | |

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

[Home](./index.md) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [SavedObjectsSerializer](./kibana-plugin-server.savedobjectsserializer.md) &gt; [generateRawId](./kibana-plugin-server.savedobjectsserializer.generaterawid.md)

## SavedObjectsSerializer.generateRawId() method

Given a saved object type and id, generates the compound id that is stored in the raw document.

<b>Signature:</b>

```typescript
generateRawId(namespace: string | undefined, type: string, id?: string): string;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| namespace | <code>string &#124; undefined</code> | |
| type | <code>string</code> | |
| id | <code>string</code> | |

<b>Returns:</b>

`string`

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

[Home](./index.md) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [SavedObjectsSerializer](./kibana-plugin-server.savedobjectsserializer.md) &gt; [isRawSavedObject](./kibana-plugin-server.savedobjectsserializer.israwsavedobject.md)

## SavedObjectsSerializer.isRawSavedObject() method

Determines whether or not the raw document can be converted to a saved object.

<b>Signature:</b>

```typescript
isRawSavedObject(rawDoc: RawDoc): any;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| rawDoc | <code>RawDoc</code> | |

<b>Returns:</b>

`any`

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

[Home](./index.md) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [SavedObjectsSerializer](./kibana-plugin-server.savedobjectsserializer.md)

## SavedObjectsSerializer class

<b>Signature:</b>

```typescript
export declare class SavedObjectsSerializer
```

## Constructors

| Constructor | Modifiers | Description |
| --- | --- | --- |
| [(constructor)(schema)](./kibana-plugin-server.savedobjectsserializer.(constructor).md) | | Constructs a new instance of the <code>SavedObjectsSerializer</code> class |

## Methods

| Method | Modifiers | Description |
| --- | --- | --- |
| [generateRawId(namespace, type, id)](./kibana-plugin-server.savedobjectsserializer.generaterawid.md) | | Given a saved object type and id, generates the compound id that is stored in the raw document. |
| [isRawSavedObject(rawDoc)](./kibana-plugin-server.savedobjectsserializer.israwsavedobject.md) | | Determines whether or not the raw document can be converted to a saved object. |
| [rawToSavedObject(doc)](./kibana-plugin-server.savedobjectsserializer.rawtosavedobject.md) | | Converts a document from the format that is stored in elasticsearch to the saved object client format. |
| [savedObjectToRaw(savedObj)](./kibana-plugin-server.savedobjectsserializer.savedobjecttoraw.md) | | Converts a document from the saved object client format to the format that is stored in elasticsearch. |

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

[Home](./index.md) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [SavedObjectsSerializer](./kibana-plugin-server.savedobjectsserializer.md) &gt; [rawToSavedObject](./kibana-plugin-server.savedobjectsserializer.rawtosavedobject.md)

## SavedObjectsSerializer.rawToSavedObject() method

Converts a document from the format that is stored in elasticsearch to the saved object client format.

<b>Signature:</b>

```typescript
rawToSavedObject(doc: RawDoc): SanitizedSavedObjectDoc;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| doc | <code>RawDoc</code> | |

<b>Returns:</b>

`SanitizedSavedObjectDoc`

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

[Home](./index.md) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [SavedObjectsSerializer](./kibana-plugin-server.savedobjectsserializer.md) &gt; [savedObjectToRaw](./kibana-plugin-server.savedobjectsserializer.savedobjecttoraw.md)

## SavedObjectsSerializer.savedObjectToRaw() method

Converts a document from the saved object client format to the format that is stored in elasticsearch.

<b>Signature:</b>

```typescript
savedObjectToRaw(savedObj: SanitizedSavedObjectDoc): RawDoc;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| savedObj | <code>SanitizedSavedObjectDoc</code> | |

<b>Returns:</b>

`RawDoc`

3 changes: 3 additions & 0 deletions src/core/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ export {
SavedObjectsFindOptions,
SavedObjectsFindResponse,
SavedObjectsMigrationVersion,
SavedObjectsRawDoc,
SavedObjectsSchema,
SavedObjectsSerializer,
SavedObjectsService,
SavedObjectsUpdateOptions,
SavedObjectsUpdateResponse,
Expand Down
2 changes: 2 additions & 0 deletions src/core/server/saved_objects/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@ export * from './service';
export { SavedObjectsSchema } from './schema';

export { SavedObjectsManagement } from './management';

export { SavedObjectsSerializer, RawDoc as SavedObjectsRawDoc } from './serialization';
Loading