diff --git a/x-pack/plugins/apm/common/__snapshots__/constants.test.ts.snap b/x-pack/plugins/apm/common/__snapshots__/constants.test.ts.snap
index efa828a7e6d04..3874fc3aa3368 100644
--- a/x-pack/plugins/apm/common/__snapshots__/constants.test.ts.snap
+++ b/x-pack/plugins/apm/common/__snapshots__/constants.test.ts.snap
@@ -26,6 +26,8 @@ exports[`Error METRIC_SYSTEM_FREE_MEMORY 1`] = `undefined`;
exports[`Error METRIC_SYSTEM_TOTAL_MEMORY 1`] = `undefined`;
+exports[`Error OBSERVER_LISTENING 1`] = `undefined`;
+
exports[`Error PARENT_ID 1`] = `"parentId"`;
exports[`Error PROCESSOR_EVENT 1`] = `"error"`;
@@ -96,6 +98,8 @@ exports[`Span METRIC_SYSTEM_FREE_MEMORY 1`] = `undefined`;
exports[`Span METRIC_SYSTEM_TOTAL_MEMORY 1`] = `undefined`;
+exports[`Span OBSERVER_LISTENING 1`] = `undefined`;
+
exports[`Span PARENT_ID 1`] = `"parentId"`;
exports[`Span PROCESSOR_EVENT 1`] = `"span"`;
@@ -166,6 +170,8 @@ exports[`Transaction METRIC_SYSTEM_FREE_MEMORY 1`] = `undefined`;
exports[`Transaction METRIC_SYSTEM_TOTAL_MEMORY 1`] = `undefined`;
+exports[`Transaction OBSERVER_LISTENING 1`] = `undefined`;
+
exports[`Transaction PARENT_ID 1`] = `"parentId"`;
exports[`Transaction PROCESSOR_EVENT 1`] = `"transaction"`;
diff --git a/x-pack/plugins/apm/common/constants.test.ts b/x-pack/plugins/apm/common/constants.test.ts
index e93441082fdaf..f6a11d43f5513 100644
--- a/x-pack/plugins/apm/common/constants.test.ts
+++ b/x-pack/plugins/apm/common/constants.test.ts
@@ -17,7 +17,10 @@ describe('Transaction', () => {
name: 'agent name',
version: 'agent version'
},
- http: { request: { method: 'GET' } },
+ http: {
+ request: { method: 'GET' },
+ response: { status_code: 200 }
+ },
url: { full: 'http://www.elastic.co' },
service: {
name: 'service name',
@@ -93,12 +96,13 @@ describe('Span', () => {
id: 'parentId'
},
span: {
- duration: {
- us: 1337
- },
+ action: 'my action',
+ duration: { us: 1337 },
+ id: 'span id',
name: 'span name',
- type: 'span type',
- id: 'span id'
+ subtype: 'my subtype',
+ sync: false,
+ type: 'span type'
},
transaction: {
id: 'transaction id'
diff --git a/x-pack/plugins/apm/public/components/app/ErrorGroupDetails/DetailView/__test__/__snapshots__/DetailView.test.tsx.snap b/x-pack/plugins/apm/public/components/app/ErrorGroupDetails/DetailView/__test__/__snapshots__/DetailView.test.tsx.snap
index a2a674efc0e92..5b9ce6cfa947f 100644
--- a/x-pack/plugins/apm/public/components/app/ErrorGroupDetails/DetailView/__test__/__snapshots__/DetailView.test.tsx.snap
+++ b/x-pack/plugins/apm/public/components/app/ErrorGroupDetails/DetailView/__test__/__snapshots__/DetailView.test.tsx.snap
@@ -147,18 +147,10 @@ exports[`DetailView should render tabs 1`] = `
- Tags
-
-
- Custom
+ Labels
`;
diff --git a/x-pack/plugins/apm/public/components/shared/PropertiesTable/propertyConfig.ts b/x-pack/plugins/apm/public/components/shared/PropertiesTable/propertyConfig.ts
index 3af687249d749..3cb34230b3496 100644
--- a/x-pack/plugins/apm/public/components/shared/PropertiesTable/propertyConfig.ts
+++ b/x-pack/plugins/apm/public/components/shared/PropertiesTable/propertyConfig.ts
@@ -5,51 +5,53 @@
*/
import { i18n } from '@kbn/i18n';
+import { APMError } from 'x-pack/plugins/apm/typings/es_schemas/Error';
+import { Transaction } from 'x-pack/plugins/apm/typings/es_schemas/Transaction';
-export interface TabWithKey {
+export interface Tab {
key: string;
label: string;
- required: boolean;
- presortedKeys: string[];
}
-export interface Tab {
- key: string;
+type AllKeys = keyof NonNullable | keyof NonNullable;
+interface ConfigItem {
+ key: T;
label: string;
+ required: boolean;
+ presortedKeys: Array<
+ T extends keyof Transaction
+ ? keyof NonNullable
+ : T extends keyof APMError
+ ? keyof NonNullable
+ : never
+ >;
}
-export const PROPERTY_CONFIG: TabWithKey[] = [
+export const PROPERTY_CONFIG = [
{
key: 'url',
label: i18n.translate('xpack.apm.propertiesTable.tabs.urlLabel', {
defaultMessage: 'Url'
}),
required: false,
- presortedKeys: [
- 'http_version',
- 'method',
- 'url',
- 'socket',
- 'headers',
- 'body'
- ]
- },
+ presortedKeys: []
+ } as ConfigItem<'url'>,
{
key: 'http',
label: i18n.translate('xpack.apm.propertiesTable.tabs.httpLabel', {
defaultMessage: 'HTTP'
}),
required: false,
- presortedKeys: ['status_code', 'headers', 'headers_sent', 'finished']
- },
+ presortedKeys: []
+ } as ConfigItem<'http'>,
{
- key: 'system',
- label: i18n.translate('xpack.apm.propertiesTable.tabs.systemLabel', {
- defaultMessage: 'System'
+ key: 'host',
+ label: i18n.translate('xpack.apm.propertiesTable.tabs.hostLabel', {
+ defaultMessage: 'Host'
}),
required: false,
presortedKeys: ['hostname', 'architecture', 'platform']
- },
+ } as ConfigItem<'host'>,
{
key: 'service',
label: i18n.translate('xpack.apm.propertiesTable.tabs.serviceLabel', {
@@ -57,15 +59,15 @@ export const PROPERTY_CONFIG: TabWithKey[] = [
}),
required: false,
presortedKeys: ['runtime', 'framework', 'agent', 'version']
- },
+ } as ConfigItem<'service'>,
{
key: 'process',
label: i18n.translate('xpack.apm.propertiesTable.tabs.processLabel', {
defaultMessage: 'Process'
}),
required: false,
- presortedKeys: ['pid', 'title', 'argv']
- },
+ presortedKeys: ['pid', 'title', 'args']
+ } as ConfigItem<'process'>,
{
key: 'user',
label: i18n.translate('xpack.apm.propertiesTable.tabs.userLabel', {
@@ -73,21 +75,13 @@ export const PROPERTY_CONFIG: TabWithKey[] = [
}),
required: true,
presortedKeys: ['id', 'username', 'email']
- },
- {
- key: 'tags',
- label: i18n.translate('xpack.apm.propertiesTable.tabs.tagsLabel', {
- defaultMessage: 'Tags'
- }),
- required: true,
- presortedKeys: []
- },
+ } as ConfigItem<'user'>,
{
- key: 'custom',
- label: i18n.translate('xpack.apm.propertiesTable.tabs.customLabel', {
- defaultMessage: 'Custom'
+ key: 'labels',
+ label: i18n.translate('xpack.apm.propertiesTable.tabs.labelsLabel', {
+ defaultMessage: 'Labels'
}),
required: true,
presortedKeys: []
- }
+ } as ConfigItem<'labels'>
];
diff --git a/x-pack/plugins/apm/typings/es_schemas/APMDoc.ts b/x-pack/plugins/apm/typings/es_schemas/APMDoc.ts
index 2f35115e49a8a..6966533541635 100644
--- a/x-pack/plugins/apm/typings/es_schemas/APMDoc.ts
+++ b/x-pack/plugins/apm/typings/es_schemas/APMDoc.ts
@@ -11,15 +11,14 @@ export interface Context {
[key: string]: unknown;
}
+// TODO: APMDoc should perhaps only be the base for errors and transactions. Not spans
export interface APMDoc {
'@timestamp': string;
host?: {
architecture?: string;
hostname?: string;
ip?: string;
- os?: {
- platform?: string;
- };
+ os?: { platform?: string };
};
agent: {
name: string;
@@ -29,9 +28,8 @@ export interface APMDoc {
full: string;
};
http?: {
- request: {
- method: string;
- };
+ request: { method: string };
+ response: { status_code: number };
};
service: {
name: string;
@@ -52,7 +50,7 @@ export interface APMDoc {
process?: {
pid: number;
title: string;
- argv: string[];
+ args: string[];
[key: string]: unknown;
};
timestamp: {
@@ -69,5 +67,8 @@ export interface APMDoc {
username?: string;
email?: string;
};
+ labels?: {
+ [key: string]: unknown;
+ };
context?: Context;
}
diff --git a/x-pack/plugins/apm/typings/es_schemas/Span.ts b/x-pack/plugins/apm/typings/es_schemas/Span.ts
index 998cf28a62b7f..da37c897bb307 100644
--- a/x-pack/plugins/apm/typings/es_schemas/Span.ts
+++ b/x-pack/plugins/apm/typings/es_schemas/Span.ts
@@ -12,6 +12,7 @@ interface Processor {
event: 'span';
}
+// TODO: should spanContext extend shared context?
interface SpanContext extends Context {
db?: {
instance?: string;
@@ -20,10 +21,12 @@ interface SpanContext extends Context {
user?: string;
};
http?: {
+ method?: string;
+ status_code?: number;
url?: string;
};
tags?: {
- [key: string]: string;
+ [key: string]: string; // is this always a string?
};
}
@@ -31,13 +34,14 @@ export interface Span extends APMDoc {
processor: Processor;
context?: SpanContext;
span: {
- duration: {
- us: number;
- };
- name: string;
- type: string;
+ action: string;
+ duration: { us: number };
id: string;
+ name: string;
stacktrace?: IStackframe[];
+ subtype: string;
+ sync: boolean;
+ type: string;
};
transaction: {
id: string;