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

[core.metrics] Add support for multiple processes in ops metrics & stats API; deprecate process field #109820

Merged
merged 14 commits into from
Sep 14, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
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
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-core-server](./kibana-plugin-core-server.md) &gt; [EventLoopDelaysMonitor](./kibana-plugin-core-server.eventloopdelaysmonitor.md) &gt; [(constructor)](./kibana-plugin-core-server.eventloopdelaysmonitor._constructor_.md)

## EventLoopDelaysMonitor.(constructor)

Constructs a new instance of the `EventLoopDelaysMonitor` class

<b>Signature:</b>

```typescript
constructor();
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-core-server](./kibana-plugin-core-server.md) &gt; [EventLoopDelaysMonitor](./kibana-plugin-core-server.eventloopdelaysmonitor.md) &gt; [collect](./kibana-plugin-core-server.eventloopdelaysmonitor.collect.md)

## EventLoopDelaysMonitor.collect() method

<b>Signature:</b>

```typescript
collect(): IntervalHistogram;
```
<b>Returns:</b>

`IntervalHistogram`

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-core-server](./kibana-plugin-core-server.md) &gt; [EventLoopDelaysMonitor](./kibana-plugin-core-server.eventloopdelaysmonitor.md)

## EventLoopDelaysMonitor class

<b>Signature:</b>

```typescript
export declare class EventLoopDelaysMonitor
```

## Constructors

| Constructor | Modifiers | Description |
| --- | --- | --- |
| [(constructor)()](./kibana-plugin-core-server.eventloopdelaysmonitor._constructor_.md) | | Constructs a new instance of the <code>EventLoopDelaysMonitor</code> class |

## Methods

| Method | Modifiers | Description |
| --- | --- | --- |
| [collect()](./kibana-plugin-core-server.eventloopdelaysmonitor.collect.md) | | |
| [reset()](./kibana-plugin-core-server.eventloopdelaysmonitor.reset.md) | | |
| [stop()](./kibana-plugin-core-server.eventloopdelaysmonitor.stop.md) | | |

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

[Home](./index.md) &gt; [kibana-plugin-core-server](./kibana-plugin-core-server.md) &gt; [EventLoopDelaysMonitor](./kibana-plugin-core-server.eventloopdelaysmonitor.md) &gt; [reset](./kibana-plugin-core-server.eventloopdelaysmonitor.reset.md)

## EventLoopDelaysMonitor.reset() method

<b>Signature:</b>

```typescript
reset(): void;
```
<b>Returns:</b>

`void`

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

[Home](./index.md) &gt; [kibana-plugin-core-server](./kibana-plugin-core-server.md) &gt; [EventLoopDelaysMonitor](./kibana-plugin-core-server.eventloopdelaysmonitor.md) &gt; [stop](./kibana-plugin-core-server.eventloopdelaysmonitor.stop.md)

## EventLoopDelaysMonitor.stop() method

<b>Signature:</b>

```typescript
stop(): void;
```
<b>Returns:</b>

`void`

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-core-server](./kibana-plugin-core-server.md) &gt; [IntervalHistogram](./kibana-plugin-core-server.intervalhistogram.md) &gt; [exceeds](./kibana-plugin-core-server.intervalhistogram.exceeds.md)

## IntervalHistogram.exceeds property

<b>Signature:</b>

```typescript
exceeds: 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-core-server](./kibana-plugin-core-server.md) &gt; [IntervalHistogram](./kibana-plugin-core-server.intervalhistogram.md) &gt; [fromTimestamp](./kibana-plugin-core-server.intervalhistogram.fromtimestamp.md)

## IntervalHistogram.fromTimestamp property

<b>Signature:</b>

```typescript
fromTimestamp: 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-core-server](./kibana-plugin-core-server.md) &gt; [IntervalHistogram](./kibana-plugin-core-server.intervalhistogram.md) &gt; [lastUpdatedAt](./kibana-plugin-core-server.intervalhistogram.lastupdatedat.md)

## IntervalHistogram.lastUpdatedAt property

<b>Signature:</b>

```typescript
lastUpdatedAt: 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-core-server](./kibana-plugin-core-server.md) &gt; [IntervalHistogram](./kibana-plugin-core-server.intervalhistogram.md) &gt; [max](./kibana-plugin-core-server.intervalhistogram.max.md)

