Skip to content

Commit

Permalink
Expose metrics service to public API (#59294)
Browse files Browse the repository at this point in the history
* expose metrics service to public API

* update generated doc
  • Loading branch information
pgayvallet authored Mar 4, 2020
1 parent 07edafd commit b1cb92f
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export interface CoreSetup<TPluginsStart extends object = object>
| [context](./kibana-plugin-server.coresetup.context.md) | <code>ContextSetup</code> | [ContextSetup](./kibana-plugin-server.contextsetup.md) |
| [elasticsearch](./kibana-plugin-server.coresetup.elasticsearch.md) | <code>ElasticsearchServiceSetup</code> | [ElasticsearchServiceSetup](./kibana-plugin-server.elasticsearchservicesetup.md) |
| [http](./kibana-plugin-server.coresetup.http.md) | <code>HttpServiceSetup</code> | [HttpServiceSetup](./kibana-plugin-server.httpservicesetup.md) |
| [metrics](./kibana-plugin-server.coresetup.metrics.md) | <code>MetricsServiceSetup</code> | [MetricsServiceSetup](./kibana-plugin-server.metricsservicesetup.md) |
| [savedObjects](./kibana-plugin-server.coresetup.savedobjects.md) | <code>SavedObjectsServiceSetup</code> | [SavedObjectsServiceSetup](./kibana-plugin-server.savedobjectsservicesetup.md) |
| [uiSettings](./kibana-plugin-server.coresetup.uisettings.md) | <code>UiSettingsServiceSetup</code> | [UiSettingsServiceSetup](./kibana-plugin-server.uisettingsservicesetup.md) |
| [uuid](./kibana-plugin-server.coresetup.uuid.md) | <code>UuidServiceSetup</code> | [UuidServiceSetup](./kibana-plugin-server.uuidservicesetup.md) |
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-server](./kibana-plugin-server.md) &gt; [CoreSetup](./kibana-plugin-server.coresetup.md) &gt; [metrics](./kibana-plugin-server.coresetup.metrics.md)

## CoreSetup.metrics property

[MetricsServiceSetup](./kibana-plugin-server.metricsservicesetup.md)

<b>Signature:</b>

```typescript
metrics: MetricsServiceSetup;
```
3 changes: 3 additions & 0 deletions src/core/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ import { SavedObjectsClientContract } from './saved_objects/types';
import { SavedObjectsServiceSetup, SavedObjectsServiceStart } from './saved_objects';
import { CapabilitiesSetup, CapabilitiesStart } from './capabilities';
import { UuidServiceSetup } from './uuid';
import { MetricsServiceSetup } from './metrics';

export { bootstrap } from './bootstrap';
export { Capabilities, CapabilitiesProvider, CapabilitiesSwitcher } from './capabilities';
Expand Down Expand Up @@ -335,6 +336,8 @@ export interface CoreSetup<TPluginsStart extends object = object> {
uiSettings: UiSettingsServiceSetup;
/** {@link UuidServiceSetup} */
uuid: UuidServiceSetup;
/** {@link MetricsServiceSetup} */
metrics: MetricsServiceSetup;
/**
* Allows plugins to get access to APIs available in start inside async handlers.
* Promise will not resolve until Core and plugin dependencies have completed `start`.
Expand Down
3 changes: 3 additions & 0 deletions src/core/server/legacy/legacy_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,9 @@ export class LegacyService implements CoreService {
isTlsEnabled: setupDeps.core.http.isTlsEnabled,
getServerInfo: setupDeps.core.http.getServerInfo,
},
metrics: {
getOpsMetrics$: setupDeps.core.metrics.getOpsMetrics$,
},
savedObjects: {
setClientFactoryProvider: setupDeps.core.savedObjects.setClientFactoryProvider,
addClientWrapper: setupDeps.core.savedObjects.addClientWrapper,
Expand Down
1 change: 1 addition & 0 deletions src/core/server/mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ function createCoreSetupMock() {
savedObjects: savedObjectsServiceMock.createInternalSetupContract(),
uiSettings: uiSettingsMock,
uuid: uuidServiceMock.createSetupContract(),
metrics: metricsServiceMock.createSetupContract(),
getStartServices: jest
.fn<Promise<[ReturnType<typeof createCoreStartMock>, object]>, []>()
.mockResolvedValue([createCoreStartMock(), {}]),
Expand Down
3 changes: 3 additions & 0 deletions src/core/server/plugins/plugin_context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,9 @@ export function createPluginSetupContext<TPlugin, TPluginDependencies>(
isTlsEnabled: deps.http.isTlsEnabled,
getServerInfo: deps.http.getServerInfo,
},
metrics: {
getOpsMetrics$: deps.metrics.getOpsMetrics$,
},
savedObjects: {
setClientFactoryProvider: deps.savedObjects.setClientFactoryProvider,
addClientWrapper: deps.savedObjects.addClientWrapper,
Expand Down
2 changes: 2 additions & 0 deletions src/core/server/server.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,8 @@ export interface CoreSetup<TPluginsStart extends object = object> {
// (undocumented)
http: HttpServiceSetup;
// (undocumented)
metrics: MetricsServiceSetup;
// (undocumented)
savedObjects: SavedObjectsServiceSetup;
// (undocumented)
uiSettings: UiSettingsServiceSetup;
Expand Down

0 comments on commit b1cb92f

Please sign in to comment.