Skip to content

Commit

Permalink
Merge branch 'master' into alerts/broken-json
Browse files Browse the repository at this point in the history
* master: (38 commits)
  [ML] Data frame analytics: Adds functionality to map view (elastic#83710)
  Add usage collection for savedObject tagging (elastic#83160)
  [SECURITY_SOLUTION] 145: Advanced Policy Tests (elastic#82898)
  [APM] Service overview transactions table (elastic#83429)
  [ML] Fix Single Metric Viewer not loading if job is metric with no partition (elastic#83880)
  do not export types from 3rd party modules as 'type' (elastic#83803)
  [Fleet] Allow to send SETTINGS action (elastic#83707)
  Fixes Failing test: Chrome X-Pack UI Functional Tests.x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/details·ts - Actions and Triggers app Alert Details Alert Instances renders the active alert instances (elastic#83478)
  [Uptime]Reduce chart height on monitor detail page (elastic#83777)
  [APM] Prefer `APIReturnType` over `PromiseReturnType` (elastic#83843)
  [Observability] Fix telemetry for Observability Overview (elastic#83847)
  [Alerting] Adds generic UI for the definition of conditions for Action Groups (elastic#83278)
  ensure workload agg doesnt run until next interval when it fails (elastic#83632)
  [ILM] Policy form should not throw away data (elastic#83077)
  [Monitoring] Stop collecting Kibana Usage in bulkUploader (elastic#83546)
  [TSVB] fix wrong imports (elastic#83798)
  [APM] Correlations UI POC (elastic#82256)
  list all the refs in  tsconfig.json (elastic#83678)
  Bump jest (and related packages) to v26.6.3 (elastic#83724)
  Functional tests - stabilize reporting tests for cloud execution (elastic#83787)
  ...
  • Loading branch information
gmmorris committed Nov 20, 2020
2 parents 180e655 + 00e5951 commit 2a14916
Show file tree
Hide file tree
Showing 506 changed files with 16,851 additions and 6,075 deletions.
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-data-public](./kibana-plugin-plugins-data-public.md) &gt; [IFieldType](./kibana-plugin-plugins-data-public.ifieldtype.md) &gt; [customName](./kibana-plugin-plugins-data-public.ifieldtype.customname.md)
[Home](./index.md) &gt; [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) &gt; [IFieldType](./kibana-plugin-plugins-data-public.ifieldtype.md) &gt; [customLabel](./kibana-plugin-plugins-data-public.ifieldtype.customlabel.md)

## IFieldType.customName property
## IFieldType.customLabel property

<b>Signature:</b>

```typescript
customName?: string;
customLabel?: string;
```
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export interface IFieldType
| --- | --- | --- |
| [aggregatable](./kibana-plugin-plugins-data-public.ifieldtype.aggregatable.md) | <code>boolean</code> | |
| [count](./kibana-plugin-plugins-data-public.ifieldtype.count.md) | <code>number</code> | |
| [customName](./kibana-plugin-plugins-data-public.ifieldtype.customname.md) | <code>string</code> | |
| [customLabel](./kibana-plugin-plugins-data-public.ifieldtype.customlabel.md) | <code>string</code> | |
| [displayName](./kibana-plugin-plugins-data-public.ifieldtype.displayname.md) | <code>string</code> | |
| [esTypes](./kibana-plugin-plugins-data-public.ifieldtype.estypes.md) | <code>string[]</code> | |
| [filterable](./kibana-plugin-plugins-data-public.ifieldtype.filterable.md) | <code>boolean</code> | |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
```typescript
getFieldAttrs: () => {
[x: string]: {
customName: string;
customLabel: string;
};
};
```
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export declare class IndexPattern implements IIndexPattern
| [flattenHit](./kibana-plugin-plugins-data-public.indexpattern.flattenhit.md) | | <code>(hit: Record&lt;string, any&gt;, deep?: boolean) =&gt; Record&lt;string, any&gt;</code> | |
| [formatField](./kibana-plugin-plugins-data-public.indexpattern.formatfield.md) | | <code>FormatFieldFn</code> | |
| [formatHit](./kibana-plugin-plugins-data-public.indexpattern.formathit.md) | | <code>{</code><br/><code> (hit: Record&lt;string, any&gt;, type?: string): any;</code><br/><code> formatField: FormatFieldFn;</code><br/><code> }</code> | |
| [getFieldAttrs](./kibana-plugin-plugins-data-public.indexpattern.getfieldattrs.md) | | <code>() =&gt; {</code><br/><code> [x: string]: {</code><br/><code> customName: string;</code><br/><code> };</code><br/><code> }</code> | |
| [getFieldAttrs](./kibana-plugin-plugins-data-public.indexpattern.getfieldattrs.md) | | <code>() =&gt; {</code><br/><code> [x: string]: {</code><br/><code> customLabel: string;</code><br/><code> };</code><br/><code> }</code> | |
| [getOriginalSavedObjectBody](./kibana-plugin-plugins-data-public.indexpattern.getoriginalsavedobjectbody.md) | | <code>() =&gt; {</code><br/><code> fieldAttrs?: string &#124; undefined;</code><br/><code> title?: string &#124; undefined;</code><br/><code> timeFieldName?: string &#124; undefined;</code><br/><code> intervalName?: string &#124; undefined;</code><br/><code> fields?: string &#124; undefined;</code><br/><code> sourceFilters?: string &#124; undefined;</code><br/><code> fieldFormatMap?: string &#124; undefined;</code><br/><code> typeMeta?: string &#124; undefined;</code><br/><code> type?: string &#124; undefined;</code><br/><code> }</code> | Get last saved saved object fields |
| [id](./kibana-plugin-plugins-data-public.indexpattern.id.md) | | <code>string</code> | |
| [intervalName](./kibana-plugin-plugins-data-public.indexpattern.intervalname.md) | | <code>string &#124; undefined</code> | |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) &gt; [IndexPatternField](./kibana-plugin-plugins-data-public.indexpatternfield.md) &gt; [customName](./kibana-plugin-plugins-data-public.indexpatternfield.customname.md)
[Home](./index.md) &gt; [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) &gt; [IndexPatternField](./kibana-plugin-plugins-data-public.indexpatternfield.md) &gt; [customLabel](./kibana-plugin-plugins-data-public.indexpatternfield.customlabel.md)

## IndexPatternField.customName property
## IndexPatternField.customLabel property

<b>Signature:</b>

```typescript
get customName(): string | undefined;
get customLabel(): string | undefined;

set customName(label: string | undefined);
set customLabel(customLabel: string | undefined);
```
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export declare class IndexPatternField implements IFieldType
| [aggregatable](./kibana-plugin-plugins-data-public.indexpatternfield.aggregatable.md) | | <code>boolean</code> | |
| [conflictDescriptions](./kibana-plugin-plugins-data-public.indexpatternfield.conflictdescriptions.md) | | <code>Record&lt;string, string[]&gt; &#124; undefined</code> | Description of field type conflicts across different indices in the same index pattern |
| [count](./kibana-plugin-plugins-data-public.indexpatternfield.count.md) | | <code>number</code> | Count is used for field popularity |
| [customName](./kibana-plugin-plugins-data-public.indexpatternfield.customname.md) | | <code>string &#124; undefined</code> | |
| [customLabel](./kibana-plugin-plugins-data-public.indexpatternfield.customlabel.md) | | <code>string &#124; undefined</code> | |
| [displayName](./kibana-plugin-plugins-data-public.indexpatternfield.displayname.md) | | <code>string</code> | |
| [esTypes](./kibana-plugin-plugins-data-public.indexpatternfield.estypes.md) | | <code>string[] &#124; undefined</code> | |
| [filterable](./kibana-plugin-plugins-data-public.indexpatternfield.filterable.md) | | <code>boolean</code> | |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ toJSON(): {
aggregatable: boolean;
readFromDocValues: boolean;
subType: import("../types").IFieldSubType | undefined;
customName: string | undefined;
customLabel: string | undefined;
};
```
<b>Returns:</b>
Expand All @@ -38,6 +38,6 @@ toJSON(): {
aggregatable: boolean;
readFromDocValues: boolean;
subType: import("../types").IFieldSubType | undefined;
customName: string | undefined;
customLabel: string | undefined;
}`

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-data-server](./kibana-plugin-plugins-data-server.md) &gt; [IFieldType](./kibana-plugin-plugins-data-server.ifieldtype.md) &gt; [customName](./kibana-plugin-plugins-data-server.ifieldtype.customname.md)
[Home](./index.md) &gt; [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) &gt; [IFieldType](./kibana-plugin-plugins-data-server.ifieldtype.md) &gt; [customLabel](./kibana-plugin-plugins-data-server.ifieldtype.customlabel.md)

## IFieldType.customName property
## IFieldType.customLabel property

<b>Signature:</b>

```typescript
customName?: string;
customLabel?: string;
```
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export interface IFieldType
| --- | --- | --- |
| [aggregatable](./kibana-plugin-plugins-data-server.ifieldtype.aggregatable.md) | <code>boolean</code> | |
| [count](./kibana-plugin-plugins-data-server.ifieldtype.count.md) | <code>number</code> | |
| [customName](./kibana-plugin-plugins-data-server.ifieldtype.customname.md) | <code>string</code> | |
| [customLabel](./kibana-plugin-plugins-data-server.ifieldtype.customlabel.md) | <code>string</code> | |
| [displayName](./kibana-plugin-plugins-data-server.ifieldtype.displayname.md) | <code>string</code> | |
| [esTypes](./kibana-plugin-plugins-data-server.ifieldtype.estypes.md) | <code>string[]</code> | |
| [filterable](./kibana-plugin-plugins-data-server.ifieldtype.filterable.md) | <code>boolean</code> | |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
```typescript
getFieldAttrs: () => {
[x: string]: {
customName: string;
customLabel: string;
};
};
```
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export declare class IndexPattern implements IIndexPattern
| [flattenHit](./kibana-plugin-plugins-data-server.indexpattern.flattenhit.md) | | <code>(hit: Record&lt;string, any&gt;, deep?: boolean) =&gt; Record&lt;string, any&gt;</code> | |
| [formatField](./kibana-plugin-plugins-data-server.indexpattern.formatfield.md) | | <code>FormatFieldFn</code> | |
| [formatHit](./kibana-plugin-plugins-data-server.indexpattern.formathit.md) | | <code>{</code><br/><code> (hit: Record&lt;string, any&gt;, type?: string): any;</code><br/><code> formatField: FormatFieldFn;</code><br/><code> }</code> | |
| [getFieldAttrs](./kibana-plugin-plugins-data-server.indexpattern.getfieldattrs.md) | | <code>() =&gt; {</code><br/><code> [x: string]: {</code><br/><code> customName: string;</code><br/><code> };</code><br/><code> }</code> | |
| [getFieldAttrs](./kibana-plugin-plugins-data-server.indexpattern.getfieldattrs.md) | | <code>() =&gt; {</code><br/><code> [x: string]: {</code><br/><code> customLabel: string;</code><br/><code> };</code><br/><code> }</code> | |
| [getOriginalSavedObjectBody](./kibana-plugin-plugins-data-server.indexpattern.getoriginalsavedobjectbody.md) | | <code>() =&gt; {</code><br/><code> fieldAttrs?: string &#124; undefined;</code><br/><code> title?: string &#124; undefined;</code><br/><code> timeFieldName?: string &#124; undefined;</code><br/><code> intervalName?: string &#124; undefined;</code><br/><code> fields?: string &#124; undefined;</code><br/><code> sourceFilters?: string &#124; undefined;</code><br/><code> fieldFormatMap?: string &#124; undefined;</code><br/><code> typeMeta?: string &#124; undefined;</code><br/><code> type?: string &#124; undefined;</code><br/><code> }</code> | Get last saved saved object fields |
| [id](./kibana-plugin-plugins-data-server.indexpattern.id.md) | | <code>string</code> | |
| [intervalName](./kibana-plugin-plugins-data-server.indexpattern.intervalname.md) | | <code>string &#124; undefined</code> | |
Expand Down
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -693,15 +693,15 @@
"is-glob": "^4.0.1",
"is-path-inside": "^3.0.2",
"istanbul-instrumenter-loader": "^3.0.1",
"jest": "^26.4.2",
"jest": "^26.6.3",
"jest-canvas-mock": "^2.2.0",
"jest-circus": "^26.4.2",
"jest-cli": "^26.4.2",
"jest-diff": "^26.4.2",
"jest-circus": "^26.6.3",
"jest-cli": "^26.6.3",
"jest-diff": "^26.6.2",
"jest-environment-jsdom-thirteen": "^1.0.1",
"jest-raw-loader": "^1.0.1",
"jest-silent-reporter": "^0.2.1",
"jest-snapshot": "^26.4.2",
"jest-snapshot": "^26.6.2",
"jest-specific-snapshot": "2.0.0",
"jest-styled-components": "^7.0.2",
"jest-when": "^2.7.2",
Expand All @@ -723,7 +723,7 @@
"less": "npm:@elastic/less@2.7.3-kibana",
"license-checker": "^16.0.0",
"listr": "^0.14.1",
"lmdb-store": "^0.8.15",
"lmdb-store": "^0.6.10",
"load-grunt-config": "^3.0.1",
"loader-utils": "^1.2.3",
"log-symbols": "^2.2.0",
Expand Down
4 changes: 1 addition & 3 deletions packages/kbn-i18n/src/react/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@
*/

import { InjectedIntl as _InjectedIntl, InjectedIntlProps as _InjectedIntlProps } from 'react-intl';

export type InjectedIntl = _InjectedIntl;
export type InjectedIntlProps = _InjectedIntlProps;
export type { InjectedIntl, InjectedIntlProps } from 'react-intl';

export {
intlShape,
Expand Down
61 changes: 45 additions & 16 deletions packages/kbn-optimizer/src/node/cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,20 @@
*/

import Path from 'path';
import Fs from 'fs';

// @ts-expect-error no types available
import * as LmdbStore from 'lmdb-store';
import { REPO_ROOT, UPSTREAM_BRANCH } from '@kbn/dev-utils';

const CACHE_DIR = Path.resolve(REPO_ROOT, 'data/node_auto_transpilation_cache', UPSTREAM_BRANCH);
const LMDB_PKG = JSON.parse(
Fs.readFileSync(Path.resolve(REPO_ROOT, 'node_modules/lmdb-store/package.json'), 'utf8')
);
const CACHE_DIR = Path.resolve(
REPO_ROOT,
`data/node_auto_transpilation_cache/lmdb-${LMDB_PKG.version}/${UPSTREAM_BRANCH}`
);

const reportError = () => {
// right now I'm not sure we need to worry about errors, the cache isn't actually
// necessary, and if the cache is broken it should just rebuild on the next restart
Expand All @@ -36,11 +45,30 @@ const MINUTE = 1000 * 60;
const HOUR = MINUTE * 60;
const DAY = HOUR * 24;

interface Lmdb<T> {
name: string;
get(key: string): T | undefined;
put(key: string, value: T, version?: number, ifVersion?: number): Promise<boolean>;
remove(key: string, ifVersion?: number): Promise<boolean>;
removeSync(key: string): void;
openDB<T2>(options: {
name: string;
encoding: 'msgpack' | 'string' | 'json' | 'binary';
}): Lmdb<T2>;
getRange(options?: {
start?: T;
end?: T;
reverse?: boolean;
limit?: number;
versions?: boolean;
}): Iterable<{ key: string; value: T }>;
}

export class Cache {
private readonly codes: LmdbStore.RootDatabase;
private readonly atimes: LmdbStore.Database;
private readonly mtimes: LmdbStore.Database;
private readonly sourceMaps: LmdbStore.Database;
private readonly codes: Lmdb<string>;
private readonly atimes: Lmdb<string>;
private readonly mtimes: Lmdb<string>;
private readonly sourceMaps: Lmdb<any>;
private readonly prefix: string;

constructor(config: { prefix: string }) {
Expand Down Expand Up @@ -77,7 +105,7 @@ export class Cache {
}

getMtime(path: string) {
return this.safeGet<string>(this.mtimes, this.getKey(path));
return this.safeGet(this.mtimes, this.getKey(path));
}

getCode(path: string) {
Expand All @@ -88,11 +116,11 @@ export class Cache {
// touched in a long time (currently 30 days)
this.atimes.put(key, GLOBAL_ATIME).catch(reportError);

return this.safeGet<string>(this.codes, key);
return this.safeGet(this.codes, key);
}

getSourceMap(path: string) {
return this.safeGet<any>(this.sourceMaps, this.getKey(path));
return this.safeGet(this.sourceMaps, this.getKey(path));
}

update(path: string, file: { mtime: string; code: string; map: any }) {
Expand All @@ -110,11 +138,13 @@ export class Cache {
return `${this.prefix}${path}`;
}

private safeGet<V>(db: LmdbStore.Database, key: string) {
private safeGet<V>(db: Lmdb<V>, key: string) {
try {
return db.get(key) as V | undefined;
return db.get(key);
} catch (error) {
// get errors indicate that a key value is corrupt in some way, so remove it
process.stderr.write(
`failed to read node transpilation [${db.name}] cache for [${key}]: ${error.stack}\n`
);
db.removeSync(key);
}
}
Expand All @@ -124,13 +154,12 @@ export class Cache {
const ATIME_LIMIT = Date.now() - 30 * DAY;
const BATCH_SIZE = 1000;

const validKeys: LmdbStore.Key[] = [];
const invalidKeys: LmdbStore.Key[] = [];
const validKeys: string[] = [];
const invalidKeys: string[] = [];

// @ts-expect-error See https://github.com/DoctorEvidence/lmdb-store/pull/18
for (const { key, value } of this.atimes.getRange()) {
const atime = parseInt(`${value}`, 10);
if (Number.isNaN(atime) || atime < ATIME_LIMIT) {
const atime = parseInt(value, 10);
if (atime < ATIME_LIMIT) {
invalidKeys.push(key);
} else {
validKeys.push(key);
Expand Down
Loading

0 comments on commit 2a14916

Please sign in to comment.