From 5a8e55d5c91e50f5ea9eb7db01c6d171df0beaa3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Fern=C3=A1ndez=20Haro?= Date: Fri, 2 Oct 2020 19:24:08 +0100 Subject: [PATCH] [Usage Collection] [schema] `apm` (#79000) --- .../src/tools/serializer.test.ts | 18 + .../src/tools/serializer.ts | 33 +- .../kbn-telemetry-tools/src/tools/utils.ts | 4 +- .../telemetry_collectors/constants.ts | 4 + x-pack/.telemetryrc.json | 4 +- .../__snapshots__/apm_telemetry.test.ts.snap | 1192 ++++----- x-pack/plugins/apm/common/apm_telemetry.ts | 279 +-- .../apm/server/lib/apm_telemetry/index.ts | 13 +- .../apm/server/lib/apm_telemetry/schema.ts | 206 ++ .../apm/server/lib/apm_telemetry/types.ts | 6 +- .../schema/xpack_plugins.json | 2180 +++++++++++++++++ 11 files changed, 2982 insertions(+), 957 deletions(-) create mode 100644 x-pack/plugins/apm/server/lib/apm_telemetry/schema.ts diff --git a/packages/kbn-telemetry-tools/src/tools/serializer.test.ts b/packages/kbn-telemetry-tools/src/tools/serializer.test.ts index 652b26c8edb2..85fb84c714e2 100644 --- a/packages/kbn-telemetry-tools/src/tools/serializer.test.ts +++ b/packages/kbn-telemetry-tools/src/tools/serializer.test.ts @@ -138,4 +138,22 @@ describe('getDescriptor', () => { }, }); }); + + it('serializes RecordWithKnownProps', () => { + const usageInterface = usageInterfaces.get('RecordWithKnownProps')!; + const descriptor = getDescriptor(usageInterface, tsProgram); + expect(descriptor).toEqual({ + prop1: { kind: ts.SyntaxKind.NumberKeyword, type: 'NumberKeyword' }, + prop2: { kind: ts.SyntaxKind.NumberKeyword, type: 'NumberKeyword' }, + }); + }); + + it('serializes IndexedAccessType', () => { + const usageInterface = usageInterfaces.get('IndexedAccessType')!; + const descriptor = getDescriptor(usageInterface, tsProgram); + expect(descriptor).toEqual({ + prop1: { kind: ts.SyntaxKind.StringKeyword, type: 'StringKeyword' }, + prop2: { kind: ts.SyntaxKind.StringKeyword, type: 'StringKeyword' }, + }); + }); }); diff --git a/packages/kbn-telemetry-tools/src/tools/serializer.ts b/packages/kbn-telemetry-tools/src/tools/serializer.ts index cd845a680ad0..ea5f18400802 100644 --- a/packages/kbn-telemetry-tools/src/tools/serializer.ts +++ b/packages/kbn-telemetry-tools/src/tools/serializer.ts @@ -18,7 +18,7 @@ */ import * as ts from 'typescript'; -import { uniqBy } from 'lodash'; +import { uniqBy, pick } from 'lodash'; import { getResolvedModuleSourceFile, getIdentifierDeclarationFromSource, @@ -95,7 +95,16 @@ export function getConstraints(node: ts.Node, program: ts.Program): any { return node.literal.text; } - throw Error(`Unsupported constraint`); + if (ts.isImportSpecifier(node)) { + const source = node.getSourceFile(); + const importedModuleName = getModuleSpecifier(node); + + const declarationSource = getResolvedModuleSourceFile(source, program, importedModuleName); + const declarationNode = getIdentifierDeclarationFromSource(node.name, declarationSource); + return getConstraints(declarationNode, program); + } + + throw Error(`Unsupported constraint of kind ${node.kind} [${ts.SyntaxKind[node.kind]}]`); } export function getDescriptor(node: ts.Node, program: ts.Program): Descriptor | DescriptorValue { @@ -157,9 +166,25 @@ export function getDescriptor(node: ts.Node, program: ts.Program): Descriptor | return { kind: TelemetryKinds.Date, type: 'Date' }; } // Support `Record` - if (symbolName === 'Record' && node.typeArguments![0].kind === ts.SyntaxKind.StringKeyword) { - return { '@@INDEX@@': getDescriptor(node.typeArguments![1], program) }; + if (symbolName === 'Record') { + const descriptor = getDescriptor(node.typeArguments![1], program); + if (node.typeArguments![0].kind === ts.SyntaxKind.StringKeyword) { + return { '@@INDEX@@': descriptor }; + } + const constraints = getConstraints(node.typeArguments![0], program); + const constraintsArray = Array.isArray(constraints) ? constraints : [constraints]; + if (typeof constraintsArray[0] === 'string') { + return constraintsArray.reduce((acc, c) => ({ ...acc, [c]: descriptor }), {}); + } + } + + // Support `Pick` + if (symbolName === 'Pick') { + const parentDescriptor = getDescriptor(node.typeArguments![0], program); + const pickPropNames = getConstraints(node.typeArguments![1], program); + return pick(parentDescriptor, pickPropNames); } + const declaration = (symbol?.getDeclarations() || [])[0]; if (declaration) { return getDescriptor(declaration, program); diff --git a/packages/kbn-telemetry-tools/src/tools/utils.ts b/packages/kbn-telemetry-tools/src/tools/utils.ts index 947a4f66908f..90ba7f4d9168 100644 --- a/packages/kbn-telemetry-tools/src/tools/utils.ts +++ b/packages/kbn-telemetry-tools/src/tools/utils.ts @@ -78,14 +78,14 @@ export function getIdentifierDeclarationFromSource(node: ts.Node, source: ts.Sou const identifierName = node.getText(); const identifierDefinition: ts.Node = (source as any).locals.get(identifierName); if (!identifierDefinition) { - throw new Error(`Unable to fine identifier in source ${identifierName}`); + throw new Error(`Unable to find identifier in source ${identifierName}`); } const declarations = (identifierDefinition as any).declarations as ts.Node[]; const latestDeclaration: ts.Node | false | undefined = Array.isArray(declarations) && declarations[declarations.length - 1]; if (!latestDeclaration) { - throw new Error(`Unable to fine declaration for identifier ${identifierName}`); + throw new Error(`Unable to find declaration for identifier ${identifierName}`); } return latestDeclaration; diff --git a/src/fixtures/telemetry_collectors/constants.ts b/src/fixtures/telemetry_collectors/constants.ts index 60df05bac2ae..8896c294676c 100644 --- a/src/fixtures/telemetry_collectors/constants.ts +++ b/src/fixtures/telemetry_collectors/constants.ts @@ -66,3 +66,7 @@ export interface MappedTypes { [key in 'prop3']: number; }; } + +export type RecordWithKnownProps = Record; + +export type IndexedAccessType = Pick; diff --git a/x-pack/.telemetryrc.json b/x-pack/.telemetryrc.json index 706decfc93e9..ae85efcda32d 100644 --- a/x-pack/.telemetryrc.json +++ b/x-pack/.telemetryrc.json @@ -1,7 +1,5 @@ { "output": "plugins/telemetry_collection_xpack/schema/xpack_plugins.json", "root": "plugins/", - "exclude": [ - "plugins/apm/server/lib/apm_telemetry/index.ts" - ] + "exclude": [] } diff --git a/x-pack/plugins/apm/common/__snapshots__/apm_telemetry.test.ts.snap b/x-pack/plugins/apm/common/__snapshots__/apm_telemetry.test.ts.snap index 663411dff76f..9f7a911bf21c 100644 --- a/x-pack/plugins/apm/common/__snapshots__/apm_telemetry.test.ts.snap +++ b/x-pack/plugins/apm/common/__snapshots__/apm_telemetry.test.ts.snap @@ -11,6 +11,67 @@ exports[`APM telemetry helpers getApmTelemetry generates a JSON object with the "properties": { "apm": { "properties": { + "services_per_agent": { + "properties": { + "dotnet": { + "type": "long" + }, + "go": { + "type": "long" + }, + "java": { + "type": "long" + }, + "js-base": { + "type": "long" + }, + "nodejs": { + "type": "long" + }, + "python": { + "type": "long" + }, + "ruby": { + "type": "long" + }, + "rum-js": { + "type": "long" + }, + "otlp": { + "type": "long" + }, + "opentelemetry/cpp": { + "type": "long" + }, + "opentelemetry/dotnet": { + "type": "long" + }, + "opentelemetry/erlang": { + "type": "long" + }, + "opentelemetry/go": { + "type": "long" + }, + "opentelemetry/java": { + "type": "long" + }, + "opentelemetry/nodejs": { + "type": "long" + }, + "opentelemetry/php": { + "type": "long" + }, + "opentelemetry/python": { + "type": "long" + }, + "opentelemetry/ruby": { + "type": "long" + }, + "opentelemetry/webjs": { + "type": "long" + } + } + }, "agents": { "properties": { "dotnet": { @@ -18,8 +79,7 @@ exports[`APM telemetry helpers getApmTelemetry generates a JSON object with the "agent": { "properties": { "version": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" } } }, @@ -27,49 +87,40 @@ exports[`APM telemetry helpers getApmTelemetry generates a JSON object with the "properties": { "framework": { "properties": { - "composite": { - "type": "keyword", - "ignore_above": 1024 - }, "name": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" }, "version": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" + }, + "composite": { + "type": "keyword" } } }, "language": { "properties": { - "composite": { - "type": "keyword", - "ignore_above": 1024 - }, "name": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" }, "version": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" + }, + "composite": { + "type": "keyword" } } }, "runtime": { "properties": { - "composite": { - "type": "keyword", - "ignore_above": 1024 - }, "name": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" }, "version": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" + }, + "composite": { + "type": "keyword" } } } @@ -82,8 +133,7 @@ exports[`APM telemetry helpers getApmTelemetry generates a JSON object with the "agent": { "properties": { "version": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" } } }, @@ -91,49 +141,40 @@ exports[`APM telemetry helpers getApmTelemetry generates a JSON object with the "properties": { "framework": { "properties": { - "composite": { - "type": "keyword", - "ignore_above": 1024 - }, "name": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" }, "version": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" + }, + "composite": { + "type": "keyword" } } }, "language": { "properties": { - "composite": { - "type": "keyword", - "ignore_above": 1024 - }, "name": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" }, "version": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" + }, + "composite": { + "type": "keyword" } } }, "runtime": { "properties": { - "composite": { - "type": "keyword", - "ignore_above": 1024 - }, "name": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" }, "version": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" + }, + "composite": { + "type": "keyword" } } } @@ -146,8 +187,7 @@ exports[`APM telemetry helpers getApmTelemetry generates a JSON object with the "agent": { "properties": { "version": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" } } }, @@ -155,49 +195,40 @@ exports[`APM telemetry helpers getApmTelemetry generates a JSON object with the "properties": { "framework": { "properties": { - "composite": { - "type": "keyword", - "ignore_above": 1024 - }, "name": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" }, "version": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" + }, + "composite": { + "type": "keyword" } } }, "language": { "properties": { - "composite": { - "type": "keyword", - "ignore_above": 1024 - }, "name": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" }, "version": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" + }, + "composite": { + "type": "keyword" } } }, "runtime": { "properties": { - "composite": { - "type": "keyword", - "ignore_above": 1024 - }, "name": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" }, "version": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" + }, + "composite": { + "type": "keyword" } } } @@ -210,8 +241,7 @@ exports[`APM telemetry helpers getApmTelemetry generates a JSON object with the "agent": { "properties": { "version": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" } } }, @@ -219,49 +249,40 @@ exports[`APM telemetry helpers getApmTelemetry generates a JSON object with the "properties": { "framework": { "properties": { - "composite": { - "type": "keyword", - "ignore_above": 1024 - }, "name": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" }, "version": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" + }, + "composite": { + "type": "keyword" } } }, "language": { "properties": { - "composite": { - "type": "keyword", - "ignore_above": 1024 - }, "name": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" }, "version": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" + }, + "composite": { + "type": "keyword" } } }, "runtime": { "properties": { - "composite": { - "type": "keyword", - "ignore_above": 1024 - }, "name": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" }, "version": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" + }, + "composite": { + "type": "keyword" } } } @@ -274,8 +295,7 @@ exports[`APM telemetry helpers getApmTelemetry generates a JSON object with the "agent": { "properties": { "version": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" } } }, @@ -283,49 +303,40 @@ exports[`APM telemetry helpers getApmTelemetry generates a JSON object with the "properties": { "framework": { "properties": { - "composite": { - "type": "keyword", - "ignore_above": 1024 - }, "name": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" }, "version": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" + }, + "composite": { + "type": "keyword" } } }, "language": { "properties": { - "composite": { - "type": "keyword", - "ignore_above": 1024 - }, "name": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" }, "version": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" + }, + "composite": { + "type": "keyword" } } }, "runtime": { "properties": { - "composite": { - "type": "keyword", - "ignore_above": 1024 - }, "name": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" }, "version": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" + }, + "composite": { + "type": "keyword" } } } @@ -338,8 +349,7 @@ exports[`APM telemetry helpers getApmTelemetry generates a JSON object with the "agent": { "properties": { "version": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" } } }, @@ -347,49 +357,40 @@ exports[`APM telemetry helpers getApmTelemetry generates a JSON object with the "properties": { "framework": { "properties": { - "composite": { - "type": "keyword", - "ignore_above": 1024 - }, "name": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" }, "version": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" + }, + "composite": { + "type": "keyword" } } }, "language": { "properties": { - "composite": { - "type": "keyword", - "ignore_above": 1024 - }, "name": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" }, "version": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" + }, + "composite": { + "type": "keyword" } } }, "runtime": { "properties": { - "composite": { - "type": "keyword", - "ignore_above": 1024 - }, "name": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" }, "version": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" + }, + "composite": { + "type": "keyword" } } } @@ -402,8 +403,7 @@ exports[`APM telemetry helpers getApmTelemetry generates a JSON object with the "agent": { "properties": { "version": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" } } }, @@ -411,49 +411,40 @@ exports[`APM telemetry helpers getApmTelemetry generates a JSON object with the "properties": { "framework": { "properties": { - "composite": { - "type": "keyword", - "ignore_above": 1024 - }, "name": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" }, "version": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" + }, + "composite": { + "type": "keyword" } } }, "language": { "properties": { - "composite": { - "type": "keyword", - "ignore_above": 1024 - }, "name": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" }, "version": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" + }, + "composite": { + "type": "keyword" } } }, "runtime": { "properties": { - "composite": { - "type": "keyword", - "ignore_above": 1024 - }, "name": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" }, "version": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" + }, + "composite": { + "type": "keyword" } } } @@ -466,8 +457,7 @@ exports[`APM telemetry helpers getApmTelemetry generates a JSON object with the "agent": { "properties": { "version": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" } } }, @@ -475,49 +465,40 @@ exports[`APM telemetry helpers getApmTelemetry generates a JSON object with the "properties": { "framework": { "properties": { - "composite": { - "type": "keyword", - "ignore_above": 1024 - }, "name": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" }, "version": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" + }, + "composite": { + "type": "keyword" } } }, "language": { "properties": { - "composite": { - "type": "keyword", - "ignore_above": 1024 - }, "name": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" }, "version": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" + }, + "composite": { + "type": "keyword" } } }, "runtime": { "properties": { - "composite": { - "type": "keyword", - "ignore_above": 1024 - }, "name": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" }, "version": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" + }, + "composite": { + "type": "keyword" } } } @@ -530,8 +511,7 @@ exports[`APM telemetry helpers getApmTelemetry generates a JSON object with the "agent": { "properties": { "version": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" } } }, @@ -539,49 +519,40 @@ exports[`APM telemetry helpers getApmTelemetry generates a JSON object with the "properties": { "framework": { "properties": { - "composite": { - "type": "keyword", - "ignore_above": 1024 - }, "name": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" }, "version": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" + }, + "composite": { + "type": "keyword" } } }, "language": { "properties": { - "composite": { - "type": "keyword", - "ignore_above": 1024 - }, "name": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" }, "version": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" + }, + "composite": { + "type": "keyword" } } }, "runtime": { "properties": { - "composite": { - "type": "keyword", - "ignore_above": 1024 - }, "name": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" }, "version": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" + }, + "composite": { + "type": "keyword" } } } @@ -594,8 +565,7 @@ exports[`APM telemetry helpers getApmTelemetry generates a JSON object with the "agent": { "properties": { "version": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" } } }, @@ -603,49 +573,40 @@ exports[`APM telemetry helpers getApmTelemetry generates a JSON object with the "properties": { "framework": { "properties": { - "composite": { - "type": "keyword", - "ignore_above": 1024 - }, "name": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" }, "version": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" + }, + "composite": { + "type": "keyword" } } }, "language": { "properties": { - "composite": { - "type": "keyword", - "ignore_above": 1024 - }, "name": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" }, "version": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" + }, + "composite": { + "type": "keyword" } } }, "runtime": { "properties": { - "composite": { - "type": "keyword", - "ignore_above": 1024 - }, "name": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" }, "version": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" + }, + "composite": { + "type": "keyword" } } } @@ -658,8 +619,7 @@ exports[`APM telemetry helpers getApmTelemetry generates a JSON object with the "agent": { "properties": { "version": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" } } }, @@ -667,49 +627,40 @@ exports[`APM telemetry helpers getApmTelemetry generates a JSON object with the "properties": { "framework": { "properties": { - "composite": { - "type": "keyword", - "ignore_above": 1024 - }, "name": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" }, "version": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" + }, + "composite": { + "type": "keyword" } } }, "language": { "properties": { - "composite": { - "type": "keyword", - "ignore_above": 1024 - }, "name": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" }, "version": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" + }, + "composite": { + "type": "keyword" } } }, "runtime": { "properties": { - "composite": { - "type": "keyword", - "ignore_above": 1024 - }, "name": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" }, "version": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" + }, + "composite": { + "type": "keyword" } } } @@ -722,8 +673,7 @@ exports[`APM telemetry helpers getApmTelemetry generates a JSON object with the "agent": { "properties": { "version": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" } } }, @@ -731,49 +681,40 @@ exports[`APM telemetry helpers getApmTelemetry generates a JSON object with the "properties": { "framework": { "properties": { - "composite": { - "type": "keyword", - "ignore_above": 1024 - }, "name": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" }, "version": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" + }, + "composite": { + "type": "keyword" } } }, "language": { "properties": { - "composite": { - "type": "keyword", - "ignore_above": 1024 - }, "name": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" }, "version": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" + }, + "composite": { + "type": "keyword" } } }, "runtime": { "properties": { - "composite": { - "type": "keyword", - "ignore_above": 1024 - }, "name": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" }, "version": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" + }, + "composite": { + "type": "keyword" } } } @@ -786,8 +727,7 @@ exports[`APM telemetry helpers getApmTelemetry generates a JSON object with the "agent": { "properties": { "version": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" } } }, @@ -795,49 +735,40 @@ exports[`APM telemetry helpers getApmTelemetry generates a JSON object with the "properties": { "framework": { "properties": { - "composite": { - "type": "keyword", - "ignore_above": 1024 - }, "name": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" }, "version": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" + }, + "composite": { + "type": "keyword" } } }, "language": { "properties": { - "composite": { - "type": "keyword", - "ignore_above": 1024 - }, "name": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" }, "version": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" + }, + "composite": { + "type": "keyword" } } }, "runtime": { "properties": { - "composite": { - "type": "keyword", - "ignore_above": 1024 - }, "name": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" }, "version": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" + }, + "composite": { + "type": "keyword" } } } @@ -850,8 +781,7 @@ exports[`APM telemetry helpers getApmTelemetry generates a JSON object with the "agent": { "properties": { "version": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" } } }, @@ -859,49 +789,40 @@ exports[`APM telemetry helpers getApmTelemetry generates a JSON object with the "properties": { "framework": { "properties": { - "composite": { - "type": "keyword", - "ignore_above": 1024 - }, "name": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" }, "version": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" + }, + "composite": { + "type": "keyword" } } }, "language": { "properties": { - "composite": { - "type": "keyword", - "ignore_above": 1024 - }, "name": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" }, "version": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" + }, + "composite": { + "type": "keyword" } } }, "runtime": { "properties": { - "composite": { - "type": "keyword", - "ignore_above": 1024 - }, "name": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" }, "version": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" + }, + "composite": { + "type": "keyword" } } } @@ -914,8 +835,7 @@ exports[`APM telemetry helpers getApmTelemetry generates a JSON object with the "agent": { "properties": { "version": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" } } }, @@ -923,49 +843,40 @@ exports[`APM telemetry helpers getApmTelemetry generates a JSON object with the "properties": { "framework": { "properties": { - "composite": { - "type": "keyword", - "ignore_above": 1024 - }, "name": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" }, "version": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" + }, + "composite": { + "type": "keyword" } } }, "language": { "properties": { - "composite": { - "type": "keyword", - "ignore_above": 1024 - }, "name": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" }, "version": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" + }, + "composite": { + "type": "keyword" } } }, "runtime": { "properties": { - "composite": { - "type": "keyword", - "ignore_above": 1024 - }, "name": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" }, "version": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" + }, + "composite": { + "type": "keyword" } } } @@ -978,8 +889,7 @@ exports[`APM telemetry helpers getApmTelemetry generates a JSON object with the "agent": { "properties": { "version": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" } } }, @@ -987,49 +897,40 @@ exports[`APM telemetry helpers getApmTelemetry generates a JSON object with the "properties": { "framework": { "properties": { - "composite": { - "type": "keyword", - "ignore_above": 1024 - }, "name": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" }, "version": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" + }, + "composite": { + "type": "keyword" } } }, "language": { "properties": { - "composite": { - "type": "keyword", - "ignore_above": 1024 - }, "name": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" }, "version": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" + }, + "composite": { + "type": "keyword" } } }, "runtime": { "properties": { - "composite": { - "type": "keyword", - "ignore_above": 1024 - }, "name": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" }, "version": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" + }, + "composite": { + "type": "keyword" } } } @@ -1042,8 +943,7 @@ exports[`APM telemetry helpers getApmTelemetry generates a JSON object with the "agent": { "properties": { "version": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" } } }, @@ -1051,49 +951,40 @@ exports[`APM telemetry helpers getApmTelemetry generates a JSON object with the "properties": { "framework": { "properties": { - "composite": { - "type": "keyword", - "ignore_above": 1024 - }, "name": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" }, "version": { - "type": "keyword", - "ignore_above": 1024 - } + "type": "keyword" + }, + "composite": { + "type": "keyword" + } } }, "language": { "properties": { - "composite": { - "type": "keyword", - "ignore_above": 1024 - }, "name": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" }, "version": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" + }, + "composite": { + "type": "keyword" } } }, "runtime": { "properties": { - "composite": { - "type": "keyword", - "ignore_above": 1024 - }, "name": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" }, "version": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" + }, + "composite": { + "type": "keyword" } } } @@ -1106,8 +997,7 @@ exports[`APM telemetry helpers getApmTelemetry generates a JSON object with the "agent": { "properties": { "version": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" } } }, @@ -1115,49 +1005,40 @@ exports[`APM telemetry helpers getApmTelemetry generates a JSON object with the "properties": { "framework": { "properties": { - "composite": { - "type": "keyword", - "ignore_above": 1024 - }, "name": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" }, "version": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" + }, + "composite": { + "type": "keyword" } } }, "language": { "properties": { - "composite": { - "type": "keyword", - "ignore_above": 1024 - }, "name": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" }, "version": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" + }, + "composite": { + "type": "keyword" } } }, "runtime": { "properties": { - "composite": { - "type": "keyword", - "ignore_above": 1024 - }, "name": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" }, "version": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" + }, + "composite": { + "type": "keyword" } } } @@ -1170,8 +1051,7 @@ exports[`APM telemetry helpers getApmTelemetry generates a JSON object with the "agent": { "properties": { "version": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" } } }, @@ -1179,49 +1059,40 @@ exports[`APM telemetry helpers getApmTelemetry generates a JSON object with the "properties": { "framework": { "properties": { - "composite": { - "type": "keyword", - "ignore_above": 1024 - }, "name": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" }, "version": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" + }, + "composite": { + "type": "keyword" } } }, "language": { "properties": { - "composite": { - "type": "keyword", - "ignore_above": 1024 - }, "name": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" }, "version": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" + }, + "composite": { + "type": "keyword" } } }, "runtime": { "properties": { - "composite": { - "type": "keyword", - "ignore_above": 1024 - }, "name": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" }, "version": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" + }, + "composite": { + "type": "keyword" } } } @@ -1231,6 +1102,39 @@ exports[`APM telemetry helpers getApmTelemetry generates a JSON object with the } } }, + "has_any_services": { + "type": "boolean" + }, + "version": { + "properties": { + "apm_server": { + "properties": { + "major": { + "type": "long" + }, + "minor": { + "type": "long" + }, + "patch": { + "type": "long" + } + } + } + } + }, + "environments": { + "properties": { + "services_without_environments": { + "type": "long" + }, + "services_with_multiple_environments": { + "type": "long" + }, + "top_environments": { + "type": "keyword" + } + } + }, "aggregated_transactions": { "properties": { "current_implementation": { @@ -1240,9 +1144,6 @@ exports[`APM telemetry helpers getApmTelemetry generates a JSON object with the }, "transaction_count": { "type": "long" - }, - "ratio": { - "type": "float" } } }, @@ -1253,67 +1154,77 @@ exports[`APM telemetry helpers getApmTelemetry generates a JSON object with the }, "transaction_count": { "type": "long" - }, - "ratio": { - "type": "float" } } }, - "with_country": { + "no_rum": { "properties": { "expected_metric_document_count": { "type": "long" }, "transaction_count": { "type": "long" + } + } + }, + "no_rum_no_observer_name": { + "properties": { + "expected_metric_document_count": { + "type": "long" }, - "ratio": { - "type": "float" + "transaction_count": { + "type": "long" } } - } - } - }, - "environments": { - "properties": { - "services_without_environment": { - "type": "long" }, - "services_with_multiple_environments": { - "type": "long" + "only_rum": { + "properties": { + "expected_metric_document_count": { + "type": "long" + }, + "transaction_count": { + "type": "long" + } + } }, - "top_enviroments": { - "type": "keyword", - "ignore_above": 1024 + "only_rum_no_observer_name": { + "properties": { + "expected_metric_document_count": { + "type": "long" + }, + "transaction_count": { + "type": "long" + } + } } } }, "cloud": { "properties": { "availability_zone": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" }, "provider": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" }, "region": { - "type": "keyword", - "ignore_above": 1024 + "type": "keyword" } } }, "counts": { "properties": { - "agent_configuration": { + "transaction": { "properties": { + "1d": { + "type": "long" + }, "all": { "type": "long" } } }, - "error": { + "span": { "properties": { "1d": { "type": "long" @@ -1323,21 +1234,27 @@ exports[`APM telemetry helpers getApmTelemetry generates a JSON object with the } } }, - "max_error_groups_per_service": { + "error": { "properties": { "1d": { "type": "long" + }, + "all": { + "type": "long" } } }, - "max_transaction_groups_per_service": { + "metric": { "properties": { "1d": { "type": "long" + }, + "all": { + "type": "long" } } }, - "metric": { + "sourcemap": { "properties": { "1d": { "type": "long" @@ -1357,14 +1274,14 @@ exports[`APM telemetry helpers getApmTelemetry generates a JSON object with the } } }, - "services": { + "agent_configuration": { "properties": { - "1d": { + "all": { "type": "long" } } }, - "sourcemap": { + "max_transaction_groups_per_service": { "properties": { "1d": { "type": "long" @@ -1374,7 +1291,7 @@ exports[`APM telemetry helpers getApmTelemetry generates a JSON object with the } } }, - "span": { + "max_error_groups_per_service": { "properties": { "1d": { "type": "long" @@ -1388,10 +1305,13 @@ exports[`APM telemetry helpers getApmTelemetry generates a JSON object with the "properties": { "1d": { "type": "long" + }, + "all": { + "type": "long" } } }, - "transaction": { + "services": { "properties": { "1d": { "type": "long" @@ -1470,55 +1390,22 @@ exports[`APM telemetry helpers getApmTelemetry generates a JSON object with the } } }, - "has_any_services": { - "type": "boolean" - }, - "indices": { + "retainment": { "properties": { - "all": { - "properties": { - "total": { - "properties": { - "docs": { - "properties": { - "count": { - "type": "long" - } - } - }, - "store": { - "properties": { - "size_in_bytes": { - "type": "long" - } - } - } - } - } - } - }, - "shards": { + "span": { "properties": { - "total": { + "ms": { "type": "long" } } - } - } - }, - "integrations": { - "properties": { - "ml": { + }, + "transaction": { "properties": { - "all_jobs_count": { + "ms": { "type": "long" } } - } - } - }, - "retainment": { - "properties": { + }, "error": { "properties": { "ms": { @@ -1533,106 +1420,63 @@ exports[`APM telemetry helpers getApmTelemetry generates a JSON object with the } } }, - "onboarding": { + "sourcemap": { "properties": { "ms": { "type": "long" } } }, - "span": { + "onboarding": { "properties": { "ms": { "type": "long" } } - }, - "transaction": { + } + } + }, + "integrations": { + "properties": { + "ml": { "properties": { - "ms": { + "all_jobs_count": { "type": "long" } } } } }, - "services_per_agent": { + "indices": { "properties": { - "dotnet": { - "type": "long", - "null_value": 0 - }, - "go": { - "type": "long", - "null_value": 0 - }, - "java": { - "type": "long", - "null_value": 0 - }, - "js-base": { - "type": "long", - "null_value": 0 - }, - "nodejs": { - "type": "long", - "null_value": 0 - }, - "python": { - "type": "long", - "null_value": 0 - }, - "ruby": { - "type": "long", - "null_value": 0 - }, - "rum-js": { - "type": "long", - "null_value": 0 - }, - "otlp": { - "type": "long", - "null_value": 0 - }, - "opentelemetry/cpp": { - "type": "long", - "null_value": 0 - }, - "opentelemetry/dotnet": { - "type": "long", - "null_value": 0 - }, - "opentelemetry/erlang": { - "type": "long", - "null_value": 0 - }, - "opentelemetry/go": { - "type": "long", - "null_value": 0 - }, - "opentelemetry/java": { - "type": "long", - "null_value": 0 - }, - "opentelemetry/nodejs": { - "type": "long", - "null_value": 0 - }, - "opentelemetry/php": { - "type": "long", - "null_value": 0 - }, - "opentelemetry/python": { - "type": "long", - "null_value": 0 - }, - "opentelemetry/ruby": { - "type": "long", - "null_value": 0 + "shards": { + "properties": { + "total": { + "type": "long" + } + } }, - "opentelemetry/webjs": { - "type": "long", - "null_value": 0 + "all": { + "properties": { + "total": { + "properties": { + "docs": { + "properties": { + "count": { + "type": "long" + } + } + }, + "store": { + "properties": { + "size_in_bytes": { + "type": "long" + } + } + } + } + } + } } } }, @@ -1649,7 +1493,7 @@ exports[`APM telemetry helpers getApmTelemetry generates a JSON object with the } } }, - "agent_configuration": { + "cloud": { "properties": { "took": { "properties": { @@ -1660,7 +1504,7 @@ exports[`APM telemetry helpers getApmTelemetry generates a JSON object with the } } }, - "agents": { + "processor_events": { "properties": { "took": { "properties": { @@ -1671,7 +1515,7 @@ exports[`APM telemetry helpers getApmTelemetry generates a JSON object with the } } }, - "cardinality": { + "agent_configuration": { "properties": { "took": { "properties": { @@ -1682,7 +1526,7 @@ exports[`APM telemetry helpers getApmTelemetry generates a JSON object with the } } }, - "cloud": { + "services": { "properties": { "took": { "properties": { @@ -1693,7 +1537,7 @@ exports[`APM telemetry helpers getApmTelemetry generates a JSON object with the } } }, - "environments": { + "versions": { "properties": { "took": { "properties": { @@ -1715,17 +1559,6 @@ exports[`APM telemetry helpers getApmTelemetry generates a JSON object with the } } }, - "indices_stats": { - "properties": { - "took": { - "properties": { - "ms": { - "type": "long" - } - } - } - } - }, "integrations": { "properties": { "took": { @@ -1737,7 +1570,7 @@ exports[`APM telemetry helpers getApmTelemetry generates a JSON object with the } } }, - "processor_events": { + "agents": { "properties": { "took": { "properties": { @@ -1748,7 +1581,7 @@ exports[`APM telemetry helpers getApmTelemetry generates a JSON object with the } } }, - "services": { + "indices_stats": { "properties": { "took": { "properties": { @@ -1759,7 +1592,7 @@ exports[`APM telemetry helpers getApmTelemetry generates a JSON object with the } } }, - "versions": { + "cardinality": { "properties": { "took": { "properties": { @@ -1771,23 +1604,6 @@ exports[`APM telemetry helpers getApmTelemetry generates a JSON object with the } } } - }, - "version": { - "properties": { - "apm_server": { - "properties": { - "major": { - "type": "long" - }, - "minor": { - "type": "long" - }, - "patch": { - "type": "long" - } - } - } - } } } } diff --git a/x-pack/plugins/apm/common/apm_telemetry.ts b/x-pack/plugins/apm/common/apm_telemetry.ts index 874cee05553d..faf5b21d69c7 100644 --- a/x-pack/plugins/apm/common/apm_telemetry.ts +++ b/x-pack/plugins/apm/common/apm_telemetry.ts @@ -4,260 +4,39 @@ * you may not use this file except in compliance with the Elastic License. */ import { produce } from 'immer'; -import { AGENT_NAMES } from './agent_name'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths +import { apmSchema } from '../server/lib/apm_telemetry/schema'; + +function schemaToMapping(schemaLeaf: any): any { + // convert "array" definition to mapping + if (schemaLeaf.type === 'array') { + return schemaToMapping(schemaLeaf.items); + } + + if (typeof schemaLeaf.type === 'string') { + return schemaLeaf; + } + + return Object.entries(schemaLeaf).reduce((acc, [key, value]) => { + const propMapping = schemaToMapping(value); + + return { + ...acc, + [key]: + typeof propMapping.type === 'string' + ? propMapping + : { properties: propMapping }, + }; + }, {}); +} /** - * Generate an object containing the mapping used for APM telemetry. Can be used - * with the `upload-telemetry-data` script or to update the mapping in the - * telemetry repository. - * - * This function breaks things up to make the mapping easier to understand. + * Generate an object containing the mapping used for APM telemetry based on the schema specified + * in the usage collector. Can be used with the `upload-telemetry-data` script or to update the + * mapping in the telemetry repository. */ export function getApmTelemetryMapping() { - const keyword = { - type: 'keyword', - ignore_above: 1024, - }; - - const float = { - type: 'float', - }; - - const long = { - type: 'long', - }; - - const allProperties = { - properties: { - all: long, - }, - }; - - const oneDayProperties = { - properties: { - '1d': long, - }, - }; - - const oneDayAllProperties = { - properties: { - '1d': long, - all: long, - }, - }; - - const msProperties = { - properties: { - ms: long, - }, - }; - - const tookProperties = { - properties: { - took: msProperties, - }, - }; - - const compositeNameVersionProperties = { - properties: { - composite: keyword, - name: keyword, - version: keyword, - }, - }; - - const agentProperties = { - properties: { version: keyword }, - }; - - const serviceProperties = { - properties: { - framework: compositeNameVersionProperties, - language: compositeNameVersionProperties, - runtime: compositeNameVersionProperties, - }, - }; - - const aggregatedTransactionsProperties = { - properties: { - expected_metric_document_count: long, - transaction_count: long, - ratio: float, - }, - }; - - return { - properties: { - agents: { - properties: AGENT_NAMES.reduce>( - (previousValue, currentValue) => { - previousValue[currentValue] = { - properties: { - agent: agentProperties, - service: serviceProperties, - }, - }; - - return previousValue; - }, - {} - ), - }, - aggregated_transactions: { - properties: { - current_implementation: aggregatedTransactionsProperties, - no_observer_name: aggregatedTransactionsProperties, - with_country: aggregatedTransactionsProperties, - }, - }, - environments: { - properties: { - services_without_environment: long, - services_with_multiple_environments: long, - top_enviroments: keyword, - }, - }, - cloud: { - properties: { - availability_zone: keyword, - provider: keyword, - region: keyword, - }, - }, - counts: { - properties: { - agent_configuration: allProperties, - error: oneDayAllProperties, - max_error_groups_per_service: oneDayProperties, - max_transaction_groups_per_service: oneDayProperties, - metric: oneDayAllProperties, - onboarding: oneDayAllProperties, - services: oneDayProperties, - sourcemap: oneDayAllProperties, - span: oneDayAllProperties, - traces: oneDayProperties, - transaction: oneDayAllProperties, - }, - }, - cardinality: { - properties: { - client: { - properties: { - geo: { - properties: { - country_iso_code: { properties: { rum: oneDayProperties } }, - }, - }, - }, - }, - user_agent: { - properties: { - original: { - properties: { - all_agents: oneDayProperties, - rum: oneDayProperties, - }, - }, - }, - }, - transaction: { - properties: { - name: { - properties: { - all_agents: oneDayProperties, - rum: oneDayProperties, - }, - }, - }, - }, - }, - }, - has_any_services: { - type: 'boolean', - }, - indices: { - properties: { - all: { - properties: { - total: { - properties: { - docs: { - properties: { - count: long, - }, - }, - store: { - properties: { - size_in_bytes: long, - }, - }, - }, - }, - }, - }, - shards: { - properties: { - total: long, - }, - }, - }, - }, - integrations: { - properties: { - ml: { - properties: { - all_jobs_count: long, - }, - }, - }, - }, - retainment: { - properties: { - error: msProperties, - metric: msProperties, - onboarding: msProperties, - span: msProperties, - transaction: msProperties, - }, - }, - services_per_agent: { - properties: AGENT_NAMES.reduce>( - (previousValue, currentValue) => { - previousValue[currentValue] = { ...long, null_value: 0 }; - return previousValue; - }, - {} - ), - }, - tasks: { - properties: { - aggregated_transactions: tookProperties, - agent_configuration: tookProperties, - agents: tookProperties, - cardinality: tookProperties, - cloud: tookProperties, - environments: tookProperties, - groupings: tookProperties, - indices_stats: tookProperties, - integrations: tookProperties, - processor_events: tookProperties, - services: tookProperties, - versions: tookProperties, - }, - }, - version: { - properties: { - apm_server: { - properties: { - major: long, - minor: long, - patch: long, - }, - }, - }, - }, - }, - }; + return { properties: schemaToMapping(apmSchema) }; } /** diff --git a/x-pack/plugins/apm/server/lib/apm_telemetry/index.ts b/x-pack/plugins/apm/server/lib/apm_telemetry/index.ts index f78280aa7428..c93fdfc15fe3 100644 --- a/x-pack/plugins/apm/server/lib/apm_telemetry/index.ts +++ b/x-pack/plugins/apm/server/lib/apm_telemetry/index.ts @@ -6,7 +6,6 @@ import { Observable } from 'rxjs'; import { take } from 'rxjs/operators'; import { UsageCollectionSetup } from 'src/plugins/usage_collection/server'; -import { DeepRequired } from 'utility-types'; import { CoreSetup, Logger, @@ -21,14 +20,14 @@ import { APM_TELEMETRY_SAVED_OBJECT_ID, APM_TELEMETRY_SAVED_OBJECT_TYPE, } from '../../../common/apm_saved_object_constants'; -import { getApmTelemetryMapping } from '../../../common/apm_telemetry'; import { getInternalSavedObjectsClient } from '../helpers/get_internal_saved_objects_client'; import { getApmIndices } from '../settings/apm_indices/get_apm_indices'; import { collectDataTelemetry, CollectTelemetryParams, } from './collect_data_telemetry'; -import { APMDataTelemetry } from './types'; +import { APMUsage } from './types'; +import { apmSchema } from './schema'; const APM_TELEMETRY_TASK_NAME = 'apm-telemetry-task'; @@ -107,9 +106,9 @@ export async function createApmTelemetry({ ); }; - const collector = usageCollector.makeUsageCollector({ + const collector = usageCollector.makeUsageCollector({ type: 'apm', - schema: getApmTelemetryMapping(), + schema: apmSchema, fetch: async () => { try { const { kibanaVersion: storedKibanaVersion, ...data } = ( @@ -117,9 +116,7 @@ export async function createApmTelemetry({ APM_TELEMETRY_SAVED_OBJECT_TYPE, APM_TELEMETRY_SAVED_OBJECT_ID ) - ).attributes as { kibanaVersion: string } & DeepRequired< - APMDataTelemetry - >; + ).attributes as { kibanaVersion: string } & APMUsage; return data; } catch (err) { diff --git a/x-pack/plugins/apm/server/lib/apm_telemetry/schema.ts b/x-pack/plugins/apm/server/lib/apm_telemetry/schema.ts new file mode 100644 index 000000000000..4bbda9add0fd --- /dev/null +++ b/x-pack/plugins/apm/server/lib/apm_telemetry/schema.ts @@ -0,0 +1,206 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { MakeSchemaFrom } from 'src/plugins/usage_collection/server'; +import { + AggregatedTransactionsCounts, + APMUsage, + TimeframeMap, + TimeframeMap1d, + TimeframeMapAll, +} from './types'; +import { AgentName } from '../../../typings/es_schemas/ui/fields/agent'; + +const long: { type: 'long' } = { type: 'long' }; + +const aggregatedTransactionCountSchema: MakeSchemaFrom = { + expected_metric_document_count: long, + transaction_count: long, +}; + +const timeframeMap1dSchema: MakeSchemaFrom = { + '1d': long, +}; + +const timeframeMapAllSchema: MakeSchemaFrom = { + all: long, +}; + +const timeframeMapSchema: MakeSchemaFrom = { + ...timeframeMap1dSchema, + ...timeframeMapAllSchema, +}; + +const agentSchema: MakeSchemaFrom['agents'][AgentName] = { + agent: { + version: { type: 'array', items: { type: 'keyword' } }, + }, + service: { + framework: { + name: { type: 'array', items: { type: 'keyword' } }, + version: { type: 'array', items: { type: 'keyword' } }, + composite: { type: 'array', items: { type: 'keyword' } }, + }, + language: { + name: { type: 'array', items: { type: 'keyword' } }, + version: { type: 'array', items: { type: 'keyword' } }, + composite: { type: 'array', items: { type: 'keyword' } }, + }, + runtime: { + name: { type: 'array', items: { type: 'keyword' } }, + version: { type: 'array', items: { type: 'keyword' } }, + composite: { type: 'array', items: { type: 'keyword' } }, + }, + }, +}; + +const apmPerAgentSchema: Pick< + MakeSchemaFrom, + 'services_per_agent' | 'agents' +> = { + // services_per_agent: AGENT_NAMES.reduce( + // (acc, name) => ({ ...acc, [name]: long }), + // {} as Record + // ), + // agents: AGENT_NAMES.reduce( + // (acc, name) => ({ ...acc, [name]: agentSchema }), + // {} as Record + // ), + // TODO: Find a way for `@kbn/telemetry-tools` to understand and evaluate expressions. + // In the meanwhile, we'll have to maintain these lists up to date (TS will remind us to update) + services_per_agent: { + dotnet: long, + go: long, + java: long, + 'js-base': long, + nodejs: long, + python: long, + ruby: long, + 'rum-js': long, + otlp: long, + 'opentelemetry/cpp': long, + 'opentelemetry/dotnet': long, + 'opentelemetry/erlang': long, + 'opentelemetry/go': long, + 'opentelemetry/java': long, + 'opentelemetry/nodejs': long, + 'opentelemetry/php': long, + 'opentelemetry/python': long, + 'opentelemetry/ruby': long, + 'opentelemetry/webjs': long, + }, + agents: { + dotnet: agentSchema, + go: agentSchema, + java: agentSchema, + 'js-base': agentSchema, + nodejs: agentSchema, + python: agentSchema, + ruby: agentSchema, + 'rum-js': agentSchema, + otlp: agentSchema, + 'opentelemetry/cpp': agentSchema, + 'opentelemetry/dotnet': agentSchema, + 'opentelemetry/erlang': agentSchema, + 'opentelemetry/go': agentSchema, + 'opentelemetry/java': agentSchema, + 'opentelemetry/nodejs': agentSchema, + 'opentelemetry/php': agentSchema, + 'opentelemetry/python': agentSchema, + 'opentelemetry/ruby': agentSchema, + 'opentelemetry/webjs': agentSchema, + }, +}; + +export const apmSchema: MakeSchemaFrom = { + ...apmPerAgentSchema, + has_any_services: { type: 'boolean' }, + version: { + apm_server: { + major: long, + minor: long, + patch: long, + }, + }, + environments: { + services_without_environments: long, + services_with_multiple_environments: long, + top_environments: { type: 'array', items: { type: 'keyword' } }, + }, + aggregated_transactions: { + current_implementation: aggregatedTransactionCountSchema, + no_observer_name: aggregatedTransactionCountSchema, + no_rum: aggregatedTransactionCountSchema, + no_rum_no_observer_name: aggregatedTransactionCountSchema, + only_rum: aggregatedTransactionCountSchema, + only_rum_no_observer_name: aggregatedTransactionCountSchema, + }, + cloud: { + availability_zone: { type: 'array', items: { type: 'keyword' } }, + provider: { type: 'array', items: { type: 'keyword' } }, + region: { type: 'array', items: { type: 'keyword' } }, + }, + counts: { + transaction: timeframeMapSchema, + span: timeframeMapSchema, + error: timeframeMapSchema, + metric: timeframeMapSchema, + sourcemap: timeframeMapSchema, + onboarding: timeframeMapSchema, + agent_configuration: timeframeMapAllSchema, + max_transaction_groups_per_service: timeframeMapSchema, + max_error_groups_per_service: timeframeMapSchema, + traces: timeframeMapSchema, + services: timeframeMapSchema, + }, + cardinality: { + client: { geo: { country_iso_code: { rum: timeframeMap1dSchema } } }, + user_agent: { + original: { + all_agents: timeframeMap1dSchema, + rum: timeframeMap1dSchema, + }, + }, + transaction: { + name: { + all_agents: timeframeMap1dSchema, + rum: timeframeMap1dSchema, + }, + }, + }, + retainment: { + span: { ms: long }, + transaction: { ms: long }, + error: { ms: long }, + metric: { ms: long }, + sourcemap: { ms: long }, + onboarding: { ms: long }, + }, + integrations: { ml: { all_jobs_count: long } }, + + indices: { + shards: { total: long }, + all: { + total: { + docs: { count: long }, + store: { size_in_bytes: long }, + }, + }, + }, + tasks: { + aggregated_transactions: { took: { ms: long } }, + cloud: { took: { ms: long } }, + processor_events: { took: { ms: long } }, + agent_configuration: { took: { ms: long } }, + services: { took: { ms: long } }, + versions: { took: { ms: long } }, + groupings: { took: { ms: long } }, + integrations: { took: { ms: long } }, + agents: { took: { ms: long } }, + indices_stats: { took: { ms: long } }, + cardinality: { took: { ms: long } }, + }, +}; diff --git a/x-pack/plugins/apm/server/lib/apm_telemetry/types.ts b/x-pack/plugins/apm/server/lib/apm_telemetry/types.ts index c7af292e817c..7ed79752b43c 100644 --- a/x-pack/plugins/apm/server/lib/apm_telemetry/types.ts +++ b/x-pack/plugins/apm/server/lib/apm_telemetry/types.ts @@ -20,7 +20,7 @@ export interface AggregatedTransactionsCounts { transaction_count: number; } -export type APMDataTelemetry = DeepPartial<{ +export interface APMUsage { has_any_services: boolean; services_per_agent: Record; version: { @@ -139,6 +139,8 @@ export type APMDataTelemetry = DeepPartial<{ | 'cardinality', { took: { ms: number } } >; -}>; +} + +export type APMDataTelemetry = DeepPartial; export type APMTelemetry = APMDataTelemetry; diff --git a/x-pack/plugins/telemetry_collection_xpack/schema/xpack_plugins.json b/x-pack/plugins/telemetry_collection_xpack/schema/xpack_plugins.json index 98230f143d3d..478c7e42a0c1 100644 --- a/x-pack/plugins/telemetry_collection_xpack/schema/xpack_plugins.json +++ b/x-pack/plugins/telemetry_collection_xpack/schema/xpack_plugins.json @@ -270,6 +270,2186 @@ } } }, + "apm": { + "properties": { + "services_per_agent": { + "properties": { + "dotnet": { + "type": "long" + }, + "go": { + "type": "long" + }, + "java": { + "type": "long" + }, + "js-base": { + "type": "long" + }, + "nodejs": { + "type": "long" + }, + "python": { + "type": "long" + }, + "ruby": { + "type": "long" + }, + "rum-js": { + "type": "long" + }, + "otlp": { + "type": "long" + }, + "opentelemetry/cpp": { + "type": "long" + }, + "opentelemetry/dotnet": { + "type": "long" + }, + "opentelemetry/erlang": { + "type": "long" + }, + "opentelemetry/go": { + "type": "long" + }, + "opentelemetry/java": { + "type": "long" + }, + "opentelemetry/nodejs": { + "type": "long" + }, + "opentelemetry/php": { + "type": "long" + }, + "opentelemetry/python": { + "type": "long" + }, + "opentelemetry/ruby": { + "type": "long" + }, + "opentelemetry/webjs": { + "type": "long" + } + } + }, + "agents": { + "properties": { + "dotnet": { + "properties": { + "agent": { + "properties": { + "version": { + "type": "array", + "items": { + "type": "keyword" + } + } + } + }, + "service": { + "properties": { + "framework": { + "properties": { + "name": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "version": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "composite": { + "type": "array", + "items": { + "type": "keyword" + } + } + } + }, + "language": { + "properties": { + "name": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "version": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "composite": { + "type": "array", + "items": { + "type": "keyword" + } + } + } + }, + "runtime": { + "properties": { + "name": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "version": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "composite": { + "type": "array", + "items": { + "type": "keyword" + } + } + } + } + } + } + } + }, + "go": { + "properties": { + "agent": { + "properties": { + "version": { + "type": "array", + "items": { + "type": "keyword" + } + } + } + }, + "service": { + "properties": { + "framework": { + "properties": { + "name": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "version": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "composite": { + "type": "array", + "items": { + "type": "keyword" + } + } + } + }, + "language": { + "properties": { + "name": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "version": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "composite": { + "type": "array", + "items": { + "type": "keyword" + } + } + } + }, + "runtime": { + "properties": { + "name": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "version": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "composite": { + "type": "array", + "items": { + "type": "keyword" + } + } + } + } + } + } + } + }, + "java": { + "properties": { + "agent": { + "properties": { + "version": { + "type": "array", + "items": { + "type": "keyword" + } + } + } + }, + "service": { + "properties": { + "framework": { + "properties": { + "name": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "version": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "composite": { + "type": "array", + "items": { + "type": "keyword" + } + } + } + }, + "language": { + "properties": { + "name": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "version": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "composite": { + "type": "array", + "items": { + "type": "keyword" + } + } + } + }, + "runtime": { + "properties": { + "name": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "version": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "composite": { + "type": "array", + "items": { + "type": "keyword" + } + } + } + } + } + } + } + }, + "js-base": { + "properties": { + "agent": { + "properties": { + "version": { + "type": "array", + "items": { + "type": "keyword" + } + } + } + }, + "service": { + "properties": { + "framework": { + "properties": { + "name": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "version": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "composite": { + "type": "array", + "items": { + "type": "keyword" + } + } + } + }, + "language": { + "properties": { + "name": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "version": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "composite": { + "type": "array", + "items": { + "type": "keyword" + } + } + } + }, + "runtime": { + "properties": { + "name": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "version": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "composite": { + "type": "array", + "items": { + "type": "keyword" + } + } + } + } + } + } + } + }, + "nodejs": { + "properties": { + "agent": { + "properties": { + "version": { + "type": "array", + "items": { + "type": "keyword" + } + } + } + }, + "service": { + "properties": { + "framework": { + "properties": { + "name": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "version": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "composite": { + "type": "array", + "items": { + "type": "keyword" + } + } + } + }, + "language": { + "properties": { + "name": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "version": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "composite": { + "type": "array", + "items": { + "type": "keyword" + } + } + } + }, + "runtime": { + "properties": { + "name": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "version": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "composite": { + "type": "array", + "items": { + "type": "keyword" + } + } + } + } + } + } + } + }, + "python": { + "properties": { + "agent": { + "properties": { + "version": { + "type": "array", + "items": { + "type": "keyword" + } + } + } + }, + "service": { + "properties": { + "framework": { + "properties": { + "name": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "version": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "composite": { + "type": "array", + "items": { + "type": "keyword" + } + } + } + }, + "language": { + "properties": { + "name": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "version": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "composite": { + "type": "array", + "items": { + "type": "keyword" + } + } + } + }, + "runtime": { + "properties": { + "name": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "version": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "composite": { + "type": "array", + "items": { + "type": "keyword" + } + } + } + } + } + } + } + }, + "ruby": { + "properties": { + "agent": { + "properties": { + "version": { + "type": "array", + "items": { + "type": "keyword" + } + } + } + }, + "service": { + "properties": { + "framework": { + "properties": { + "name": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "version": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "composite": { + "type": "array", + "items": { + "type": "keyword" + } + } + } + }, + "language": { + "properties": { + "name": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "version": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "composite": { + "type": "array", + "items": { + "type": "keyword" + } + } + } + }, + "runtime": { + "properties": { + "name": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "version": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "composite": { + "type": "array", + "items": { + "type": "keyword" + } + } + } + } + } + } + } + }, + "rum-js": { + "properties": { + "agent": { + "properties": { + "version": { + "type": "array", + "items": { + "type": "keyword" + } + } + } + }, + "service": { + "properties": { + "framework": { + "properties": { + "name": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "version": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "composite": { + "type": "array", + "items": { + "type": "keyword" + } + } + } + }, + "language": { + "properties": { + "name": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "version": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "composite": { + "type": "array", + "items": { + "type": "keyword" + } + } + } + }, + "runtime": { + "properties": { + "name": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "version": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "composite": { + "type": "array", + "items": { + "type": "keyword" + } + } + } + } + } + } + } + }, + "otlp": { + "properties": { + "agent": { + "properties": { + "version": { + "type": "array", + "items": { + "type": "keyword" + } + } + } + }, + "service": { + "properties": { + "framework": { + "properties": { + "name": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "version": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "composite": { + "type": "array", + "items": { + "type": "keyword" + } + } + } + }, + "language": { + "properties": { + "name": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "version": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "composite": { + "type": "array", + "items": { + "type": "keyword" + } + } + } + }, + "runtime": { + "properties": { + "name": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "version": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "composite": { + "type": "array", + "items": { + "type": "keyword" + } + } + } + } + } + } + } + }, + "opentelemetry/cpp": { + "properties": { + "agent": { + "properties": { + "version": { + "type": "array", + "items": { + "type": "keyword" + } + } + } + }, + "service": { + "properties": { + "framework": { + "properties": { + "name": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "version": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "composite": { + "type": "array", + "items": { + "type": "keyword" + } + } + } + }, + "language": { + "properties": { + "name": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "version": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "composite": { + "type": "array", + "items": { + "type": "keyword" + } + } + } + }, + "runtime": { + "properties": { + "name": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "version": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "composite": { + "type": "array", + "items": { + "type": "keyword" + } + } + } + } + } + } + } + }, + "opentelemetry/dotnet": { + "properties": { + "agent": { + "properties": { + "version": { + "type": "array", + "items": { + "type": "keyword" + } + } + } + }, + "service": { + "properties": { + "framework": { + "properties": { + "name": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "version": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "composite": { + "type": "array", + "items": { + "type": "keyword" + } + } + } + }, + "language": { + "properties": { + "name": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "version": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "composite": { + "type": "array", + "items": { + "type": "keyword" + } + } + } + }, + "runtime": { + "properties": { + "name": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "version": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "composite": { + "type": "array", + "items": { + "type": "keyword" + } + } + } + } + } + } + } + }, + "opentelemetry/erlang": { + "properties": { + "agent": { + "properties": { + "version": { + "type": "array", + "items": { + "type": "keyword" + } + } + } + }, + "service": { + "properties": { + "framework": { + "properties": { + "name": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "version": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "composite": { + "type": "array", + "items": { + "type": "keyword" + } + } + } + }, + "language": { + "properties": { + "name": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "version": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "composite": { + "type": "array", + "items": { + "type": "keyword" + } + } + } + }, + "runtime": { + "properties": { + "name": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "version": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "composite": { + "type": "array", + "items": { + "type": "keyword" + } + } + } + } + } + } + } + }, + "opentelemetry/go": { + "properties": { + "agent": { + "properties": { + "version": { + "type": "array", + "items": { + "type": "keyword" + } + } + } + }, + "service": { + "properties": { + "framework": { + "properties": { + "name": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "version": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "composite": { + "type": "array", + "items": { + "type": "keyword" + } + } + } + }, + "language": { + "properties": { + "name": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "version": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "composite": { + "type": "array", + "items": { + "type": "keyword" + } + } + } + }, + "runtime": { + "properties": { + "name": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "version": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "composite": { + "type": "array", + "items": { + "type": "keyword" + } + } + } + } + } + } + } + }, + "opentelemetry/java": { + "properties": { + "agent": { + "properties": { + "version": { + "type": "array", + "items": { + "type": "keyword" + } + } + } + }, + "service": { + "properties": { + "framework": { + "properties": { + "name": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "version": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "composite": { + "type": "array", + "items": { + "type": "keyword" + } + } + } + }, + "language": { + "properties": { + "name": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "version": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "composite": { + "type": "array", + "items": { + "type": "keyword" + } + } + } + }, + "runtime": { + "properties": { + "name": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "version": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "composite": { + "type": "array", + "items": { + "type": "keyword" + } + } + } + } + } + } + } + }, + "opentelemetry/nodejs": { + "properties": { + "agent": { + "properties": { + "version": { + "type": "array", + "items": { + "type": "keyword" + } + } + } + }, + "service": { + "properties": { + "framework": { + "properties": { + "name": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "version": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "composite": { + "type": "array", + "items": { + "type": "keyword" + } + } + } + }, + "language": { + "properties": { + "name": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "version": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "composite": { + "type": "array", + "items": { + "type": "keyword" + } + } + } + }, + "runtime": { + "properties": { + "name": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "version": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "composite": { + "type": "array", + "items": { + "type": "keyword" + } + } + } + } + } + } + } + }, + "opentelemetry/php": { + "properties": { + "agent": { + "properties": { + "version": { + "type": "array", + "items": { + "type": "keyword" + } + } + } + }, + "service": { + "properties": { + "framework": { + "properties": { + "name": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "version": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "composite": { + "type": "array", + "items": { + "type": "keyword" + } + } + } + }, + "language": { + "properties": { + "name": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "version": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "composite": { + "type": "array", + "items": { + "type": "keyword" + } + } + } + }, + "runtime": { + "properties": { + "name": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "version": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "composite": { + "type": "array", + "items": { + "type": "keyword" + } + } + } + } + } + } + } + }, + "opentelemetry/python": { + "properties": { + "agent": { + "properties": { + "version": { + "type": "array", + "items": { + "type": "keyword" + } + } + } + }, + "service": { + "properties": { + "framework": { + "properties": { + "name": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "version": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "composite": { + "type": "array", + "items": { + "type": "keyword" + } + } + } + }, + "language": { + "properties": { + "name": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "version": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "composite": { + "type": "array", + "items": { + "type": "keyword" + } + } + } + }, + "runtime": { + "properties": { + "name": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "version": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "composite": { + "type": "array", + "items": { + "type": "keyword" + } + } + } + } + } + } + } + }, + "opentelemetry/ruby": { + "properties": { + "agent": { + "properties": { + "version": { + "type": "array", + "items": { + "type": "keyword" + } + } + } + }, + "service": { + "properties": { + "framework": { + "properties": { + "name": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "version": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "composite": { + "type": "array", + "items": { + "type": "keyword" + } + } + } + }, + "language": { + "properties": { + "name": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "version": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "composite": { + "type": "array", + "items": { + "type": "keyword" + } + } + } + }, + "runtime": { + "properties": { + "name": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "version": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "composite": { + "type": "array", + "items": { + "type": "keyword" + } + } + } + } + } + } + } + }, + "opentelemetry/webjs": { + "properties": { + "agent": { + "properties": { + "version": { + "type": "array", + "items": { + "type": "keyword" + } + } + } + }, + "service": { + "properties": { + "framework": { + "properties": { + "name": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "version": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "composite": { + "type": "array", + "items": { + "type": "keyword" + } + } + } + }, + "language": { + "properties": { + "name": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "version": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "composite": { + "type": "array", + "items": { + "type": "keyword" + } + } + } + }, + "runtime": { + "properties": { + "name": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "version": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "composite": { + "type": "array", + "items": { + "type": "keyword" + } + } + } + } + } + } + } + } + } + }, + "has_any_services": { + "type": "boolean" + }, + "version": { + "properties": { + "apm_server": { + "properties": { + "major": { + "type": "long" + }, + "minor": { + "type": "long" + }, + "patch": { + "type": "long" + } + } + } + } + }, + "environments": { + "properties": { + "services_without_environments": { + "type": "long" + }, + "services_with_multiple_environments": { + "type": "long" + }, + "top_environments": { + "type": "array", + "items": { + "type": "keyword" + } + } + } + }, + "aggregated_transactions": { + "properties": { + "current_implementation": { + "properties": { + "expected_metric_document_count": { + "type": "long" + }, + "transaction_count": { + "type": "long" + } + } + }, + "no_observer_name": { + "properties": { + "expected_metric_document_count": { + "type": "long" + }, + "transaction_count": { + "type": "long" + } + } + }, + "no_rum": { + "properties": { + "expected_metric_document_count": { + "type": "long" + }, + "transaction_count": { + "type": "long" + } + } + }, + "no_rum_no_observer_name": { + "properties": { + "expected_metric_document_count": { + "type": "long" + }, + "transaction_count": { + "type": "long" + } + } + }, + "only_rum": { + "properties": { + "expected_metric_document_count": { + "type": "long" + }, + "transaction_count": { + "type": "long" + } + } + }, + "only_rum_no_observer_name": { + "properties": { + "expected_metric_document_count": { + "type": "long" + }, + "transaction_count": { + "type": "long" + } + } + } + } + }, + "cloud": { + "properties": { + "availability_zone": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "provider": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "region": { + "type": "array", + "items": { + "type": "keyword" + } + } + } + }, + "counts": { + "properties": { + "transaction": { + "properties": { + "1d": { + "type": "long" + }, + "all": { + "type": "long" + } + } + }, + "span": { + "properties": { + "1d": { + "type": "long" + }, + "all": { + "type": "long" + } + } + }, + "error": { + "properties": { + "1d": { + "type": "long" + }, + "all": { + "type": "long" + } + } + }, + "metric": { + "properties": { + "1d": { + "type": "long" + }, + "all": { + "type": "long" + } + } + }, + "sourcemap": { + "properties": { + "1d": { + "type": "long" + }, + "all": { + "type": "long" + } + } + }, + "onboarding": { + "properties": { + "1d": { + "type": "long" + }, + "all": { + "type": "long" + } + } + }, + "agent_configuration": { + "properties": { + "all": { + "type": "long" + } + } + }, + "max_transaction_groups_per_service": { + "properties": { + "1d": { + "type": "long" + }, + "all": { + "type": "long" + } + } + }, + "max_error_groups_per_service": { + "properties": { + "1d": { + "type": "long" + }, + "all": { + "type": "long" + } + } + }, + "traces": { + "properties": { + "1d": { + "type": "long" + }, + "all": { + "type": "long" + } + } + }, + "services": { + "properties": { + "1d": { + "type": "long" + }, + "all": { + "type": "long" + } + } + } + } + }, + "cardinality": { + "properties": { + "client": { + "properties": { + "geo": { + "properties": { + "country_iso_code": { + "properties": { + "rum": { + "properties": { + "1d": { + "type": "long" + } + } + } + } + } + } + } + } + }, + "user_agent": { + "properties": { + "original": { + "properties": { + "all_agents": { + "properties": { + "1d": { + "type": "long" + } + } + }, + "rum": { + "properties": { + "1d": { + "type": "long" + } + } + } + } + } + } + }, + "transaction": { + "properties": { + "name": { + "properties": { + "all_agents": { + "properties": { + "1d": { + "type": "long" + } + } + }, + "rum": { + "properties": { + "1d": { + "type": "long" + } + } + } + } + } + } + } + } + }, + "retainment": { + "properties": { + "span": { + "properties": { + "ms": { + "type": "long" + } + } + }, + "transaction": { + "properties": { + "ms": { + "type": "long" + } + } + }, + "error": { + "properties": { + "ms": { + "type": "long" + } + } + }, + "metric": { + "properties": { + "ms": { + "type": "long" + } + } + }, + "sourcemap": { + "properties": { + "ms": { + "type": "long" + } + } + }, + "onboarding": { + "properties": { + "ms": { + "type": "long" + } + } + } + } + }, + "integrations": { + "properties": { + "ml": { + "properties": { + "all_jobs_count": { + "type": "long" + } + } + } + } + }, + "indices": { + "properties": { + "shards": { + "properties": { + "total": { + "type": "long" + } + } + }, + "all": { + "properties": { + "total": { + "properties": { + "docs": { + "properties": { + "count": { + "type": "long" + } + } + }, + "store": { + "properties": { + "size_in_bytes": { + "type": "long" + } + } + } + } + } + } + } + } + }, + "tasks": { + "properties": { + "aggregated_transactions": { + "properties": { + "took": { + "properties": { + "ms": { + "type": "long" + } + } + } + } + }, + "cloud": { + "properties": { + "took": { + "properties": { + "ms": { + "type": "long" + } + } + } + } + }, + "processor_events": { + "properties": { + "took": { + "properties": { + "ms": { + "type": "long" + } + } + } + } + }, + "agent_configuration": { + "properties": { + "took": { + "properties": { + "ms": { + "type": "long" + } + } + } + } + }, + "services": { + "properties": { + "took": { + "properties": { + "ms": { + "type": "long" + } + } + } + } + }, + "versions": { + "properties": { + "took": { + "properties": { + "ms": { + "type": "long" + } + } + } + } + }, + "groupings": { + "properties": { + "took": { + "properties": { + "ms": { + "type": "long" + } + } + } + } + }, + "integrations": { + "properties": { + "took": { + "properties": { + "ms": { + "type": "long" + } + } + } + } + }, + "agents": { + "properties": { + "took": { + "properties": { + "ms": { + "type": "long" + } + } + } + } + }, + "indices_stats": { + "properties": { + "took": { + "properties": { + "ms": { + "type": "long" + } + } + } + } + }, + "cardinality": { + "properties": { + "took": { + "properties": { + "ms": { + "type": "long" + } + } + } + } + } + } + } + } + }, "canvas": { "properties": { "workpads": {