## IntervalHistogram.max property

<b>Signature:</b>

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

[Home](./index.md) &gt; [kibana-plugin-core-server](./kibana-plugin-core-server.md) &gt; [IntervalHistogram](./kibana-plugin-core-server.intervalhistogram.md)

## IntervalHistogram interface

<b>Signature:</b>

```typescript
export interface IntervalHistogram
```

## Properties

| Property | Type | Description |
| --- | --- | --- |
| [exceeds](./kibana-plugin-core-server.intervalhistogram.exceeds.md) | <code>number</code> | |
| [fromTimestamp](./kibana-plugin-core-server.intervalhistogram.fromtimestamp.md) | <code>string</code> | |
| [lastUpdatedAt](./kibana-plugin-core-server.intervalhistogram.lastupdatedat.md) | <code>string</code> | |
| [max](./kibana-plugin-core-server.intervalhistogram.max.md) | <code>number</code> | |
| [mean](./kibana-plugin-core-server.intervalhistogram.mean.md) | <code>number</code> | |
| [min](./kibana-plugin-core-server.intervalhistogram.min.md) | <code>number</code> | |
| [percentiles](./kibana-plugin-core-server.intervalhistogram.percentiles.md) | <code>{</code><br/><code> 50: number;</code><br/><code> 75: number;</code><br/><code> 95: number;</code><br/><code> 99: number;</code><br/><code> }</code> | |
| [stddev](./kibana-plugin-core-server.intervalhistogram.stddev.md) | <code>number</code> | |

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-core-server](./kibana-plugin-core-server.md) &gt; [IntervalHistogram](./kibana-plugin-core-server.intervalhistogram.md) &gt; [mean](./kibana-plugin-core-server.intervalhistogram.mean.md)

## IntervalHistogram.mean property

<b>Signature:</b>

```typescript
mean: 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-core-server](./kibana-plugin-core-server.md) &gt; [IntervalHistogram](./kibana-plugin-core-server.intervalhistogram.md) &gt; [min](./kibana-plugin-core-server.intervalhistogram.min.md)

## IntervalHistogram.min property

<b>Signature:</b>

```typescript
min: number;
```
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-core-server](./kibana-plugin-core-server.md) &gt; [IntervalHistogram](./kibana-plugin-core-server.intervalhistogram.md) &gt; [percentiles](./kibana-plugin-core-server.intervalhistogram.percentiles.md)

## IntervalHistogram.percentiles property

<b>Signature:</b>

```typescript
percentiles: {
50: number;
75: number;
95: number;
99: 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-core-server](./kibana-plugin-core-server.md) &gt; [IntervalHistogram](./kibana-plugin-core-server.intervalhistogram.md) &gt; [stddev](./kibana-plugin-core-server.intervalhistogram.stddev.md)

## IntervalHistogram.stddev property

<b>Signature:</b>

