From 9189208b5e553541439c8f09fb9a090ca9a5140a Mon Sep 17 00:00:00 2001 From: Carlos Crespo Date: Thu, 1 Aug 2024 17:14:42 +0200 Subject: [PATCH] [Infra] Move apm common types to a package (#189649) part of [#188752](https://github.com/elastic/kibana/issues/188752) ## Summary Move some types to `kbn-apm-types`. These types will be used later in the `apm-data-access` plugin https://github.com/elastic/kibana/pull/189654. --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> --- .github/CODEOWNERS | 1 + package.json | 1 + packages/kbn-apm-types/es_fields.ts | 9 + packages/kbn-apm-types/es_schemas_raw.ts | 9 + packages/kbn-apm-types/es_schemas_ui.ts | 10 + packages/kbn-apm-types/index.ts | 11 + packages/kbn-apm-types/kibana.jsonc | 5 + packages/kbn-apm-types/package.json | 6 + packages/kbn-apm-types/src/es_fields/apm.ts | 197 ++++++++++++++++++ .../src/es_schemas/raw/apm_base_doc.ts | 24 +++ .../src/es_schemas/raw/error_raw.ts | 75 +++++++ .../src/es_schemas/raw/event_raw.ts | 26 +++ .../src/es_schemas/raw/fields/cloud.ts | 34 +++ .../src/es_schemas/raw/fields/container.ts | 12 ++ .../es_schemas/raw/fields/event_outcome.ts | 9 + .../src/es_schemas/raw/fields/faas.ts | 17 ++ .../src/es_schemas/raw/fields/host.ts | 17 ++ .../src/es_schemas/raw/fields/http.ts | 13 ++ .../src/es_schemas/raw/fields/index.ts | 25 +++ .../src/es_schemas/raw/fields/kubernetes.ts | 22 ++ .../src/es_schemas/raw/fields/observer.ts | 17 ++ .../src/es_schemas/raw/fields/page.ts | 12 ++ .../src/es_schemas/raw/fields/process.ts | 14 ++ .../src/es_schemas/raw/fields/service.ts | 28 +++ .../src/es_schemas/raw/fields/span_links.ts | 12 ++ .../src/es_schemas/raw/fields/stackframe.ts | 44 ++++ .../src/es_schemas/raw/fields/timestamp_us.ts | 11 + .../src/es_schemas/raw/fields/url.ts | 13 ++ .../src/es_schemas/raw/fields/user.ts | 11 + .../src/es_schemas/raw/fields/user_agent.ts | 21 ++ .../kbn-apm-types/src/es_schemas/raw/index.ts | 14 ++ .../src/es_schemas/raw/metric_raw.ts | 124 +++++++++++ .../src/es_schemas/raw/span_raw.ts | 80 +++++++ .../src/es_schemas/raw/transaction_raw.ts | 79 +++++++ .../src/es_schemas/ui/apm_error.ts | 14 ++ .../kbn-apm-types/src/es_schemas/ui/event.ts | 14 ++ .../src/es_schemas/ui/fields/agent.ts | 17 ++ .../src/es_schemas/ui/fields/index.ts | 8 + .../kbn-apm-types/src/es_schemas/ui/index.ts | 13 ++ .../kbn-apm-types/src/es_schemas/ui/metric.ts | 11 + .../kbn-apm-types/src/es_schemas/ui/span.ts | 14 ++ .../src/es_schemas/ui/transaction.ts | 23 ++ packages/kbn-apm-types/tsconfig.json | 18 ++ tsconfig.base.json | 2 + .../apm/common/es_fields/apm.ts | 189 +---------------- .../observability_solution/apm/tsconfig.json | 3 +- .../typings/es_schemas/raw/apm_base_doc.ts | 17 +- .../apm/typings/es_schemas/raw/error_raw.ts | 66 +----- .../apm/typings/es_schemas/raw/event_raw.ts | 19 +- .../typings/es_schemas/raw/fields/cloud.ts | 27 +-- .../es_schemas/raw/fields/container.ts | 5 +- .../es_schemas/raw/fields/event_outcome.ts | 2 +- .../apm/typings/es_schemas/raw/fields/faas.ts | 10 +- .../apm/typings/es_schemas/raw/fields/host.ts | 10 +- .../apm/typings/es_schemas/raw/fields/http.ts | 6 +- .../es_schemas/raw/fields/kubernetes.ts | 15 +- .../typings/es_schemas/raw/fields/observer.ts | 10 +- .../apm/typings/es_schemas/raw/fields/page.ts | 4 +- .../typings/es_schemas/raw/fields/process.ts | 7 +- .../typings/es_schemas/raw/fields/service.ts | 21 +- .../es_schemas/raw/fields/span_links.ts | 5 +- .../es_schemas/raw/fields/stackframe.ts | 37 +--- .../es_schemas/raw/fields/timestamp_us.ts | 4 +- .../apm/typings/es_schemas/raw/fields/url.ts | 6 +- .../apm/typings/es_schemas/raw/fields/user.ts | 4 +- .../es_schemas/raw/fields/user_agent.ts | 14 +- .../apm/typings/es_schemas/raw/metric_raw.ts | 117 +---------- .../apm/typings/es_schemas/raw/span_raw.ts | 73 +------ .../typings/es_schemas/raw/transaction_raw.ts | 72 +------ .../apm/typings/es_schemas/ui/apm_error.ts | 7 +- .../apm/typings/es_schemas/ui/event.ts | 7 +- .../apm/typings/es_schemas/ui/fields/agent.ts | 15 +- .../apm/typings/es_schemas/ui/metric.ts | 4 +- .../apm/typings/es_schemas/ui/span.ts | 7 +- .../apm/typings/es_schemas/ui/transaction.ts | 16 +- yarn.lock | 4 + 76 files changed, 1178 insertions(+), 762 deletions(-) create mode 100644 packages/kbn-apm-types/es_fields.ts create mode 100644 packages/kbn-apm-types/es_schemas_raw.ts create mode 100644 packages/kbn-apm-types/es_schemas_ui.ts create mode 100644 packages/kbn-apm-types/index.ts create mode 100644 packages/kbn-apm-types/kibana.jsonc create mode 100644 packages/kbn-apm-types/package.json create mode 100644 packages/kbn-apm-types/src/es_fields/apm.ts create mode 100644 packages/kbn-apm-types/src/es_schemas/raw/apm_base_doc.ts create mode 100644 packages/kbn-apm-types/src/es_schemas/raw/error_raw.ts create mode 100644 packages/kbn-apm-types/src/es_schemas/raw/event_raw.ts create mode 100644 packages/kbn-apm-types/src/es_schemas/raw/fields/cloud.ts create mode 100644 packages/kbn-apm-types/src/es_schemas/raw/fields/container.ts create mode 100644 packages/kbn-apm-types/src/es_schemas/raw/fields/event_outcome.ts create mode 100644 packages/kbn-apm-types/src/es_schemas/raw/fields/faas.ts create mode 100644 packages/kbn-apm-types/src/es_schemas/raw/fields/host.ts create mode 100644 packages/kbn-apm-types/src/es_schemas/raw/fields/http.ts create mode 100644 packages/kbn-apm-types/src/es_schemas/raw/fields/index.ts create mode 100644 packages/kbn-apm-types/src/es_schemas/raw/fields/kubernetes.ts create mode 100644 packages/kbn-apm-types/src/es_schemas/raw/fields/observer.ts create mode 100644 packages/kbn-apm-types/src/es_schemas/raw/fields/page.ts create mode 100644 packages/kbn-apm-types/src/es_schemas/raw/fields/process.ts create mode 100644 packages/kbn-apm-types/src/es_schemas/raw/fields/service.ts create mode 100644 packages/kbn-apm-types/src/es_schemas/raw/fields/span_links.ts create mode 100644 packages/kbn-apm-types/src/es_schemas/raw/fields/stackframe.ts create mode 100644 packages/kbn-apm-types/src/es_schemas/raw/fields/timestamp_us.ts create mode 100644 packages/kbn-apm-types/src/es_schemas/raw/fields/url.ts create mode 100644 packages/kbn-apm-types/src/es_schemas/raw/fields/user.ts create mode 100644 packages/kbn-apm-types/src/es_schemas/raw/fields/user_agent.ts create mode 100644 packages/kbn-apm-types/src/es_schemas/raw/index.ts create mode 100644 packages/kbn-apm-types/src/es_schemas/raw/metric_raw.ts create mode 100644 packages/kbn-apm-types/src/es_schemas/raw/span_raw.ts create mode 100644 packages/kbn-apm-types/src/es_schemas/raw/transaction_raw.ts create mode 100644 packages/kbn-apm-types/src/es_schemas/ui/apm_error.ts create mode 100644 packages/kbn-apm-types/src/es_schemas/ui/event.ts create mode 100644 packages/kbn-apm-types/src/es_schemas/ui/fields/agent.ts create mode 100644 packages/kbn-apm-types/src/es_schemas/ui/fields/index.ts create mode 100644 packages/kbn-apm-types/src/es_schemas/ui/index.ts create mode 100644 packages/kbn-apm-types/src/es_schemas/ui/metric.ts create mode 100644 packages/kbn-apm-types/src/es_schemas/ui/span.ts create mode 100644 packages/kbn-apm-types/src/es_schemas/ui/transaction.ts create mode 100644 packages/kbn-apm-types/tsconfig.json diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index a92983d9532b5d..246497e110b945 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -46,6 +46,7 @@ x-pack/plugins/observability_solution/apm/ftr_e2e @elastic/obs-ux-infra_services x-pack/plugins/observability_solution/apm @elastic/obs-ux-infra_services-team packages/kbn-apm-synthtrace @elastic/obs-ux-infra_services-team @elastic/obs-ux-logs-team packages/kbn-apm-synthtrace-client @elastic/obs-ux-infra_services-team @elastic/obs-ux-logs-team +packages/kbn-apm-types @elastic/obs-ux-infra_services-team packages/kbn-apm-utils @elastic/obs-ux-infra_services-team test/plugin_functional/plugins/app_link_test @elastic/kibana-core x-pack/test/usage_collection/plugins/application_usage_test @elastic/kibana-core diff --git a/package.json b/package.json index 12e7a18f50c8f6..e76a42d2d68e3d 100644 --- a/package.json +++ b/package.json @@ -181,6 +181,7 @@ "@kbn/apm-data-access-plugin": "link:x-pack/plugins/observability_solution/apm_data_access", "@kbn/apm-data-view": "link:packages/kbn-apm-data-view", "@kbn/apm-plugin": "link:x-pack/plugins/observability_solution/apm", + "@kbn/apm-types": "link:packages/kbn-apm-types", "@kbn/apm-utils": "link:packages/kbn-apm-utils", "@kbn/app-link-test-plugin": "link:test/plugin_functional/plugins/app_link_test", "@kbn/application-usage-test-plugin": "link:x-pack/test/usage_collection/plugins/application_usage_test", diff --git a/packages/kbn-apm-types/es_fields.ts b/packages/kbn-apm-types/es_fields.ts new file mode 100644 index 00000000000000..00e78c5196f7d7 --- /dev/null +++ b/packages/kbn-apm-types/es_fields.ts @@ -0,0 +1,9 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +export * from './src/es_fields/apm'; diff --git a/packages/kbn-apm-types/es_schemas_raw.ts b/packages/kbn-apm-types/es_schemas_raw.ts new file mode 100644 index 00000000000000..ef0d4cbeb58975 --- /dev/null +++ b/packages/kbn-apm-types/es_schemas_raw.ts @@ -0,0 +1,9 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ +export * from './src/es_schemas/raw'; +export * from './src/es_schemas/raw/fields'; diff --git a/packages/kbn-apm-types/es_schemas_ui.ts b/packages/kbn-apm-types/es_schemas_ui.ts new file mode 100644 index 00000000000000..e974312a737ef2 --- /dev/null +++ b/packages/kbn-apm-types/es_schemas_ui.ts @@ -0,0 +1,10 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +export * from './src/es_schemas/ui'; +export * from './src/es_schemas/ui/fields'; diff --git a/packages/kbn-apm-types/index.ts b/packages/kbn-apm-types/index.ts new file mode 100644 index 00000000000000..8f15cbd897e28e --- /dev/null +++ b/packages/kbn-apm-types/index.ts @@ -0,0 +1,11 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +export * from './es_fields'; +export * from './es_schemas_raw'; +export * from './es_schemas_ui'; diff --git a/packages/kbn-apm-types/kibana.jsonc b/packages/kbn-apm-types/kibana.jsonc new file mode 100644 index 00000000000000..26b4ec0b1cf753 --- /dev/null +++ b/packages/kbn-apm-types/kibana.jsonc @@ -0,0 +1,5 @@ +{ + "type": "shared-common", + "id": "@kbn/apm-types", + "owner": "@elastic/obs-ux-infra_services-team" +} diff --git a/packages/kbn-apm-types/package.json b/packages/kbn-apm-types/package.json new file mode 100644 index 00000000000000..3b15b82701d817 --- /dev/null +++ b/packages/kbn-apm-types/package.json @@ -0,0 +1,6 @@ +{ + "name": "@kbn/apm-types", + "private": true, + "version": "1.0.0", + "license": "SSPL-1.0 OR Elastic License 2.0" +} \ No newline at end of file diff --git a/packages/kbn-apm-types/src/es_fields/apm.ts b/packages/kbn-apm-types/src/es_fields/apm.ts new file mode 100644 index 00000000000000..d17a1ed78db90d --- /dev/null +++ b/packages/kbn-apm-types/src/es_fields/apm.ts @@ -0,0 +1,197 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +export const TIMESTAMP = 'timestamp.us'; +export const AGENT = 'agent'; +export const AGENT_NAME = 'agent.name'; +export const AGENT_VERSION = 'agent.version'; +export const AGENT_ACTIVATION_METHOD = 'agent.activation_method'; + +export const DESTINATION_ADDRESS = 'destination.address'; + +export const CLOUD = 'cloud'; +export const CLOUD_AVAILABILITY_ZONE = 'cloud.availability_zone'; +export const CLOUD_PROVIDER = 'cloud.provider'; +export const CLOUD_REGION = 'cloud.region'; +export const CLOUD_MACHINE_TYPE = 'cloud.machine.type'; +export const CLOUD_ACCOUNT_ID = 'cloud.account.id'; +export const CLOUD_INSTANCE_ID = 'cloud.instance.id'; +export const CLOUD_INSTANCE_NAME = 'cloud.instance.name'; +export const CLOUD_SERVICE_NAME = 'cloud.service.name'; + +export const EVENT_SUCCESS_COUNT = 'event.success_count'; + +export const SERVICE = 'service'; +export const SERVICE_NAME = 'service.name'; +export const SERVICE_ENVIRONMENT = 'service.environment'; +export const SERVICE_FRAMEWORK_NAME = 'service.framework.name'; +export const SERVICE_FRAMEWORK_VERSION = 'service.framework.version'; +export const SERVICE_LANGUAGE_NAME = 'service.language.name'; +export const SERVICE_LANGUAGE_VERSION = 'service.language.version'; +export const SERVICE_RUNTIME_NAME = 'service.runtime.name'; +export const SERVICE_RUNTIME_VERSION = 'service.runtime.version'; +export const SERVICE_NODE_NAME = 'service.node.name'; +export const SERVICE_VERSION = 'service.version'; +export const SERVICE_TARGET_TYPE = 'service.target.type'; +export const SERVICE_OVERFLOW_COUNT = 'service_transaction.aggregation.overflow_count'; + +export const URL_FULL = 'url.full'; +export const HTTP_REQUEST_METHOD = 'http.request.method'; +export const HTTP_RESPONSE_STATUS_CODE = 'http.response.status_code'; +export const USER_ID = 'user.id'; +export const USER_AGENT_ORIGINAL = 'user_agent.original'; +export const USER_AGENT_NAME = 'user_agent.name'; + +export const OBSERVER_HOSTNAME = 'observer.hostname'; +export const OBSERVER_LISTENING = 'observer.listening'; +export const PROCESSOR_EVENT = 'processor.event'; + +export const TRANSACTION_DURATION = 'transaction.duration.us'; +export const TRANSACTION_DURATION_HISTOGRAM = 'transaction.duration.histogram'; +export const TRANSACTION_DURATION_SUMMARY = 'transaction.duration.summary'; +export const TRANSACTION_TYPE = 'transaction.type'; +export const TRANSACTION_RESULT = 'transaction.result'; +export const TRANSACTION_NAME = 'transaction.name'; +export const TRANSACTION_ID = 'transaction.id'; +export const TRANSACTION_SAMPLED = 'transaction.sampled'; +export const TRANSACTION_PAGE_URL = 'transaction.page.url'; +export const TRANSACTION_FAILURE_COUNT = 'transaction.failure_count'; +export const TRANSACTION_SUCCESS_COUNT = 'transaction.success_count'; +export const TRANSACTION_OVERFLOW_COUNT = 'transaction.aggregation.overflow_count'; +// for transaction metrics +export const TRANSACTION_ROOT = 'transaction.root'; +export const TRANSACTION_PROFILER_STACK_TRACE_IDS = 'transaction.profiler_stack_trace_ids'; + +export const EVENT_OUTCOME = 'event.outcome'; + +export const TRACE_ID = 'trace.id'; + +export const SPAN_DURATION = 'span.duration.us'; +export const SPAN_TYPE = 'span.type'; +export const SPAN_SUBTYPE = 'span.subtype'; +export const SPAN_SELF_TIME_SUM = 'span.self_time.sum.us'; +export const SPAN_ACTION = 'span.action'; +export const SPAN_NAME = 'span.name'; +export const SPAN_ID = 'span.id'; +export const SPAN_DESTINATION_SERVICE_RESOURCE = 'span.destination.service.resource'; +export const SPAN_DESTINATION_SERVICE_RESPONSE_TIME_COUNT = + 'span.destination.service.response_time.count'; + +export const SPAN_DESTINATION_SERVICE_RESPONSE_TIME_SUM = + 'span.destination.service.response_time.sum.us'; + +export const SPAN_LINKS = 'span.links'; +export const SPAN_LINKS_TRACE_ID = 'span.links.trace.id'; +export const SPAN_LINKS_SPAN_ID = 'span.links.span.id'; + +export const SPAN_COMPOSITE_COUNT = 'span.composite.count'; +export const SPAN_COMPOSITE_SUM = 'span.composite.sum.us'; +export const SPAN_COMPOSITE_COMPRESSION_STRATEGY = 'span.composite.compression_strategy'; + +export const SPAN_SYNC = 'span.sync'; + +// Parent ID for a transaction or span +export const PARENT_ID = 'parent.id'; + +export const ERROR_ID = 'error.id'; +export const ERROR_GROUP_ID = 'error.grouping_key'; +export const ERROR_GROUP_NAME = 'error.grouping_name'; +export const ERROR_CULPRIT = 'error.culprit'; +export const ERROR_LOG_LEVEL = 'error.log.level'; +export const ERROR_LOG_MESSAGE = 'error.log.message'; +export const ERROR_EXCEPTION = 'error.exception'; +export const ERROR_EXC_MESSAGE = 'error.exception.message'; // only to be used in es queries, since error.exception is now an array +export const ERROR_EXC_HANDLED = 'error.exception.handled'; // only to be used in es queries, since error.exception is now an array +export const ERROR_EXC_TYPE = 'error.exception.type'; +export const ERROR_PAGE_URL = 'error.page.url'; +export const ERROR_TYPE = 'error.type'; + +// METRICS +export const METRIC_SYSTEM_FREE_MEMORY = 'system.memory.actual.free'; +export const METRIC_SYSTEM_TOTAL_MEMORY = 'system.memory.total'; +export const METRIC_SYSTEM_CPU_PERCENT = 'system.cpu.total.norm.pct'; +export const METRIC_PROCESS_CPU_PERCENT = 'system.process.cpu.total.norm.pct'; +export const METRIC_CGROUP_MEMORY_LIMIT_BYTES = 'system.process.cgroup.memory.mem.limit.bytes'; +export const METRIC_CGROUP_MEMORY_USAGE_BYTES = 'system.process.cgroup.memory.mem.usage.bytes'; + +export const METRIC_JAVA_HEAP_MEMORY_MAX = 'jvm.memory.heap.max'; +export const METRIC_JAVA_HEAP_MEMORY_COMMITTED = 'jvm.memory.heap.committed'; +export const METRIC_JAVA_HEAP_MEMORY_USED = 'jvm.memory.heap.used'; +export const METRIC_JAVA_NON_HEAP_MEMORY_MAX = 'jvm.memory.non_heap.max'; +export const METRIC_JAVA_NON_HEAP_MEMORY_COMMITTED = 'jvm.memory.non_heap.committed'; +export const METRIC_JAVA_NON_HEAP_MEMORY_USED = 'jvm.memory.non_heap.used'; +export const METRIC_JAVA_THREAD_COUNT = 'jvm.thread.count'; +export const METRIC_JAVA_GC_COUNT = 'jvm.gc.count'; +export const METRIC_JAVA_GC_TIME = 'jvm.gc.time'; + +export const METRICSET_NAME = 'metricset.name'; +export const METRICSET_INTERVAL = 'metricset.interval'; + +export const LABEL_NAME = 'labels.name'; +export const LABEL_GC = 'labels.gc'; +export const LABEL_TYPE = 'labels.type'; +export const LABEL_TELEMETRY_AUTO_VERSION = 'labels.telemetry_auto_version'; +export const LABEL_LIFECYCLE_STATE = 'labels.lifecycle_state'; + +export const HOST = 'host'; +export const HOST_HOSTNAME = 'host.hostname'; // Do not use. Please use `HOST_NAME` instead. +export const HOST_NAME = 'host.name'; +export const HOST_OS_PLATFORM = 'host.os.platform'; +export const HOST_ARCHITECTURE = 'host.architecture'; +export const HOST_OS_VERSION = 'host.os.version'; + +export const CONTAINER_ID = 'container.id'; +export const CONTAINER = 'container'; +export const CONTAINER_IMAGE = 'container.image.name'; + +export const KUBERNETES = 'kubernetes'; +export const KUBERNETES_POD_NAME = 'kubernetes.pod.name'; +export const KUBERNETES_POD_UID = 'kubernetes.pod.uid'; + +export const FAAS_ID = 'faas.id'; +export const FAAS_NAME = 'faas.name'; +export const FAAS_COLDSTART = 'faas.coldstart'; +export const FAAS_TRIGGER_TYPE = 'faas.trigger.type'; +export const FAAS_DURATION = 'faas.duration'; +export const FAAS_COLDSTART_DURATION = 'faas.coldstart_duration'; +export const FAAS_BILLED_DURATION = 'faas.billed_duration'; + +// OpenTelemetry Metrics +export const METRIC_OTEL_SYSTEM_CPU_UTILIZATION = 'system.cpu.utilization'; +export const METRIC_OTEL_SYSTEM_MEMORY_UTILIZATION = 'system.memory.utilization'; + +export const METRIC_OTEL_JVM_PROCESS_CPU_PERCENT = 'process.runtime.jvm.cpu.utilization'; +export const METRIC_OTEL_JVM_PROCESS_MEMORY_USAGE = 'process.runtime.jvm.memory.usage'; +export const METRIC_OTEL_JVM_PROCESS_MEMORY_COMMITTED = 'process.runtime.jvm.memory.committed'; +export const METRIC_OTEL_JVM_PROCESS_MEMORY_LIMIT = 'process.runtime.jvm.memory.limit'; +export const METRIC_OTEL_JVM_PROCESS_THREADS_COUNT = 'process.runtime.jvm.threads.count'; +export const METRIC_OTEL_JVM_SYSTEM_CPU_PERCENT = 'process.runtime.jvm.system.cpu.utilization'; +export const METRIC_OTEL_JVM_GC_DURATION = 'process.runtime.jvm.gc.duration'; +export const VALUE_OTEL_JVM_PROCESS_MEMORY_HEAP = 'heap'; +export const VALUE_OTEL_JVM_PROCESS_MEMORY_NON_HEAP = 'non_heap'; + +// Metadata +export const TIER = '_tier'; +export const INDEX = '_index'; +export const DATA_STEAM_TYPE = 'data_stream.type'; + +// Mobile +export const NETWORK_CONNECTION_TYPE = 'network.connection.type'; +export const DEVICE_MODEL_IDENTIFIER = 'device.model.identifier'; +export const SESSION_ID = 'session.id'; +export const APP_LAUNCH_TIME = 'application.launch.time'; +export const EVENT_NAME = 'event.name'; + +// Location +export const CLIENT_GEO_COUNTRY_ISO_CODE = 'client.geo.country_iso_code'; +export const CLIENT_GEO_REGION_ISO_CODE = 'client.geo.region_iso_code'; +export const CLIENT_GEO_COUNTRY_NAME = 'client.geo.country_name'; +export const CLIENT_GEO_CITY_NAME = 'client.geo.city_name'; +export const CLIENT_GEO_REGION_NAME = 'client.geo.region_name'; + +export const CHILD_ID = 'child.id'; diff --git a/packages/kbn-apm-types/src/es_schemas/raw/apm_base_doc.ts b/packages/kbn-apm-types/src/es_schemas/raw/apm_base_doc.ts new file mode 100644 index 00000000000000..a750c39c775d2b --- /dev/null +++ b/packages/kbn-apm-types/src/es_schemas/raw/apm_base_doc.ts @@ -0,0 +1,24 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import { Observer } from './fields/observer'; + +// all documents types extend APMBaseDoc and inherit all properties +export interface APMBaseDoc { + '@timestamp': string; + agent: { + name: string; + version: string; + }; + parent?: { id: string }; // parent ID is not available on root transactions + trace?: { id: string }; + labels?: { + [key: string]: string | number | boolean; + }; + observer?: Observer; +} diff --git a/packages/kbn-apm-types/src/es_schemas/raw/error_raw.ts b/packages/kbn-apm-types/src/es_schemas/raw/error_raw.ts new file mode 100644 index 00000000000000..f0157a6a083769 --- /dev/null +++ b/packages/kbn-apm-types/src/es_schemas/raw/error_raw.ts @@ -0,0 +1,75 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import { APMBaseDoc } from './apm_base_doc'; +import { + Container, + Host, + Http, + Kubernetes, + Page, + Process, + Service, + Stackframe, + TimestampUs, + Url, + User, +} from './fields'; + +export interface Processor { + name: 'error'; + event: 'error'; +} + +export interface Exception { + attributes?: { + response?: string; + }; + code?: string; + message?: string; // either message or type are given + type?: string; + module?: string; + handled?: boolean; + stacktrace?: Stackframe[]; +} + +export interface Log { + message: string; + stacktrace?: Stackframe[]; +} + +export interface ErrorRaw extends APMBaseDoc { + processor: Processor; + timestamp: TimestampUs; + transaction?: { + id: string; + sampled?: boolean; + type: string; + }; + error: { + id: string; + culprit?: string; + grouping_key: string; + // either exception or log are given + exception?: Exception[]; + page?: Page; // special property for RUM: shared by error and transaction + log?: Log; + stack_trace?: string; + custom?: Record; + }; + + // Shared by errors and transactions + container?: Container; + host?: Host; + http?: Http; + kubernetes?: Kubernetes; + process?: Process; + service: Service; + url?: Url; + user?: User; +} diff --git a/packages/kbn-apm-types/src/es_schemas/raw/event_raw.ts b/packages/kbn-apm-types/src/es_schemas/raw/event_raw.ts new file mode 100644 index 00000000000000..f8d31249142393 --- /dev/null +++ b/packages/kbn-apm-types/src/es_schemas/raw/event_raw.ts @@ -0,0 +1,26 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import { APMBaseDoc } from './apm_base_doc'; +import { TimestampUs } from './fields/timestamp_us'; + +export interface EventRaw extends APMBaseDoc { + timestamp: TimestampUs; + transaction?: { + id: string; + sampled?: boolean; + type: string; + }; + log: { + message?: string; + }; + event: { + action: string; + category: string; + }; +} diff --git a/packages/kbn-apm-types/src/es_schemas/raw/fields/cloud.ts b/packages/kbn-apm-types/src/es_schemas/raw/fields/cloud.ts new file mode 100644 index 00000000000000..eaad379f5069b9 --- /dev/null +++ b/packages/kbn-apm-types/src/es_schemas/raw/fields/cloud.ts @@ -0,0 +1,34 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +export interface Cloud { + availability_zone?: string; + instance?: { + name: string; + id: string; + }; + machine?: { + type: string; + }; + project?: { + id: string; + name: string; + }; + provider?: string; + region?: string; + account?: { + id: string; + name: string; + }; + image?: { + id: string; + }; + service?: { + name: string; + }; +} diff --git a/packages/kbn-apm-types/src/es_schemas/raw/fields/container.ts b/packages/kbn-apm-types/src/es_schemas/raw/fields/container.ts new file mode 100644 index 00000000000000..ae6526ad9ff929 --- /dev/null +++ b/packages/kbn-apm-types/src/es_schemas/raw/fields/container.ts @@ -0,0 +1,12 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +export interface Container { + id?: string | null; + image?: string | null; +} diff --git a/packages/kbn-apm-types/src/es_schemas/raw/fields/event_outcome.ts b/packages/kbn-apm-types/src/es_schemas/raw/fields/event_outcome.ts new file mode 100644 index 00000000000000..53c19ab293d9bc --- /dev/null +++ b/packages/kbn-apm-types/src/es_schemas/raw/fields/event_outcome.ts @@ -0,0 +1,9 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +export type EventOutcome = 'success' | 'failure' | 'unknown'; diff --git a/packages/kbn-apm-types/src/es_schemas/raw/fields/faas.ts b/packages/kbn-apm-types/src/es_schemas/raw/fields/faas.ts new file mode 100644 index 00000000000000..9054839b829026 --- /dev/null +++ b/packages/kbn-apm-types/src/es_schemas/raw/fields/faas.ts @@ -0,0 +1,17 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +export interface Faas { + id: string; + coldstart?: boolean; + execution?: string; + trigger?: { + type?: string; + request_id?: string; + }; +} diff --git a/packages/kbn-apm-types/src/es_schemas/raw/fields/host.ts b/packages/kbn-apm-types/src/es_schemas/raw/fields/host.ts new file mode 100644 index 00000000000000..7a12a8eba824f8 --- /dev/null +++ b/packages/kbn-apm-types/src/es_schemas/raw/fields/host.ts @@ -0,0 +1,17 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +export interface Host { + architecture?: string; + hostname?: string; + name?: string; + ip?: string; + os?: { + platform?: string; + }; +} diff --git a/packages/kbn-apm-types/src/es_schemas/raw/fields/http.ts b/packages/kbn-apm-types/src/es_schemas/raw/fields/http.ts new file mode 100644 index 00000000000000..3e16e5dceb80c2 --- /dev/null +++ b/packages/kbn-apm-types/src/es_schemas/raw/fields/http.ts @@ -0,0 +1,13 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +export interface Http { + request?: { method: string; [key: string]: unknown }; + response?: { status_code: number; [key: string]: unknown }; + version?: string; +} diff --git a/packages/kbn-apm-types/src/es_schemas/raw/fields/index.ts b/packages/kbn-apm-types/src/es_schemas/raw/fields/index.ts new file mode 100644 index 00000000000000..aa8355934fbb4c --- /dev/null +++ b/packages/kbn-apm-types/src/es_schemas/raw/fields/index.ts @@ -0,0 +1,25 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +export * from './cloud'; +export * from './container'; +export * from './event_outcome'; +export * from './faas'; +export * from './host'; +export * from './http'; +export * from './kubernetes'; +export * from './observer'; +export * from './page'; +export * from './process'; +export * from './service'; +export * from './span_links'; +export * from './stackframe'; +export * from './timestamp_us'; +export * from './url'; +export * from './user_agent'; +export * from './user'; diff --git a/packages/kbn-apm-types/src/es_schemas/raw/fields/kubernetes.ts b/packages/kbn-apm-types/src/es_schemas/raw/fields/kubernetes.ts new file mode 100644 index 00000000000000..09667f08d441cc --- /dev/null +++ b/packages/kbn-apm-types/src/es_schemas/raw/fields/kubernetes.ts @@ -0,0 +1,22 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +export interface Kubernetes { + pod?: { uid?: string | null; [key: string]: unknown }; + namespace?: string; + replicaset?: { + name?: string; + }; + deployment?: { + name?: string; + }; + container?: { + id?: string; + name?: string; + }; +} diff --git a/packages/kbn-apm-types/src/es_schemas/raw/fields/observer.ts b/packages/kbn-apm-types/src/es_schemas/raw/fields/observer.ts new file mode 100644 index 00000000000000..b035c0210bb35a --- /dev/null +++ b/packages/kbn-apm-types/src/es_schemas/raw/fields/observer.ts @@ -0,0 +1,17 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +export interface Observer { + ephemeral_id?: string; + hostname?: string; + id?: string; + name?: string; + type?: string; + version: string; + version_major: number; +} diff --git a/packages/kbn-apm-types/src/es_schemas/raw/fields/page.ts b/packages/kbn-apm-types/src/es_schemas/raw/fields/page.ts new file mode 100644 index 00000000000000..1c2548cb777cd3 --- /dev/null +++ b/packages/kbn-apm-types/src/es_schemas/raw/fields/page.ts @@ -0,0 +1,12 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +// only for RUM agent: shared by error and transaction +export interface Page { + url: string; +} diff --git a/packages/kbn-apm-types/src/es_schemas/raw/fields/process.ts b/packages/kbn-apm-types/src/es_schemas/raw/fields/process.ts new file mode 100644 index 00000000000000..25db0098f8d3da --- /dev/null +++ b/packages/kbn-apm-types/src/es_schemas/raw/fields/process.ts @@ -0,0 +1,14 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +export interface Process { + args?: string[]; + pid: number; + ppid?: number; + title?: string; +} diff --git a/packages/kbn-apm-types/src/es_schemas/raw/fields/service.ts b/packages/kbn-apm-types/src/es_schemas/raw/fields/service.ts new file mode 100644 index 00000000000000..ff01bfc8517e8a --- /dev/null +++ b/packages/kbn-apm-types/src/es_schemas/raw/fields/service.ts @@ -0,0 +1,28 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +export interface Service { + name: string; + environment?: string; + framework?: { + name: string; + version?: string; + }; + node?: { + name?: string; + }; + runtime?: { + name: string; + version: string; + }; + language?: { + name: string; + version?: string; + }; + version?: string; +} diff --git a/packages/kbn-apm-types/src/es_schemas/raw/fields/span_links.ts b/packages/kbn-apm-types/src/es_schemas/raw/fields/span_links.ts new file mode 100644 index 00000000000000..13ffc4d7075f14 --- /dev/null +++ b/packages/kbn-apm-types/src/es_schemas/raw/fields/span_links.ts @@ -0,0 +1,12 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +export interface SpanLink { + trace: { id: string }; + span: { id: string }; +} diff --git a/packages/kbn-apm-types/src/es_schemas/raw/fields/stackframe.ts b/packages/kbn-apm-types/src/es_schemas/raw/fields/stackframe.ts new file mode 100644 index 00000000000000..b2b1cf80001030 --- /dev/null +++ b/packages/kbn-apm-types/src/es_schemas/raw/fields/stackframe.ts @@ -0,0 +1,44 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +interface Line { + column?: number; + number: number; +} + +interface Sourcemap { + error?: string; + updated?: boolean; +} + +interface StackframeBase { + abs_path?: string; + classname?: string; + context?: { + post?: string[]; + pre?: string[]; + }; + exclude_from_grouping?: boolean; + filename?: string; + function?: string; + module?: string; + library_frame?: boolean; + line?: Line; + sourcemap?: Sourcemap; + vars?: { + [key: string]: unknown; + }; +} + +export type StackframeWithLineContext = StackframeBase & { + line: Line & { + context: string; + }; +}; + +export type Stackframe = StackframeBase | StackframeWithLineContext; diff --git a/packages/kbn-apm-types/src/es_schemas/raw/fields/timestamp_us.ts b/packages/kbn-apm-types/src/es_schemas/raw/fields/timestamp_us.ts new file mode 100644 index 00000000000000..17c06c8e381565 --- /dev/null +++ b/packages/kbn-apm-types/src/es_schemas/raw/fields/timestamp_us.ts @@ -0,0 +1,11 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +export interface TimestampUs { + us: number; +} diff --git a/packages/kbn-apm-types/src/es_schemas/raw/fields/url.ts b/packages/kbn-apm-types/src/es_schemas/raw/fields/url.ts new file mode 100644 index 00000000000000..4fa149e6b65d67 --- /dev/null +++ b/packages/kbn-apm-types/src/es_schemas/raw/fields/url.ts @@ -0,0 +1,13 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +export interface Url { + domain?: string; + full: string; + original?: string; +} diff --git a/packages/kbn-apm-types/src/es_schemas/raw/fields/user.ts b/packages/kbn-apm-types/src/es_schemas/raw/fields/user.ts new file mode 100644 index 00000000000000..ced460ececd175 --- /dev/null +++ b/packages/kbn-apm-types/src/es_schemas/raw/fields/user.ts @@ -0,0 +1,11 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +export interface User { + id: string; +} diff --git a/packages/kbn-apm-types/src/es_schemas/raw/fields/user_agent.ts b/packages/kbn-apm-types/src/es_schemas/raw/fields/user_agent.ts new file mode 100644 index 00000000000000..0658d408dbe548 --- /dev/null +++ b/packages/kbn-apm-types/src/es_schemas/raw/fields/user_agent.ts @@ -0,0 +1,21 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +export interface UserAgent { + device?: { + name: string; + }; + name?: string; + original: string; + os?: { + name: string; + version?: string; + full?: string; + }; + version?: string; +} diff --git a/packages/kbn-apm-types/src/es_schemas/raw/index.ts b/packages/kbn-apm-types/src/es_schemas/raw/index.ts new file mode 100644 index 00000000000000..addd3279f2586a --- /dev/null +++ b/packages/kbn-apm-types/src/es_schemas/raw/index.ts @@ -0,0 +1,14 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +export * from './apm_base_doc'; +export * from './error_raw'; +export * from './event_raw'; +export * from './metric_raw'; +export * from './span_raw'; +export * from './transaction_raw'; diff --git a/packages/kbn-apm-types/src/es_schemas/raw/metric_raw.ts b/packages/kbn-apm-types/src/es_schemas/raw/metric_raw.ts new file mode 100644 index 00000000000000..29a8dc921f3d93 --- /dev/null +++ b/packages/kbn-apm-types/src/es_schemas/raw/metric_raw.ts @@ -0,0 +1,124 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import { APMBaseDoc } from './apm_base_doc'; +import { Cloud } from './fields/cloud'; +import { Container } from './fields/container'; +import { Host } from './fields/host'; +import { Kubernetes } from './fields/kubernetes'; +import { Service } from './fields/service'; + +type BaseMetric = APMBaseDoc & { + processor: { + name: 'metric'; + event: 'metric'; + }; + cloud?: Cloud; + container?: Container; + kubernetes?: Kubernetes; + service?: Service; + host?: Host; +}; + +type BaseBreakdownMetric = BaseMetric & { + transaction: { + name: string; + type: string; + }; + span: { + self_time: { + count: number; + sum: { + us: number; + }; + }; + }; +}; + +type TransactionBreakdownMetric = BaseBreakdownMetric & { + transaction: { + duration: { + count: number; + sum: { + us: number; + }; + }; + breakdown: { + count: number; + }; + }; +}; + +type SpanBreakdownMetric = BaseBreakdownMetric & { + span: { + type: string; + subtype?: string; + }; +}; + +type SystemMetric = BaseMetric & { + system: unknown; + service: { + node?: { + name: string; + }; + }; +}; + +type CGroupMetric = SystemMetric; +type JVMMetric = SystemMetric & { + jvm: unknown; +}; + +type TransactionDurationMetric = BaseMetric & { + transaction: { + name: string; + type: string; + result?: string; + duration: { + histogram: { + values: number[]; + counts: number[]; + }; + }; + }; + service: { + name: string; + node?: { + name: string; + }; + environment?: string; + version?: string; + }; +}; + +export type SpanDestinationMetric = BaseMetric & { + span: { + destination: { + service: { + resource: string; + response_time: { + count: number; + sum: { + us: number; + }; + }; + }; + }; + }; +}; + +export type MetricRaw = + | BaseMetric + | TransactionBreakdownMetric + | SpanBreakdownMetric + | TransactionDurationMetric + | SpanDestinationMetric + | SystemMetric + | CGroupMetric + | JVMMetric; diff --git a/packages/kbn-apm-types/src/es_schemas/raw/span_raw.ts b/packages/kbn-apm-types/src/es_schemas/raw/span_raw.ts new file mode 100644 index 00000000000000..0d45d3bb00cc48 --- /dev/null +++ b/packages/kbn-apm-types/src/es_schemas/raw/span_raw.ts @@ -0,0 +1,80 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import { APMBaseDoc } from './apm_base_doc'; +import { EventOutcome } from './fields/event_outcome'; +import { Http } from './fields/http'; +import { SpanLink } from './fields/span_links'; +import { Stackframe } from './fields/stackframe'; +import { TimestampUs } from './fields/timestamp_us'; +import { Url } from './fields/url'; + +interface Processor { + name: 'transaction'; + event: 'span'; +} + +export interface SpanRaw extends APMBaseDoc { + processor: Processor; + trace: { id: string }; // trace is required + event?: { outcome?: EventOutcome }; + service: { + name: string; + environment?: string; + }; + span: { + destination?: { + service: { + resource: string; + }; + }; + action?: string; + duration: { us: number }; + id: string; + name: string; + stacktrace?: Stackframe[]; + subtype?: string; + sync?: boolean; + type: string; + http?: { + url?: { + original?: string; + }; + response: { + status_code: number; + }; + method?: string; + }; + db?: { + statement?: string; + type?: string; + }; + message?: { + queue?: { name: string }; + age?: { ms: number }; + body?: string; + headers?: Record; + }; + composite?: { + count: number; + sum: { us: number }; + compression_strategy: string; + }; + links?: SpanLink[]; + }; + timestamp: TimestampUs; + transaction?: { + id: string; + }; + child?: { id: string[] }; + code?: { + stacktrace?: string; + }; + http?: Http; + url?: Url; +} diff --git a/packages/kbn-apm-types/src/es_schemas/raw/transaction_raw.ts b/packages/kbn-apm-types/src/es_schemas/raw/transaction_raw.ts new file mode 100644 index 00000000000000..6505e2808f7958 --- /dev/null +++ b/packages/kbn-apm-types/src/es_schemas/raw/transaction_raw.ts @@ -0,0 +1,79 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import { APMBaseDoc } from './apm_base_doc'; +import { Cloud } from './fields/cloud'; +import { Container } from './fields/container'; +import { EventOutcome } from './fields/event_outcome'; +import { Host } from './fields/host'; +import { Http } from './fields/http'; +import { Kubernetes } from './fields/kubernetes'; +import { Page } from './fields/page'; +import { Process } from './fields/process'; +import { Service } from './fields/service'; +import { TimestampUs } from './fields/timestamp_us'; +import { Url } from './fields/url'; +import { User } from './fields/user'; +import { UserAgent } from './fields/user_agent'; +import { Faas } from './fields/faas'; +import { SpanLink } from './fields/span_links'; + +interface Processor { + name: 'transaction'; + event: 'transaction'; +} + +export interface TransactionRaw extends APMBaseDoc { + processor: Processor; + timestamp: TimestampUs; + trace: { id: string }; // trace is required + event?: { outcome?: EventOutcome }; + transaction: { + duration: { us: number }; + id: string; + marks?: { + // "agent": not defined by APM Server - only sent by RUM agent + agent?: { + [name: string]: number; + }; + }; + name?: string; + page?: Page; // special property for RUM: shared by error and transaction + result?: string; + sampled: boolean; + span_count?: { + started?: number; + dropped?: number; + }; + type: string; + custom?: Record; + message?: { + queue?: { name: string }; + age?: { ms: number }; + body?: string; + headers?: Record; + }; + }; + + // Shared by errors and transactions + container?: Container; + ecs?: { version?: string }; + host?: Host; + http?: Http; + kubernetes?: Kubernetes; + process?: Process; + service: Service; + url?: Url; + user?: User; + user_agent?: UserAgent; + cloud?: Cloud; + faas?: Faas; + span?: { + links?: SpanLink[]; + }; +} diff --git a/packages/kbn-apm-types/src/es_schemas/ui/apm_error.ts b/packages/kbn-apm-types/src/es_schemas/ui/apm_error.ts new file mode 100644 index 00000000000000..fad4190a229eff --- /dev/null +++ b/packages/kbn-apm-types/src/es_schemas/ui/apm_error.ts @@ -0,0 +1,14 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import { ErrorRaw } from '../raw/error_raw'; +import { Agent } from './fields/agent'; + +export interface APMError extends ErrorRaw { + agent: Agent; +} diff --git a/packages/kbn-apm-types/src/es_schemas/ui/event.ts b/packages/kbn-apm-types/src/es_schemas/ui/event.ts new file mode 100644 index 00000000000000..8d0fd78f5f0f92 --- /dev/null +++ b/packages/kbn-apm-types/src/es_schemas/ui/event.ts @@ -0,0 +1,14 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import { EventRaw } from '../raw/event_raw'; +import { Agent } from './fields/agent'; + +export interface Event extends EventRaw { + agent: Agent; +} diff --git a/packages/kbn-apm-types/src/es_schemas/ui/fields/agent.ts b/packages/kbn-apm-types/src/es_schemas/ui/fields/agent.ts new file mode 100644 index 00000000000000..85cb7340fdda6d --- /dev/null +++ b/packages/kbn-apm-types/src/es_schemas/ui/fields/agent.ts @@ -0,0 +1,17 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import type { AgentName } from '@kbn/elastic-agent-utils'; + +export type { ElasticAgentName, OpenTelemetryAgentName, AgentName } from '@kbn/elastic-agent-utils'; + +export interface Agent { + ephemeral_id?: string; + name: AgentName; + version: string; +} diff --git a/packages/kbn-apm-types/src/es_schemas/ui/fields/index.ts b/packages/kbn-apm-types/src/es_schemas/ui/fields/index.ts new file mode 100644 index 00000000000000..1e64e14e07f8ab --- /dev/null +++ b/packages/kbn-apm-types/src/es_schemas/ui/fields/index.ts @@ -0,0 +1,8 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ +export * from './agent'; diff --git a/packages/kbn-apm-types/src/es_schemas/ui/index.ts b/packages/kbn-apm-types/src/es_schemas/ui/index.ts new file mode 100644 index 00000000000000..26f716289aaff1 --- /dev/null +++ b/packages/kbn-apm-types/src/es_schemas/ui/index.ts @@ -0,0 +1,13 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +export * from './apm_error'; +export * from './event'; +export * from './metric'; +export * from './span'; +export * from './transaction'; diff --git a/packages/kbn-apm-types/src/es_schemas/ui/metric.ts b/packages/kbn-apm-types/src/es_schemas/ui/metric.ts new file mode 100644 index 00000000000000..bd9391e269554a --- /dev/null +++ b/packages/kbn-apm-types/src/es_schemas/ui/metric.ts @@ -0,0 +1,11 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import { MetricRaw } from '../raw/metric_raw'; + +export type Metric = MetricRaw; diff --git a/packages/kbn-apm-types/src/es_schemas/ui/span.ts b/packages/kbn-apm-types/src/es_schemas/ui/span.ts new file mode 100644 index 00000000000000..5e09b84b87df28 --- /dev/null +++ b/packages/kbn-apm-types/src/es_schemas/ui/span.ts @@ -0,0 +1,14 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import { SpanRaw } from '../raw/span_raw'; +import { Agent } from './fields/agent'; + +export interface Span extends SpanRaw { + agent: Agent; +} diff --git a/packages/kbn-apm-types/src/es_schemas/ui/transaction.ts b/packages/kbn-apm-types/src/es_schemas/ui/transaction.ts new file mode 100644 index 00000000000000..ea5ccf5fd6434d --- /dev/null +++ b/packages/kbn-apm-types/src/es_schemas/ui/transaction.ts @@ -0,0 +1,23 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import { TransactionRaw } from '../raw/transaction_raw'; +import { Agent } from './fields/agent'; + +// Make `transaction.name` required instead of optional. +// `transaction.name` can be missing in Elasticsearch but the UI will only aggregate on transactions with a name, +// and thus it doesn't make sense to treat it as optional +type InnerTransaction = TransactionRaw['transaction']; +interface InnerTransactionWithName extends InnerTransaction { + name: string; +} + +export interface Transaction extends TransactionRaw { + agent: Agent; + transaction: InnerTransactionWithName; +} diff --git a/packages/kbn-apm-types/tsconfig.json b/packages/kbn-apm-types/tsconfig.json new file mode 100644 index 00000000000000..312ebd695e48e9 --- /dev/null +++ b/packages/kbn-apm-types/tsconfig.json @@ -0,0 +1,18 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "outDir": "target/types", + "types": [ + "node" + ] + }, + "include": [ + "**/*.ts" + ], + "exclude": [ + "target/**/*", + ], + "kbn_references": [ + "@kbn/elastic-agent-utils", + ] +} diff --git a/tsconfig.base.json b/tsconfig.base.json index 18fca49a074972..1d8a9b6c83833e 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -86,6 +86,8 @@ "@kbn/apm-synthtrace/*": ["packages/kbn-apm-synthtrace/*"], "@kbn/apm-synthtrace-client": ["packages/kbn-apm-synthtrace-client"], "@kbn/apm-synthtrace-client/*": ["packages/kbn-apm-synthtrace-client/*"], + "@kbn/apm-types": ["packages/kbn-apm-types"], + "@kbn/apm-types/*": ["packages/kbn-apm-types/*"], "@kbn/apm-utils": ["packages/kbn-apm-utils"], "@kbn/apm-utils/*": ["packages/kbn-apm-utils/*"], "@kbn/app-link-test-plugin": ["test/plugin_functional/plugins/app_link_test"], diff --git a/x-pack/plugins/observability_solution/apm/common/es_fields/apm.ts b/x-pack/plugins/observability_solution/apm/common/es_fields/apm.ts index 539484fed182e1..9ab614df857fea 100644 --- a/x-pack/plugins/observability_solution/apm/common/es_fields/apm.ts +++ b/x-pack/plugins/observability_solution/apm/common/es_fields/apm.ts @@ -4,192 +4,5 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -export const TIMESTAMP = 'timestamp.us'; -export const AGENT = 'agent'; -export const AGENT_NAME = 'agent.name'; -export const AGENT_VERSION = 'agent.version'; -export const AGENT_ACTIVATION_METHOD = 'agent.activation_method'; -export const DESTINATION_ADDRESS = 'destination.address'; - -export const CLOUD = 'cloud'; -export const CLOUD_AVAILABILITY_ZONE = 'cloud.availability_zone'; -export const CLOUD_PROVIDER = 'cloud.provider'; -export const CLOUD_REGION = 'cloud.region'; -export const CLOUD_MACHINE_TYPE = 'cloud.machine.type'; -export const CLOUD_ACCOUNT_ID = 'cloud.account.id'; -export const CLOUD_INSTANCE_ID = 'cloud.instance.id'; -export const CLOUD_INSTANCE_NAME = 'cloud.instance.name'; -export const CLOUD_SERVICE_NAME = 'cloud.service.name'; - -export const EVENT_SUCCESS_COUNT = 'event.success_count'; - -export const SERVICE = 'service'; -export const SERVICE_NAME = 'service.name'; -export const SERVICE_ENVIRONMENT = 'service.environment'; -export const SERVICE_FRAMEWORK_NAME = 'service.framework.name'; -export const SERVICE_FRAMEWORK_VERSION = 'service.framework.version'; -export const SERVICE_LANGUAGE_NAME = 'service.language.name'; -export const SERVICE_LANGUAGE_VERSION = 'service.language.version'; -export const SERVICE_RUNTIME_NAME = 'service.runtime.name'; -export const SERVICE_RUNTIME_VERSION = 'service.runtime.version'; -export const SERVICE_NODE_NAME = 'service.node.name'; -export const SERVICE_VERSION = 'service.version'; -export const SERVICE_TARGET_TYPE = 'service.target.type'; -export const SERVICE_OVERFLOW_COUNT = 'service_transaction.aggregation.overflow_count'; - -export const URL_FULL = 'url.full'; -export const HTTP_REQUEST_METHOD = 'http.request.method'; -export const HTTP_RESPONSE_STATUS_CODE = 'http.response.status_code'; -export const USER_ID = 'user.id'; -export const USER_AGENT_ORIGINAL = 'user_agent.original'; -export const USER_AGENT_NAME = 'user_agent.name'; - -export const OBSERVER_HOSTNAME = 'observer.hostname'; -export const OBSERVER_LISTENING = 'observer.listening'; -export const PROCESSOR_EVENT = 'processor.event'; - -export const TRANSACTION_DURATION = 'transaction.duration.us'; -export const TRANSACTION_DURATION_HISTOGRAM = 'transaction.duration.histogram'; -export const TRANSACTION_DURATION_SUMMARY = 'transaction.duration.summary'; -export const TRANSACTION_TYPE = 'transaction.type'; -export const TRANSACTION_RESULT = 'transaction.result'; -export const TRANSACTION_NAME = 'transaction.name'; -export const TRANSACTION_ID = 'transaction.id'; -export const TRANSACTION_SAMPLED = 'transaction.sampled'; -export const TRANSACTION_PAGE_URL = 'transaction.page.url'; -export const TRANSACTION_FAILURE_COUNT = 'transaction.failure_count'; -export const TRANSACTION_SUCCESS_COUNT = 'transaction.success_count'; -export const TRANSACTION_OVERFLOW_COUNT = 'transaction.aggregation.overflow_count'; -// for transaction metrics -export const TRANSACTION_ROOT = 'transaction.root'; -export const TRANSACTION_PROFILER_STACK_TRACE_IDS = 'transaction.profiler_stack_trace_ids'; - -export const EVENT_OUTCOME = 'event.outcome'; - -export const TRACE_ID = 'trace.id'; - -export const SPAN_DURATION = 'span.duration.us'; -export const SPAN_TYPE = 'span.type'; -export const SPAN_SUBTYPE = 'span.subtype'; -export const SPAN_SELF_TIME_SUM = 'span.self_time.sum.us'; -export const SPAN_ACTION = 'span.action'; -export const SPAN_NAME = 'span.name'; -export const SPAN_ID = 'span.id'; -export const SPAN_DESTINATION_SERVICE_RESOURCE = 'span.destination.service.resource'; -export const SPAN_DESTINATION_SERVICE_RESPONSE_TIME_COUNT = - 'span.destination.service.response_time.count'; - -export const SPAN_DESTINATION_SERVICE_RESPONSE_TIME_SUM = - 'span.destination.service.response_time.sum.us'; - -export const SPAN_LINKS = 'span.links'; -export const SPAN_LINKS_TRACE_ID = 'span.links.trace.id'; -export const SPAN_LINKS_SPAN_ID = 'span.links.span.id'; - -export const SPAN_COMPOSITE_COUNT = 'span.composite.count'; -export const SPAN_COMPOSITE_SUM = 'span.composite.sum.us'; -export const SPAN_COMPOSITE_COMPRESSION_STRATEGY = 'span.composite.compression_strategy'; - -export const SPAN_SYNC = 'span.sync'; - -// Parent ID for a transaction or span -export const PARENT_ID = 'parent.id'; - -export const ERROR_ID = 'error.id'; -export const ERROR_GROUP_ID = 'error.grouping_key'; -export const ERROR_GROUP_NAME = 'error.grouping_name'; -export const ERROR_CULPRIT = 'error.culprit'; -export const ERROR_LOG_LEVEL = 'error.log.level'; -export const ERROR_LOG_MESSAGE = 'error.log.message'; -export const ERROR_EXCEPTION = 'error.exception'; -export const ERROR_EXC_MESSAGE = 'error.exception.message'; // only to be used in es queries, since error.exception is now an array -export const ERROR_EXC_HANDLED = 'error.exception.handled'; // only to be used in es queries, since error.exception is now an array -export const ERROR_EXC_TYPE = 'error.exception.type'; -export const ERROR_PAGE_URL = 'error.page.url'; -export const ERROR_TYPE = 'error.type'; - -// METRICS -export const METRIC_SYSTEM_FREE_MEMORY = 'system.memory.actual.free'; -export const METRIC_SYSTEM_TOTAL_MEMORY = 'system.memory.total'; -export const METRIC_SYSTEM_CPU_PERCENT = 'system.cpu.total.norm.pct'; -export const METRIC_PROCESS_CPU_PERCENT = 'system.process.cpu.total.norm.pct'; -export const METRIC_CGROUP_MEMORY_LIMIT_BYTES = 'system.process.cgroup.memory.mem.limit.bytes'; -export const METRIC_CGROUP_MEMORY_USAGE_BYTES = 'system.process.cgroup.memory.mem.usage.bytes'; - -export const METRIC_JAVA_HEAP_MEMORY_MAX = 'jvm.memory.heap.max'; -export const METRIC_JAVA_HEAP_MEMORY_COMMITTED = 'jvm.memory.heap.committed'; -export const METRIC_JAVA_HEAP_MEMORY_USED = 'jvm.memory.heap.used'; -export const METRIC_JAVA_NON_HEAP_MEMORY_MAX = 'jvm.memory.non_heap.max'; -export const METRIC_JAVA_NON_HEAP_MEMORY_COMMITTED = 'jvm.memory.non_heap.committed'; -export const METRIC_JAVA_NON_HEAP_MEMORY_USED = 'jvm.memory.non_heap.used'; -export const METRIC_JAVA_THREAD_COUNT = 'jvm.thread.count'; -export const METRIC_JAVA_GC_COUNT = 'jvm.gc.count'; -export const METRIC_JAVA_GC_TIME = 'jvm.gc.time'; - -export const METRICSET_NAME = 'metricset.name'; -export const METRICSET_INTERVAL = 'metricset.interval'; - -export const LABEL_NAME = 'labels.name'; -export const LABEL_GC = 'labels.gc'; -export const LABEL_TYPE = 'labels.type'; -export const LABEL_TELEMETRY_AUTO_VERSION = 'labels.telemetry_auto_version'; -export const LABEL_LIFECYCLE_STATE = 'labels.lifecycle_state'; - -export const HOST = 'host'; -export const HOST_HOSTNAME = 'host.hostname'; // Do not use. Please use `HOST_NAME` instead. -export const HOST_NAME = 'host.name'; -export const HOST_OS_PLATFORM = 'host.os.platform'; -export const HOST_ARCHITECTURE = 'host.architecture'; -export const HOST_OS_VERSION = 'host.os.version'; - -export const CONTAINER_ID = 'container.id'; -export const CONTAINER = 'container'; -export const CONTAINER_IMAGE = 'container.image.name'; - -export const KUBERNETES = 'kubernetes'; -export const KUBERNETES_POD_NAME = 'kubernetes.pod.name'; -export const KUBERNETES_POD_UID = 'kubernetes.pod.uid'; - -export const FAAS_ID = 'faas.id'; -export const FAAS_NAME = 'faas.name'; -export const FAAS_COLDSTART = 'faas.coldstart'; -export const FAAS_TRIGGER_TYPE = 'faas.trigger.type'; -export const FAAS_DURATION = 'faas.duration'; -export const FAAS_COLDSTART_DURATION = 'faas.coldstart_duration'; -export const FAAS_BILLED_DURATION = 'faas.billed_duration'; - -// OpenTelemetry Metrics -export const METRIC_OTEL_SYSTEM_CPU_UTILIZATION = 'system.cpu.utilization'; -export const METRIC_OTEL_SYSTEM_MEMORY_UTILIZATION = 'system.memory.utilization'; - -export const METRIC_OTEL_JVM_PROCESS_CPU_PERCENT = 'process.runtime.jvm.cpu.utilization'; -export const METRIC_OTEL_JVM_PROCESS_MEMORY_USAGE = 'process.runtime.jvm.memory.usage'; -export const METRIC_OTEL_JVM_PROCESS_MEMORY_COMMITTED = 'process.runtime.jvm.memory.committed'; -export const METRIC_OTEL_JVM_PROCESS_MEMORY_LIMIT = 'process.runtime.jvm.memory.limit'; -export const METRIC_OTEL_JVM_PROCESS_THREADS_COUNT = 'process.runtime.jvm.threads.count'; -export const METRIC_OTEL_JVM_SYSTEM_CPU_PERCENT = 'process.runtime.jvm.system.cpu.utilization'; -export const METRIC_OTEL_JVM_GC_DURATION = 'process.runtime.jvm.gc.duration'; -export const VALUE_OTEL_JVM_PROCESS_MEMORY_HEAP = 'heap'; -export const VALUE_OTEL_JVM_PROCESS_MEMORY_NON_HEAP = 'non_heap'; - -// Metadata -export const TIER = '_tier'; -export const INDEX = '_index'; -export const DATA_STEAM_TYPE = 'data_stream.type'; - -// Mobile -export const NETWORK_CONNECTION_TYPE = 'network.connection.type'; -export const DEVICE_MODEL_IDENTIFIER = 'device.model.identifier'; -export const SESSION_ID = 'session.id'; -export const APP_LAUNCH_TIME = 'application.launch.time'; -export const EVENT_NAME = 'event.name'; - -// Location -export const CLIENT_GEO_COUNTRY_ISO_CODE = 'client.geo.country_iso_code'; -export const CLIENT_GEO_REGION_ISO_CODE = 'client.geo.region_iso_code'; -export const CLIENT_GEO_COUNTRY_NAME = 'client.geo.country_name'; -export const CLIENT_GEO_CITY_NAME = 'client.geo.city_name'; -export const CLIENT_GEO_REGION_NAME = 'client.geo.region_name'; - -export const CHILD_ID = 'child.id'; +export * from '@kbn/apm-types/es_fields'; diff --git a/x-pack/plugins/observability_solution/apm/tsconfig.json b/x-pack/plugins/observability_solution/apm/tsconfig.json index f9db8e36fd63df..fcc63468028302 100644 --- a/x-pack/plugins/observability_solution/apm/tsconfig.json +++ b/x-pack/plugins/observability_solution/apm/tsconfig.json @@ -127,7 +127,8 @@ "@kbn/shared-ux-page-no-data-config-types", "@kbn/react-hooks", "@kbn/server-route-repository-utils", - "@kbn/core-analytics-browser" + "@kbn/core-analytics-browser", + "@kbn/apm-types" ], "exclude": [ "target/**/*" diff --git a/x-pack/plugins/observability_solution/apm/typings/es_schemas/raw/apm_base_doc.ts b/x-pack/plugins/observability_solution/apm/typings/es_schemas/raw/apm_base_doc.ts index e39d90ff58b99f..ffe2c708b2e598 100644 --- a/x-pack/plugins/observability_solution/apm/typings/es_schemas/raw/apm_base_doc.ts +++ b/x-pack/plugins/observability_solution/apm/typings/es_schemas/raw/apm_base_doc.ts @@ -5,19 +5,4 @@ * 2.0. */ -import { Observer } from './fields/observer'; - -// all documents types extend APMBaseDoc and inherit all properties -export interface APMBaseDoc { - '@timestamp': string; - agent: { - name: string; - version: string; - }; - parent?: { id: string }; // parent ID is not available on root transactions - trace?: { id: string }; - labels?: { - [key: string]: string | number | boolean; - }; - observer?: Observer; -} +export type { APMBaseDoc } from '@kbn/apm-types/es_schemas_raw'; diff --git a/x-pack/plugins/observability_solution/apm/typings/es_schemas/raw/error_raw.ts b/x-pack/plugins/observability_solution/apm/typings/es_schemas/raw/error_raw.ts index 34e24033db2304..f86fb663dac4f4 100644 --- a/x-pack/plugins/observability_solution/apm/typings/es_schemas/raw/error_raw.ts +++ b/x-pack/plugins/observability_solution/apm/typings/es_schemas/raw/error_raw.ts @@ -5,68 +5,4 @@ * 2.0. */ -import { APMBaseDoc } from './apm_base_doc'; -import { Container } from './fields/container'; -import { Host } from './fields/host'; -import { Http } from './fields/http'; -import { Kubernetes } from './fields/kubernetes'; -import { Page } from './fields/page'; -import { Process } from './fields/process'; -import { Service } from './fields/service'; -import { Stackframe } from './fields/stackframe'; -import { TimestampUs } from './fields/timestamp_us'; -import { Url } from './fields/url'; -import { User } from './fields/user'; - -export interface Processor { - name: 'error'; - event: 'error'; -} - -export interface Exception { - attributes?: { - response?: string; - }; - code?: string; - message?: string; // either message or type are given - type?: string; - module?: string; - handled?: boolean; - stacktrace?: Stackframe[]; -} - -export interface Log { - message: string; - stacktrace?: Stackframe[]; -} - -export interface ErrorRaw extends APMBaseDoc { - processor: Processor; - timestamp: TimestampUs; - transaction?: { - id: string; - sampled?: boolean; - type: string; - }; - error: { - id: string; - culprit?: string; - grouping_key: string; - // either exception or log are given - exception?: Exception[]; - page?: Page; // special property for RUM: shared by error and transaction - log?: Log; - stack_trace?: string; - custom?: Record; - }; - - // Shared by errors and transactions - container?: Container; - host?: Host; - http?: Http; - kubernetes?: Kubernetes; - process?: Process; - service: Service; - url?: Url; - user?: User; -} +export type { ErrorRaw, Log, Exception, Processor } from '@kbn/apm-types/es_schemas_raw'; diff --git a/x-pack/plugins/observability_solution/apm/typings/es_schemas/raw/event_raw.ts b/x-pack/plugins/observability_solution/apm/typings/es_schemas/raw/event_raw.ts index 31a1952cdc03d8..b0e4f134164bc9 100644 --- a/x-pack/plugins/observability_solution/apm/typings/es_schemas/raw/event_raw.ts +++ b/x-pack/plugins/observability_solution/apm/typings/es_schemas/raw/event_raw.ts @@ -5,21 +5,4 @@ * 2.0. */ -import { APMBaseDoc } from './apm_base_doc'; -import { TimestampUs } from './fields/timestamp_us'; - -export interface EventRaw extends APMBaseDoc { - timestamp: TimestampUs; - transaction?: { - id: string; - sampled?: boolean; - type: string; - }; - log: { - message?: string; - }; - event: { - action: string; - category: string; - }; -} +export type { EventRaw } from '@kbn/apm-types/es_schemas_raw'; diff --git a/x-pack/plugins/observability_solution/apm/typings/es_schemas/raw/fields/cloud.ts b/x-pack/plugins/observability_solution/apm/typings/es_schemas/raw/fields/cloud.ts index bc0c3ea8002ad0..b187506ef52d45 100644 --- a/x-pack/plugins/observability_solution/apm/typings/es_schemas/raw/fields/cloud.ts +++ b/x-pack/plugins/observability_solution/apm/typings/es_schemas/raw/fields/cloud.ts @@ -5,29 +5,4 @@ * 2.0. */ -export interface Cloud { - availability_zone?: string; - instance?: { - name: string; - id: string; - }; - machine?: { - type: string; - }; - project?: { - id: string; - name: string; - }; - provider?: string; - region?: string; - account?: { - id: string; - name: string; - }; - image?: { - id: string; - }; - service?: { - name: string; - }; -} +export type { Cloud } from '@kbn/apm-types/es_schemas_raw'; diff --git a/x-pack/plugins/observability_solution/apm/typings/es_schemas/raw/fields/container.ts b/x-pack/plugins/observability_solution/apm/typings/es_schemas/raw/fields/container.ts index c17517b7c5f2df..fc5f749f46f60d 100644 --- a/x-pack/plugins/observability_solution/apm/typings/es_schemas/raw/fields/container.ts +++ b/x-pack/plugins/observability_solution/apm/typings/es_schemas/raw/fields/container.ts @@ -5,7 +5,4 @@ * 2.0. */ -export interface Container { - id?: string | null; - image?: string | null; -} +export type { Container } from '@kbn/apm-types/es_schemas_raw'; diff --git a/x-pack/plugins/observability_solution/apm/typings/es_schemas/raw/fields/event_outcome.ts b/x-pack/plugins/observability_solution/apm/typings/es_schemas/raw/fields/event_outcome.ts index d0ca41fcba4ed7..8ec05dc0274ee0 100644 --- a/x-pack/plugins/observability_solution/apm/typings/es_schemas/raw/fields/event_outcome.ts +++ b/x-pack/plugins/observability_solution/apm/typings/es_schemas/raw/fields/event_outcome.ts @@ -5,4 +5,4 @@ * 2.0. */ -export type EventOutcome = 'success' | 'failure' | 'unknown'; +export type { EventOutcome } from '@kbn/apm-types/es_schemas_raw'; diff --git a/x-pack/plugins/observability_solution/apm/typings/es_schemas/raw/fields/faas.ts b/x-pack/plugins/observability_solution/apm/typings/es_schemas/raw/fields/faas.ts index 1229b8134ac13a..1779fc3528132b 100644 --- a/x-pack/plugins/observability_solution/apm/typings/es_schemas/raw/fields/faas.ts +++ b/x-pack/plugins/observability_solution/apm/typings/es_schemas/raw/fields/faas.ts @@ -5,12 +5,4 @@ * 2.0. */ -export interface Faas { - id: string; - coldstart?: boolean; - execution?: string; - trigger?: { - type?: string; - request_id?: string; - }; -} +export type { Faas } from '@kbn/apm-types/es_schemas_raw'; diff --git a/x-pack/plugins/observability_solution/apm/typings/es_schemas/raw/fields/host.ts b/x-pack/plugins/observability_solution/apm/typings/es_schemas/raw/fields/host.ts index 6d1941ff0184cf..96cf79ab1d6595 100644 --- a/x-pack/plugins/observability_solution/apm/typings/es_schemas/raw/fields/host.ts +++ b/x-pack/plugins/observability_solution/apm/typings/es_schemas/raw/fields/host.ts @@ -5,12 +5,4 @@ * 2.0. */ -export interface Host { - architecture?: string; - hostname?: string; - name?: string; - ip?: string; - os?: { - platform?: string; - }; -} +export type { Host } from '@kbn/apm-types/es_schemas_raw'; diff --git a/x-pack/plugins/observability_solution/apm/typings/es_schemas/raw/fields/http.ts b/x-pack/plugins/observability_solution/apm/typings/es_schemas/raw/fields/http.ts index 547f117b413266..b2f7ffc6843ef7 100644 --- a/x-pack/plugins/observability_solution/apm/typings/es_schemas/raw/fields/http.ts +++ b/x-pack/plugins/observability_solution/apm/typings/es_schemas/raw/fields/http.ts @@ -5,8 +5,4 @@ * 2.0. */ -export interface Http { - request?: { method: string; [key: string]: unknown }; - response?: { status_code: number; [key: string]: unknown }; - version?: string; -} +export type { Http } from '@kbn/apm-types/es_schemas_raw'; diff --git a/x-pack/plugins/observability_solution/apm/typings/es_schemas/raw/fields/kubernetes.ts b/x-pack/plugins/observability_solution/apm/typings/es_schemas/raw/fields/kubernetes.ts index 5cf0b497dad180..4c7cbf15dd2b2d 100644 --- a/x-pack/plugins/observability_solution/apm/typings/es_schemas/raw/fields/kubernetes.ts +++ b/x-pack/plugins/observability_solution/apm/typings/es_schemas/raw/fields/kubernetes.ts @@ -5,17 +5,4 @@ * 2.0. */ -export interface Kubernetes { - pod?: { uid?: string | null; [key: string]: unknown }; - namespace?: string; - replicaset?: { - name?: string; - }; - deployment?: { - name?: string; - }; - container?: { - id?: string; - name?: string; - }; -} +export type { Kubernetes } from '@kbn/apm-types/es_schemas_raw'; diff --git a/x-pack/plugins/observability_solution/apm/typings/es_schemas/raw/fields/observer.ts b/x-pack/plugins/observability_solution/apm/typings/es_schemas/raw/fields/observer.ts index 81a0bf1e0bfd2f..65fab1814a172e 100644 --- a/x-pack/plugins/observability_solution/apm/typings/es_schemas/raw/fields/observer.ts +++ b/x-pack/plugins/observability_solution/apm/typings/es_schemas/raw/fields/observer.ts @@ -5,12 +5,4 @@ * 2.0. */ -export interface Observer { - ephemeral_id?: string; - hostname?: string; - id?: string; - name?: string; - type?: string; - version: string; - version_major: number; -} +export type { Observer } from '@kbn/apm-types/es_schemas_raw'; diff --git a/x-pack/plugins/observability_solution/apm/typings/es_schemas/raw/fields/page.ts b/x-pack/plugins/observability_solution/apm/typings/es_schemas/raw/fields/page.ts index f9344355947861..3070d8ab6ec69a 100644 --- a/x-pack/plugins/observability_solution/apm/typings/es_schemas/raw/fields/page.ts +++ b/x-pack/plugins/observability_solution/apm/typings/es_schemas/raw/fields/page.ts @@ -6,6 +6,4 @@ */ // only for RUM agent: shared by error and transaction -export interface Page { - url: string; -} +export type { Page } from '@kbn/apm-types/es_schemas_raw'; diff --git a/x-pack/plugins/observability_solution/apm/typings/es_schemas/raw/fields/process.ts b/x-pack/plugins/observability_solution/apm/typings/es_schemas/raw/fields/process.ts index 10973e3b66a5ff..c372c6f3ef9596 100644 --- a/x-pack/plugins/observability_solution/apm/typings/es_schemas/raw/fields/process.ts +++ b/x-pack/plugins/observability_solution/apm/typings/es_schemas/raw/fields/process.ts @@ -5,9 +5,4 @@ * 2.0. */ -export interface Process { - args?: string[]; - pid: number; - ppid?: number; - title?: string; -} +export type { Process } from '@kbn/apm-types/es_schemas_raw'; diff --git a/x-pack/plugins/observability_solution/apm/typings/es_schemas/raw/fields/service.ts b/x-pack/plugins/observability_solution/apm/typings/es_schemas/raw/fields/service.ts index 7158c886e8109b..dc7f872117cdc2 100644 --- a/x-pack/plugins/observability_solution/apm/typings/es_schemas/raw/fields/service.ts +++ b/x-pack/plugins/observability_solution/apm/typings/es_schemas/raw/fields/service.ts @@ -5,23 +5,4 @@ * 2.0. */ -export interface Service { - name: string; - environment?: string; - framework?: { - name: string; - version?: string; - }; - node?: { - name?: string; - }; - runtime?: { - name: string; - version: string; - }; - language?: { - name: string; - version?: string; - }; - version?: string; -} +export type { Service } from '@kbn/apm-types/es_schemas_raw'; diff --git a/x-pack/plugins/observability_solution/apm/typings/es_schemas/raw/fields/span_links.ts b/x-pack/plugins/observability_solution/apm/typings/es_schemas/raw/fields/span_links.ts index 5e0028ad58176e..05027bfd70bf56 100644 --- a/x-pack/plugins/observability_solution/apm/typings/es_schemas/raw/fields/span_links.ts +++ b/x-pack/plugins/observability_solution/apm/typings/es_schemas/raw/fields/span_links.ts @@ -5,7 +5,4 @@ * 2.0. */ -export interface SpanLink { - trace: { id: string }; - span: { id: string }; -} +export type { SpanLink } from '@kbn/apm-types/es_schemas_raw'; diff --git a/x-pack/plugins/observability_solution/apm/typings/es_schemas/raw/fields/stackframe.ts b/x-pack/plugins/observability_solution/apm/typings/es_schemas/raw/fields/stackframe.ts index 90d7f20047573b..ca357ec00732de 100644 --- a/x-pack/plugins/observability_solution/apm/typings/es_schemas/raw/fields/stackframe.ts +++ b/x-pack/plugins/observability_solution/apm/typings/es_schemas/raw/fields/stackframe.ts @@ -5,39 +5,4 @@ * 2.0. */ -interface Line { - column?: number; - number: number; -} - -interface Sourcemap { - error?: string; - updated?: boolean; -} - -interface StackframeBase { - abs_path?: string; - classname?: string; - context?: { - post?: string[]; - pre?: string[]; - }; - exclude_from_grouping?: boolean; - filename?: string; - function?: string; - module?: string; - library_frame?: boolean; - line?: Line; - sourcemap?: Sourcemap; - vars?: { - [key: string]: unknown; - }; -} - -export type StackframeWithLineContext = StackframeBase & { - line: Line & { - context: string; - }; -}; - -export type Stackframe = StackframeBase | StackframeWithLineContext; +export type { StackframeWithLineContext, Stackframe } from '@kbn/apm-types/es_schemas_raw'; diff --git a/x-pack/plugins/observability_solution/apm/typings/es_schemas/raw/fields/timestamp_us.ts b/x-pack/plugins/observability_solution/apm/typings/es_schemas/raw/fields/timestamp_us.ts index f6f944b6fe95f5..a36b28a35635fe 100644 --- a/x-pack/plugins/observability_solution/apm/typings/es_schemas/raw/fields/timestamp_us.ts +++ b/x-pack/plugins/observability_solution/apm/typings/es_schemas/raw/fields/timestamp_us.ts @@ -5,6 +5,4 @@ * 2.0. */ -export interface TimestampUs { - us: number; -} +export type { TimestampUs } from '@kbn/apm-types/es_schemas_raw'; diff --git a/x-pack/plugins/observability_solution/apm/typings/es_schemas/raw/fields/url.ts b/x-pack/plugins/observability_solution/apm/typings/es_schemas/raw/fields/url.ts index 001d6370e5f060..f30ba85fd474d5 100644 --- a/x-pack/plugins/observability_solution/apm/typings/es_schemas/raw/fields/url.ts +++ b/x-pack/plugins/observability_solution/apm/typings/es_schemas/raw/fields/url.ts @@ -5,8 +5,4 @@ * 2.0. */ -export interface Url { - domain?: string; - full: string; - original?: string; -} +export type { Url } from '@kbn/apm-types/es_schemas_raw'; diff --git a/x-pack/plugins/observability_solution/apm/typings/es_schemas/raw/fields/user.ts b/x-pack/plugins/observability_solution/apm/typings/es_schemas/raw/fields/user.ts index dcb5fa03dcd5ab..a727d61d530052 100644 --- a/x-pack/plugins/observability_solution/apm/typings/es_schemas/raw/fields/user.ts +++ b/x-pack/plugins/observability_solution/apm/typings/es_schemas/raw/fields/user.ts @@ -5,6 +5,4 @@ * 2.0. */ -export interface User { - id: string; -} +export type { User } from '@kbn/apm-types/es_schemas_raw'; diff --git a/x-pack/plugins/observability_solution/apm/typings/es_schemas/raw/fields/user_agent.ts b/x-pack/plugins/observability_solution/apm/typings/es_schemas/raw/fields/user_agent.ts index 884f627353d9bd..71eb4bd41e434d 100644 --- a/x-pack/plugins/observability_solution/apm/typings/es_schemas/raw/fields/user_agent.ts +++ b/x-pack/plugins/observability_solution/apm/typings/es_schemas/raw/fields/user_agent.ts @@ -5,16 +5,4 @@ * 2.0. */ -export interface UserAgent { - device?: { - name: string; - }; - name?: string; - original: string; - os?: { - name: string; - version?: string; - full?: string; - }; - version?: string; -} +export type { UserAgent } from '@kbn/apm-types/es_schemas_raw'; diff --git a/x-pack/plugins/observability_solution/apm/typings/es_schemas/raw/metric_raw.ts b/x-pack/plugins/observability_solution/apm/typings/es_schemas/raw/metric_raw.ts index d7d015fd21da5d..7bd8dcbe6869cd 100644 --- a/x-pack/plugins/observability_solution/apm/typings/es_schemas/raw/metric_raw.ts +++ b/x-pack/plugins/observability_solution/apm/typings/es_schemas/raw/metric_raw.ts @@ -5,119 +5,4 @@ * 2.0. */ -import { APMBaseDoc } from './apm_base_doc'; -import { Cloud } from './fields/cloud'; -import { Container } from './fields/container'; -import { Host } from './fields/host'; -import { Kubernetes } from './fields/kubernetes'; -import { Service } from './fields/service'; - -type BaseMetric = APMBaseDoc & { - processor: { - name: 'metric'; - event: 'metric'; - }; - cloud?: Cloud; - container?: Container; - kubernetes?: Kubernetes; - service?: Service; - host?: Host; -}; - -type BaseBreakdownMetric = BaseMetric & { - transaction: { - name: string; - type: string; - }; - span: { - self_time: { - count: number; - sum: { - us: number; - }; - }; - }; -}; - -type TransactionBreakdownMetric = BaseBreakdownMetric & { - transaction: { - duration: { - count: number; - sum: { - us: number; - }; - }; - breakdown: { - count: number; - }; - }; -}; - -type SpanBreakdownMetric = BaseBreakdownMetric & { - span: { - type: string; - subtype?: string; - }; -}; - -type SystemMetric = BaseMetric & { - system: unknown; - service: { - node?: { - name: string; - }; - }; -}; - -type CGroupMetric = SystemMetric; -type JVMMetric = SystemMetric & { - jvm: unknown; -}; - -type TransactionDurationMetric = BaseMetric & { - transaction: { - name: string; - type: string; - result?: string; - duration: { - histogram: { - values: number[]; - counts: number[]; - }; - }; - }; - service: { - name: string; - node?: { - name: string; - }; - environment?: string; - version?: string; - }; -}; - -export type SpanDestinationMetric = BaseMetric & { - span: { - destination: { - service: { - resource: string; - response_time: { - count: number; - sum: { - us: number; - }; - }; - }; - }; - }; -}; - -export type MetricRaw = - | BaseMetric - | TransactionBreakdownMetric - | SpanBreakdownMetric - | TransactionDurationMetric - | SpanDestinationMetric - | SystemMetric - | CGroupMetric - | JVMMetric; +export type { MetricRaw } from '@kbn/apm-types/es_schemas_raw'; diff --git a/x-pack/plugins/observability_solution/apm/typings/es_schemas/raw/span_raw.ts b/x-pack/plugins/observability_solution/apm/typings/es_schemas/raw/span_raw.ts index 301a4c96dfa358..42427f9d8623e8 100644 --- a/x-pack/plugins/observability_solution/apm/typings/es_schemas/raw/span_raw.ts +++ b/x-pack/plugins/observability_solution/apm/typings/es_schemas/raw/span_raw.ts @@ -5,75 +5,4 @@ * 2.0. */ -import { APMBaseDoc } from './apm_base_doc'; -import { EventOutcome } from './fields/event_outcome'; -import { Http } from './fields/http'; -import { SpanLink } from './fields/span_links'; -import { Stackframe } from './fields/stackframe'; -import { TimestampUs } from './fields/timestamp_us'; -import { Url } from './fields/url'; - -interface Processor { - name: 'transaction'; - event: 'span'; -} - -export interface SpanRaw extends APMBaseDoc { - processor: Processor; - trace: { id: string }; // trace is required - event?: { outcome?: EventOutcome }; - service: { - name: string; - environment?: string; - }; - span: { - destination?: { - service: { - resource: string; - }; - }; - action?: string; - duration: { us: number }; - id: string; - name: string; - stacktrace?: Stackframe[]; - subtype?: string; - sync?: boolean; - type: string; - http?: { - url?: { - original?: string; - }; - response: { - status_code: number; - }; - method?: string; - }; - db?: { - statement?: string; - type?: string; - }; - message?: { - queue?: { name: string }; - age?: { ms: number }; - body?: string; - headers?: Record; - }; - composite?: { - count: number; - sum: { us: number }; - compression_strategy: string; - }; - links?: SpanLink[]; - }; - timestamp: TimestampUs; - transaction?: { - id: string; - }; - child?: { id: string[] }; - code?: { - stacktrace?: string; - }; - http?: Http; - url?: Url; -} +export type { SpanRaw } from '@kbn/apm-types/es_schemas_raw'; diff --git a/x-pack/plugins/observability_solution/apm/typings/es_schemas/raw/transaction_raw.ts b/x-pack/plugins/observability_solution/apm/typings/es_schemas/raw/transaction_raw.ts index 4046bb9470fb71..adfc536ab06cff 100644 --- a/x-pack/plugins/observability_solution/apm/typings/es_schemas/raw/transaction_raw.ts +++ b/x-pack/plugins/observability_solution/apm/typings/es_schemas/raw/transaction_raw.ts @@ -5,74 +5,4 @@ * 2.0. */ -import { APMBaseDoc } from './apm_base_doc'; -import { Cloud } from './fields/cloud'; -import { Container } from './fields/container'; -import { EventOutcome } from './fields/event_outcome'; -import { Host } from './fields/host'; -import { Http } from './fields/http'; -import { Kubernetes } from './fields/kubernetes'; -import { Page } from './fields/page'; -import { Process } from './fields/process'; -import { Service } from './fields/service'; -import { TimestampUs } from './fields/timestamp_us'; -import { Url } from './fields/url'; -import { User } from './fields/user'; -import { UserAgent } from './fields/user_agent'; -import { Faas } from './fields/faas'; -import { SpanLink } from './fields/span_links'; - -interface Processor { - name: 'transaction'; - event: 'transaction'; -} - -export interface TransactionRaw extends APMBaseDoc { - processor: Processor; - timestamp: TimestampUs; - trace: { id: string }; // trace is required - event?: { outcome?: EventOutcome }; - transaction: { - duration: { us: number }; - id: string; - marks?: { - // "agent": not defined by APM Server - only sent by RUM agent - agent?: { - [name: string]: number; - }; - }; - name?: string; - page?: Page; // special property for RUM: shared by error and transaction - result?: string; - sampled: boolean; - span_count?: { - started?: number; - dropped?: number; - }; - type: string; - custom?: Record; - message?: { - queue?: { name: string }; - age?: { ms: number }; - body?: string; - headers?: Record; - }; - }; - - // Shared by errors and transactions - container?: Container; - ecs?: { version?: string }; - host?: Host; - http?: Http; - kubernetes?: Kubernetes; - process?: Process; - service: Service; - url?: Url; - user?: User; - user_agent?: UserAgent; - cloud?: Cloud; - faas?: Faas; - span?: { - links?: SpanLink[]; - }; -} +export type { TransactionRaw } from '@kbn/apm-types/es_schemas_raw'; diff --git a/x-pack/plugins/observability_solution/apm/typings/es_schemas/ui/apm_error.ts b/x-pack/plugins/observability_solution/apm/typings/es_schemas/ui/apm_error.ts index 13521d90a84aad..a4c5c7fe0867c6 100644 --- a/x-pack/plugins/observability_solution/apm/typings/es_schemas/ui/apm_error.ts +++ b/x-pack/plugins/observability_solution/apm/typings/es_schemas/ui/apm_error.ts @@ -5,9 +5,4 @@ * 2.0. */ -import { ErrorRaw } from '../raw/error_raw'; -import { Agent } from './fields/agent'; - -export interface APMError extends ErrorRaw { - agent: Agent; -} +export type { APMError } from '@kbn/apm-types/es_schemas_ui'; diff --git a/x-pack/plugins/observability_solution/apm/typings/es_schemas/ui/event.ts b/x-pack/plugins/observability_solution/apm/typings/es_schemas/ui/event.ts index 8d9fccea1c8bf0..de726d110914c7 100644 --- a/x-pack/plugins/observability_solution/apm/typings/es_schemas/ui/event.ts +++ b/x-pack/plugins/observability_solution/apm/typings/es_schemas/ui/event.ts @@ -5,9 +5,4 @@ * 2.0. */ -import { EventRaw } from '../raw/event_raw'; -import { Agent } from './fields/agent'; - -export interface Event extends EventRaw { - agent: Agent; -} +export type { Event } from '@kbn/apm-types/es_schemas_ui'; diff --git a/x-pack/plugins/observability_solution/apm/typings/es_schemas/ui/fields/agent.ts b/x-pack/plugins/observability_solution/apm/typings/es_schemas/ui/fields/agent.ts index 67f4a6b2ba10b0..b53da484ec7470 100644 --- a/x-pack/plugins/observability_solution/apm/typings/es_schemas/ui/fields/agent.ts +++ b/x-pack/plugins/observability_solution/apm/typings/es_schemas/ui/fields/agent.ts @@ -5,12 +5,9 @@ * 2.0. */ -import type { AgentName } from '@kbn/elastic-agent-utils'; - -export type { ElasticAgentName, OpenTelemetryAgentName, AgentName } from '@kbn/elastic-agent-utils'; - -export interface Agent { - ephemeral_id?: string; - name: AgentName; - version: string; -} +export type { + Agent, + ElasticAgentName, + OpenTelemetryAgentName, + AgentName, +} from '@kbn/apm-types/es_schemas_ui'; diff --git a/x-pack/plugins/observability_solution/apm/typings/es_schemas/ui/metric.ts b/x-pack/plugins/observability_solution/apm/typings/es_schemas/ui/metric.ts index b06a686c23ef78..d2c98333915648 100644 --- a/x-pack/plugins/observability_solution/apm/typings/es_schemas/ui/metric.ts +++ b/x-pack/plugins/observability_solution/apm/typings/es_schemas/ui/metric.ts @@ -5,6 +5,4 @@ * 2.0. */ -import { MetricRaw } from '../raw/metric_raw'; - -export type Metric = MetricRaw; +export type { Metric } from '@kbn/apm-types/es_schemas_ui'; diff --git a/x-pack/plugins/observability_solution/apm/typings/es_schemas/ui/span.ts b/x-pack/plugins/observability_solution/apm/typings/es_schemas/ui/span.ts index cfee36de51429c..92e2fd44eabd82 100644 --- a/x-pack/plugins/observability_solution/apm/typings/es_schemas/ui/span.ts +++ b/x-pack/plugins/observability_solution/apm/typings/es_schemas/ui/span.ts @@ -5,9 +5,4 @@ * 2.0. */ -import { SpanRaw } from '../raw/span_raw'; -import { Agent } from './fields/agent'; - -export interface Span extends SpanRaw { - agent: Agent; -} +export type { Span } from '@kbn/apm-types/es_schemas_ui'; diff --git a/x-pack/plugins/observability_solution/apm/typings/es_schemas/ui/transaction.ts b/x-pack/plugins/observability_solution/apm/typings/es_schemas/ui/transaction.ts index 2dfbc860ec05a0..db8012401f398d 100644 --- a/x-pack/plugins/observability_solution/apm/typings/es_schemas/ui/transaction.ts +++ b/x-pack/plugins/observability_solution/apm/typings/es_schemas/ui/transaction.ts @@ -5,18 +5,4 @@ * 2.0. */ -import { TransactionRaw } from '../raw/transaction_raw'; -import { Agent } from './fields/agent'; - -// Make `transaction.name` required instead of optional. -// `transaction.name` can be missing in Elasticsearch but the UI will only aggregate on transactions with a name, -// and thus it doesn't make sense to treat it as optional -type InnerTransaction = TransactionRaw['transaction']; -interface InnerTransactionWithName extends InnerTransaction { - name: string; -} - -export interface Transaction extends TransactionRaw { - agent: Agent; - transaction: InnerTransactionWithName; -} +export type { Transaction } from '@kbn/apm-types/es_schemas_ui'; diff --git a/yarn.lock b/yarn.lock index 9623b2b9378f38..3d2a400a9f70f4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3452,6 +3452,10 @@ version "0.0.0" uid "" +"@kbn/apm-types@link:packages/kbn-apm-types": + version "0.0.0" + uid "" + "@kbn/apm-utils@link:packages/kbn-apm-utils": version "0.0.0" uid ""