[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>
This commit is contained in:
Carlos Crespo 2024-08-01 17:14:42 +02:00 committed by GitHub
parent b6b5a89fa4
commit 9189208b5e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
76 changed files with 1178 additions and 762 deletions

1
.github/CODEOWNERS vendored
View file

@ -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

View file

@ -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",

View file

@ -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';

View file

@ -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';

View file

@ -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';

View file

@ -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';

View file

@ -0,0 +1,5 @@
{
"type": "shared-common",
"id": "@kbn/apm-types",
"owner": "@elastic/obs-ux-infra_services-team"
}

View file

@ -0,0 +1,6 @@
{
"name": "@kbn/apm-types",
"private": true,
"version": "1.0.0",
"license": "SSPL-1.0 OR Elastic License 2.0"
}

View file

@ -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';

View file

@ -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;
}

View file

@ -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<string, unknown>;
};
// Shared by errors and transactions
container?: Container;
host?: Host;
http?: Http;
kubernetes?: Kubernetes;
process?: Process;
service: Service;
url?: Url;
user?: User;
}

View file

@ -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;
};
}

View file

@ -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;
};
}

View file

@ -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;
}

View file

@ -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';

View file

@ -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;
};
}

View file

@ -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;
};
}

View file

@ -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;
}

View file

@ -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';

View file

@ -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;
};
}

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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 };
}

View file

@ -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;

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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';

View file

@ -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;

View file

@ -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<string, unknown>;
};
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;
}

View file

@ -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<string, unknown>;
message?: {
queue?: { name: string };
age?: { ms: number };
body?: string;
headers?: Record<string, unknown>;
};
};
// 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[];
};
}

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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';

View file

@ -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';

View file

@ -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;

View file

@ -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;
}

View file

@ -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;
}

View file

@ -0,0 +1,18 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "target/types",
"types": [
"node"
]
},
"include": [
"**/*.ts"
],
"exclude": [
"target/**/*",
],
"kbn_references": [
"@kbn/elastic-agent-utils",
]
}

View file

@ -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"],

View file

@ -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';

View file

@ -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/**/*"

View file

@ -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';

View file

@ -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<string, unknown>;
};
// 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';

View file

@ -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';

View file

@ -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';

View file

@ -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';

View file

@ -5,4 +5,4 @@
* 2.0.
*/
export type EventOutcome = 'success' | 'failure' | 'unknown';
export type { EventOutcome } from '@kbn/apm-types/es_schemas_raw';

View file

@ -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';

View file

@ -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';

View file

@ -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';

View file

@ -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';

View file

@ -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';

View file

@ -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';

View file

@ -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';

View file

@ -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';

View file

@ -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';

View file

@ -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';

View file

@ -5,6 +5,4 @@
* 2.0.
*/
export interface TimestampUs {
us: number;
}
export type { TimestampUs } from '@kbn/apm-types/es_schemas_raw';

View file

@ -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';

View file

@ -5,6 +5,4 @@
* 2.0.
*/
export interface User {
id: string;
}
export type { User } from '@kbn/apm-types/es_schemas_raw';

View file

@ -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';

View file

@ -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';

View file

@ -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<string, unknown>;
};
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';

View file

@ -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<string, unknown>;
message?: {
queue?: { name: string };
age?: { ms: number };
body?: string;
headers?: Record<string, unknown>;
};
};
// 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';

View file

@ -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';

View file

@ -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';

View file

@ -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';

View file

@ -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';

View file

@ -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';

View file

@ -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';

View file

@ -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 ""