```typescript
stddev: number;
```
2 changes: 2 additions & 0 deletions docs/development/core/server/kibana-plugin-core-server.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ The plugin integrates with the core system via lifecycle events: `setup`<!-- -->
| [BasePath](./kibana-plugin-core-server.basepath.md) | Access or manipulate the Kibana base path |
| [CspConfig](./kibana-plugin-core-server.cspconfig.md) | CSP configuration for use in Kibana. |
| [ElasticsearchConfig](./kibana-plugin-core-server.elasticsearchconfig.md) | Wrapper of config schema. |
| [EventLoopDelaysMonitor](./kibana-plugin-core-server.eventloopdelaysmonitor.md) | |
| [KibanaRequest](./kibana-plugin-core-server.kibanarequest.md) | Kibana specific abstraction for an incoming request. |
| [RouteValidationError](./kibana-plugin-core-server.routevalidationerror.md) | Error to return when the validation is not successful. |
| [SavedObjectsClient](./kibana-plugin-core-server.savedobjectsclient.md) | |
Expand Down Expand Up @@ -97,6 +98,7 @@ The plugin integrates with the core system via lifecycle events: `setup`<!-- -->
| [IExternalUrlPolicy](./kibana-plugin-core-server.iexternalurlpolicy.md) | A policy describing whether access to an external destination is allowed. |
| [IKibanaResponse](./kibana-plugin-core-server.ikibanaresponse.md) | A response data object, expected to returned as a result of [RequestHandler](./kibana-plugin-core-server.requesthandler.md) execution |
| [IKibanaSocket](./kibana-plugin-core-server.ikibanasocket.md) | A tiny abstraction for TCP socket. |
| [IntervalHistogram](./kibana-plugin-core-server.intervalhistogram.md) | |
| [IRenderOptions](./kibana-plugin-core-server.irenderoptions.md) | |
| [IRouter](./kibana-plugin-core-server.irouter.md) | Registers route handlers for specified resource path and method. See [RouteConfig](./kibana-plugin-core-server.routeconfig.md) and [RequestHandler](./kibana-plugin-core-server.requesthandler.md) for more information about arguments to route registrations. |
| [ISavedObjectsPointInTimeFinder](./kibana-plugin-core-server.isavedobjectspointintimefinder.md) | |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ export interface OpsMetrics
| [collected\_at](./kibana-plugin-core-server.opsmetrics.collected_at.md) | <code>Date</code> | Time metrics were recorded at. |
| [concurrent\_connections](./kibana-plugin-core-server.opsmetrics.concurrent_connections.md) | <code>OpsServerMetrics['concurrent_connections']</code> | number of current concurrent connections to the server |
| [os](./kibana-plugin-core-server.opsmetrics.os.md) | <code>OpsOsMetrics</code> | OS related metrics |
| [process](./kibana-plugin-core-server.opsmetrics.process.md) | <code>OpsProcessMetrics</code> | Process related metrics |
| [process](./kibana-plugin-core-server.opsmetrics.process.md) | <code>OpsProcessMetrics</code> | Process related metrics. Deprecated in favor of processes field. |
| [processes](./kibana-plugin-core-server.opsmetrics.processes.md) | <code>OpsProcessMetrics[]</code> | Process related metrics. Reports an array of objects for each kibana pid. |
| [requests](./kibana-plugin-core-server.opsmetrics.requests.md) | <code>OpsServerMetrics['requests']</code> | server requests stats |
| [response\_times](./kibana-plugin-core-server.opsmetrics.response_times.md) | <code>OpsServerMetrics['response_times']</code> | server response time stats |

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@

## OpsMetrics.process property

Process related metrics
> Warning: This API is now obsolete.
>
>

Process related metrics. Deprecated in favor of processes field.

<b>Signature:</b>

Expand Down
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-core-server](./kibana-plugin-core-server.md) &gt; [OpsMetrics](./kibana-plugin-core-server.opsmetrics.md) &gt; [processes](./kibana-plugin-core-server.opsmetrics.processes.md)

## OpsMetrics.processes property

Process related metrics. Reports an array of objects for each kibana pid.

<b>Signature:</b>

```typescript
processes: OpsProcessMetrics[];
```
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

## OpsProcessMetrics.event\_loop\_delay property

node event loop delay
mean event loop delay since last collection

<b>Signature:</b>

Expand Down
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-core-server](./kibana-plugin-core-server.md) &gt; [OpsProcessMetrics](./kibana-plugin-core-server.opsprocessmetrics.md) &gt; [event\_loop\_delay\_histogram](./kibana-plugin-core-server.opsprocessmetrics.event_loop_delay_histogram.md)

## OpsProcessMetrics.event\_loop\_delay\_histogram property

node event loop delay histogram since last collection

<b>Signature:</b>

```typescript
event_loop_delay_histogram: IntervalHistogram;
```
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@ export interface OpsProcessMetrics

