From 12667d971bb02b3c72e1899e90eefbe75ff5e73a Mon Sep 17 00:00:00 2001 From: Mikhail Shustov Date: Thu, 1 Oct 2020 14:05:59 +0300 Subject: [PATCH] [KP] instrument platform server-side code with apm agent (#70919) * instrument platform server-side code with apm agent: setup, start lifecycles and SO migration * add span type * span should have name: saved_objects.migration * remove migration reports * put migration span back --- src/core/server/server.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/core/server/server.ts b/src/core/server/server.ts index 5935636d54f9..4e5a7a328bed 100644 --- a/src/core/server/server.ts +++ b/src/core/server/server.ts @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ - +import apm from 'elastic-apm-node'; import { config as pathConfig } from '@kbn/utils'; import { mapToObject } from '@kbn/std'; import { ConfigService, Env, RawConfigurationProvider, coreDeprecationProvider } from './config'; @@ -106,6 +106,7 @@ export class Server { public async setup() { this.log.debug('setting up server'); + const setupTransaction = apm.startTransaction('server_setup', 'kibana_platform'); const environmentSetup = await this.environment.setup(); @@ -207,20 +208,25 @@ export class Server { this.registerCoreContext(coreSetup); this.coreApp.setup(coreSetup); + setupTransaction?.end(); return coreSetup; } public async start() { this.log.debug('starting server'); + const startTransaction = apm.startTransaction('server_start', 'kibana_platform'); + const auditTrailStart = this.auditTrail.start(); const elasticsearchStart = await this.elasticsearch.start({ auditTrail: auditTrailStart, }); + const soStartSpan = startTransaction?.startSpan('saved_objects.migration', 'migration'); const savedObjectsStart = await this.savedObjects.start({ elasticsearch: elasticsearchStart, pluginsInitialized: this.#pluginsInitialized, }); + soStartSpan?.end(); const capabilitiesStart = this.capabilities.start(); const uiSettingsStart = await this.uiSettings.start(); const metricsStart = await this.metrics.start(); @@ -248,6 +254,7 @@ export class Server { await this.http.start(); + startTransaction?.end(); return this.coreStart; }