Skip to content

Commit f5b6980

Browse files
authored
[7.x] Move metrics to setup and add cgroup metrics (#76730) (#77108)
1 parent ac5a6ea commit f5b6980

31 files changed

+628
-44
lines changed

docs/development/core/server/kibana-plugin-core-server.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ The plugin integrates with the core system via lifecycle events: `setup`<!-- -->
123123
| [LoggerFactory](./kibana-plugin-core-server.loggerfactory.md) | The single purpose of <code>LoggerFactory</code> interface is to define a way to retrieve a context-based logger instance. |
124124
| [LoggingServiceSetup](./kibana-plugin-core-server.loggingservicesetup.md) | Provides APIs to plugins for customizing the plugin's logger. |
125125
| [LogMeta](./kibana-plugin-core-server.logmeta.md) | Contextual metadata |
126-
| [MetricsServiceSetup](./kibana-plugin-core-server.metricsservicesetup.md) | |
126+
| [MetricsServiceSetup](./kibana-plugin-core-server.metricsservicesetup.md) | APIs to retrieves metrics gathered and exposed by the core platform. |
127127
| [NodesVersionCompatibility](./kibana-plugin-core-server.nodesversioncompatibility.md) | |
128128
| [OnPostAuthToolkit](./kibana-plugin-core-server.onpostauthtoolkit.md) | A tool set defining an outcome of OnPostAuth interceptor for incoming request. |
129129
| [OnPreAuthToolkit](./kibana-plugin-core-server.onpreauthtoolkit.md) | A tool set defining an outcome of OnPreAuth interceptor for incoming request. |
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
2+
3+
[Home](./index.md) &gt; [kibana-plugin-core-server](./kibana-plugin-core-server.md) &gt; [MetricsServiceSetup](./kibana-plugin-core-server.metricsservicesetup.md) &gt; [collectionInterval](./kibana-plugin-core-server.metricsservicesetup.collectioninterval.md)
4+
5+
## MetricsServiceSetup.collectionInterval property
6+
7+
Interval metrics are collected in milliseconds
8+
9+
<b>Signature:</b>
10+
11+
```typescript
12+
readonly collectionInterval: number;
13+
```
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
2+
3+
[Home](./index.md) &gt; [kibana-plugin-core-server](./kibana-plugin-core-server.md) &gt; [MetricsServiceSetup](./kibana-plugin-core-server.metricsservicesetup.md) &gt; [getOpsMetrics$](./kibana-plugin-core-server.metricsservicesetup.getopsmetrics_.md)
4+
5+
## MetricsServiceSetup.getOpsMetrics$ property
6+
7+
Retrieve an observable emitting the [OpsMetrics](./kibana-plugin-core-server.opsmetrics.md) gathered. The observable will emit an initial value during core's `start` phase, and a new value every fixed interval of time, based on the `opts.interval` configuration property.
8+
9+
<b>Signature:</b>
10+
11+
```typescript
12+
getOpsMetrics$: () => Observable<OpsMetrics>;
13+
```
14+
15+
## Example
16+
17+
18+
```ts
19+
core.metrics.getOpsMetrics$().subscribe(metrics => {
20+
// do something with the metrics
21+
})
22+
23+
```
24+

docs/development/core/server/kibana-plugin-core-server.metricsservicesetup.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,18 @@
44

55
## MetricsServiceSetup interface
66

7+
APIs to retrieves metrics gathered and exposed by the core platform.
8+
79
<b>Signature:</b>
810

911
```typescript
1012
export interface MetricsServiceSetup
1113
```
14+
15+
## Properties
16+
17+
| Property | Type | Description |
18+
| --- | --- | --- |
19+
| [collectionInterval](./kibana-plugin-core-server.metricsservicesetup.collectioninterval.md) | <code>number</code> | Interval metrics are collected in milliseconds |
20+
| [getOpsMetrics$](./kibana-plugin-core-server.metricsservicesetup.getopsmetrics_.md) | <code>() =&gt; Observable&lt;OpsMetrics&gt;</code> | Retrieve an observable emitting the [OpsMetrics](./kibana-plugin-core-server.opsmetrics.md) gathered. The observable will emit an initial value during core's <code>start</code> phase, and a new value every fixed interval of time, based on the <code>opts.interval</code> configuration property. |
21+
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
2+
3+
[Home](./index.md) &gt; [kibana-plugin-core-server](./kibana-plugin-core-server.md) &gt; [OpsMetrics](./kibana-plugin-core-server.opsmetrics.md) &gt; [collected\_at](./kibana-plugin-core-server.opsmetrics.collected_at.md)
4+
5+
## OpsMetrics.collected\_at property
6+
7+
Time metrics were recorded at.
8+
9+
<b>Signature:</b>
10+
11+
```typescript
12+
collected_at: Date;
13+
```

docs/development/core/server/kibana-plugin-core-server.opsmetrics.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export interface OpsMetrics
1616

1717
| Property | Type | Description |
1818
| --- | --- | --- |
19+
| [collected\_at](./kibana-plugin-core-server.opsmetrics.collected_at.md) | <code>Date</code> | Time metrics were recorded at. |
1920
| [concurrent\_connections](./kibana-plugin-core-server.opsmetrics.concurrent_connections.md) | <code>OpsServerMetrics['concurrent_connections']</code> | number of current concurrent connections to the server |
2021
| [os](./kibana-plugin-core-server.opsmetrics.os.md) | <code>OpsOsMetrics</code> | OS related metrics |
2122
| [process](./kibana-plugin-core-server.opsmetrics.process.md) | <code>OpsProcessMetrics</code> | Process related metrics |
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
2+
3+
[Home](./index.md) &gt; [kibana-plugin-core-server](./kibana-plugin-core-server.md) &gt; [OpsOsMetrics](./kibana-plugin-core-server.opsosmetrics.md) &gt; [cpu](./kibana-plugin-core-server.opsosmetrics.cpu.md)
4+
5+
## OpsOsMetrics.cpu property
6+
7+
cpu cgroup metrics, undefined when not running in a cgroup
8+
9+
<b>Signature:</b>
10+
11+
```typescript
12+
cpu?: {
13+
control_group: string;
14+
cfs_period_micros: number;
15+
cfs_quota_micros: number;
16+
stat: {
17+
number_of_elapsed_periods: number;
18+
number_of_times_throttled: number;
19+
time_throttled_nanos: number;
20+
};
21+
};
22+
```
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
2+
3+
[Home](./index.md) &gt; [kibana-plugin-core-server](./kibana-plugin-core-server.md) &gt; [OpsOsMetrics](./kibana-plugin-core-server.opsosmetrics.md) &gt; [cpuacct](./kibana-plugin-core-server.opsosmetrics.cpuacct.md)
4+
5+
## OpsOsMetrics.cpuacct property
6+
7+
cpu accounting metrics, undefined when not running in a cgroup
8+
9+
<b>Signature:</b>
10+
11+
```typescript
12+
cpuacct?: {
13+
control_group: string;
14+
usage_nanos: number;
15+
};
16+
```

docs/development/core/server/kibana-plugin-core-server.opsosmetrics.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ export interface OpsOsMetrics
1616

1717
| Property | Type | Description |
1818
| --- | --- | --- |
19+
| [cpu](./kibana-plugin-core-server.opsosmetrics.cpu.md) | <code>{</code><br/><code> control_group: string;</code><br/><code> cfs_period_micros: number;</code><br/><code> cfs_quota_micros: number;</code><br/><code> stat: {</code><br/><code> number_of_elapsed_periods: number;</code><br/><code> number_of_times_throttled: number;</code><br/><code> time_throttled_nanos: number;</code><br/><code> };</code><br/><code> }</code> | cpu cgroup metrics, undefined when not running in a cgroup |
20+
| [cpuacct](./kibana-plugin-core-server.opsosmetrics.cpuacct.md) | <code>{</code><br/><code> control_group: string;</code><br/><code> usage_nanos: number;</code><br/><code> }</code> | cpu accounting metrics, undefined when not running in a cgroup |
1921
| [distro](./kibana-plugin-core-server.opsosmetrics.distro.md) | <code>string</code> | The os distrib. Only present for linux platforms |
2022
| [distroRelease](./kibana-plugin-core-server.opsosmetrics.distrorelease.md) | <code>string</code> | The os distrib release, prefixed by the os distrib. Only present for linux platforms |
2123
| [load](./kibana-plugin-core-server.opsosmetrics.load.md) | <code>{</code><br/><code> '1m': number;</code><br/><code> '5m': number;</code><br/><code> '15m': number;</code><br/><code> }</code> | cpu load metrics |

docs/setup/settings.asciidoc

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ which may cause a delay before pages start being served.
2020
Set to `false` to disable Console. *Default: `true`*
2121

2222
| `cpu.cgroup.path.override:`
23-
| Override for cgroup cpu path when mounted in a
24-
manner that is inconsistent with `/proc/self/cgroup`.
23+
| *deprecated* This setting has been renamed to `ops.cGroupOverrides.cpuPath`
24+
and the old name will no longer be supported as of 8.0.
2525

2626
| `cpuacct.cgroup.path.override:`
27-
| Override for cgroup cpuacct path when mounted
28-
in a manner that is inconsistent with `/proc/self/cgroup`.
27+
| *deprecated* This setting has been renamed to `ops.cGroupOverrides.cpuAcctPath`
28+
and the old name will no longer be supported as of 8.0.
2929

3030
| `csp.rules:`
3131
| A https://w3c.github.io/webappsec-csp/[content-security-policy] template
@@ -438,6 +438,14 @@ not saved in {es}. *Default: `data`*
438438
| Set the interval in milliseconds to sample
439439
system and process performance metrics. The minimum value is 100. *Default: `5000`*
440440

441+
| `ops.cGroupOverrides.cpuPath:`
442+
| Override for cgroup cpu path when mounted in a
443+
manner that is inconsistent with `/proc/self/cgroup`.
444+
445+
| `ops.cGroupOverrides.cpuAcctPath:`
446+
| Override for cgroup cpuacct path when mounted
447+
in a manner that is inconsistent with `/proc/self/cgroup`.
448+
441449
| `server.basePath:`
442450
| Enables you to specify a path to mount {kib} at if you are
443451
running behind a proxy. Use the `server.rewriteBasePath` setting to tell {kib}

0 commit comments

Comments
 (0)