| Property | Type | Description |
| --- | --- | --- |
| [event\_loop\_delay](./kibana-plugin-core-server.opsprocessmetrics.event_loop_delay.md) | <code>number</code> | node event loop delay |
| [event\_loop\_delay\_histogram](./kibana-plugin-core-server.opsprocessmetrics.event_loop_delay_histogram.md) | <code>IntervalHistogram</code> | node event loop delay histogram since last collection |
| [event\_loop\_delay](./kibana-plugin-core-server.opsprocessmetrics.event_loop_delay.md) | <code>number</code> | mean event loop delay since last collection |
| [memory](./kibana-plugin-core-server.opsprocessmetrics.memory.md) | <code>{</code><br/><code> heap: {</code><br/><code> total_in_bytes: number;</code><br/><code> used_in_bytes: number;</code><br/><code> size_limit: number;</code><br/><code> };</code><br/><code> resident_set_size_in_bytes: number;</code><br/><code> }</code> | process memory usage |
| [name](./kibana-plugin-core-server.opsprocessmetrics.name.md) | <code>'coordinator' &#124; 'server_worker'</code> | name of process (example: 'coordinator' \| 'server\_worker' \| 'task\_worker' \| 'reporting\_worker') |
| [pid](./kibana-plugin-core-server.opsprocessmetrics.pid.md) | <code>number</code> | pid of the kibana process |
| [uptime\_in\_millis](./kibana-plugin-core-server.opsprocessmetrics.uptime_in_millis.md) | <code>number</code> | uptime of the kibana process |

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-core-server](./kibana-plugin-core-server.md) &gt; [OpsProcessMetrics](./kibana-plugin-core-server.opsprocessmetrics.md) &gt; [name](./kibana-plugin-core-server.opsprocessmetrics.name.md)

## OpsProcessMetrics.name property

name of process (example: 'coordinator' \| 'server\_worker' \| 'task\_worker' \| 'reporting\_worker')

<b>Signature:</b>

```typescript
name: 'coordinator' | 'server_worker';
```
22 changes: 21 additions & 1 deletion src/core/public/core_app/status/lib/load_status.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import { StatusResponse } from '../../../../types/status';
import { httpServiceMock } from '../../../http/http_service.mock';
import { notificationServiceMock } from '../../../notifications/notifications_service.mock';
import { mocked } from '../../../../server/metrics/event_loop_delays/event_loop_delays_monitor.mocks';
import { loadStatus } from './load_status';

const mockedResponse: StatusResponse = {
Expand Down Expand Up @@ -61,6 +62,8 @@ const mockedResponse: StatusResponse = {
},
},
process: {
name: 'server_worker' as const,
pid: 1,
memory: {
heap: {
size_limit: 1000000,
Expand All @@ -70,9 +73,26 @@ const mockedResponse: StatusResponse = {
resident_set_size_in_bytes: 1,
},
event_loop_delay: 1,
pid: 1,
event_loop_delay_histogram: mocked.createHistogram(),
uptime_in_millis: 1,
},
processes: [
{
name: 'server_worker' as const,
pid: 1,
memory: {
heap: {
size_limit: 1000000,
used_in_bytes: 100,
total_in_bytes: 0,
},
resident_set_size_in_bytes: 1,
},
event_loop_delay: 1,
event_loop_delay_histogram: mocked.createHistogram(),
uptime_in_millis: 1,
},
],
response_times: {
avg_in_millis: 4000,
max_in_millis: 8000,
Expand Down
2 changes: 2 additions & 0 deletions src/core/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,9 @@ export type {
OpsProcessMetrics,
MetricsServiceSetup,
MetricsServiceStart,
IntervalHistogram,
} from './metrics';
export { EventLoopDelaysMonitor } from './metrics';

export type { I18nServiceSetup } from './i18n';
export type {
Expand Down
6 changes: 4 additions & 2 deletions src/core/server/metrics/collectors/collector.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@

import { MetricsCollector } from './types';

const createCollector = (collectReturnValue: any = {}): jest.Mocked<MetricsCollector<any>> => {
const collector: jest.Mocked<MetricsCollector<any>> = {
const createCollector = <T = any>(
collectReturnValue: any = {}
): jest.Mocked<MetricsCollector<T>> => {
const collector: jest.Mocked<MetricsCollector<T>> = {
collect: jest.fn().mockResolvedValue(collectReturnValue),
reset: jest.fn(),
};
Expand Down
Loading