Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[APM]Add message fields to metadata table #54017

Merged
merged 1 commit into from
Jan 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,15 @@ describe('SpanMetadata', () => {
name: 'opbeans-java'
},
span: {
id: '7efbc7056b746fcb'
id: '7efbc7056b746fcb',
message: {
age: { ms: 1577958057123 },
queue: { name: 'queue name' }
}
}
} as unknown) as Span;
const output = render(<SpanMetadata span={span} />, renderOptions);
expectTextsInDocument(output, ['Service', 'Agent']);
expectTextsInDocument(output, ['Service', 'Agent', 'Message']);
});
});
describe('when a span is presented', () => {
Expand All @@ -55,11 +59,15 @@ describe('SpanMetadata', () => {
response: { status_code: 200 }
},
subtype: 'http',
type: 'external'
type: 'external',
message: {
age: { ms: 1577958057123 },
queue: { name: 'queue name' }
}
}
} as unknown) as Span;
const output = render(<SpanMetadata span={span} />, renderOptions);
expectTextsInDocument(output, ['Service', 'Agent', 'Span']);
expectTextsInDocument(output, ['Service', 'Agent', 'Span', 'Message']);
});
});
describe('when there is no id inside span', () => {
Expand All @@ -83,7 +91,7 @@ describe('SpanMetadata', () => {
} as unknown) as Span;
const output = render(<SpanMetadata span={span} />, renderOptions);
expectTextsInDocument(output, ['Service', 'Agent']);
expectTextsNotInDocument(output, ['Span']);
expectTextsNotInDocument(output, ['Span', 'Message']);
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import {
SPAN,
LABELS,
TRANSACTION,
TRACE
TRACE,
MESSAGE_SPAN
} from '../sections';

export const SPAN_METADATA_SECTIONS: Section[] = [
Expand All @@ -20,5 +21,6 @@ export const SPAN_METADATA_SECTIONS: Section[] = [
TRANSACTION,
TRACE,
SERVICE,
MESSAGE_SPAN,
AGENT
];
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ function getTransaction() {
notIncluded: 'transaction not included value',
custom: {
someKey: 'custom value'
},
message: {
age: { ms: 1577958057123 },
queue: { name: 'queue name' }
}
}
} as unknown) as Transaction;
Expand All @@ -59,7 +63,8 @@ describe('TransactionMetadata', () => {
'Agent',
'URL',
'User',
'Custom'
'Custom',
'Message'
]);
});

Expand All @@ -81,7 +86,9 @@ describe('TransactionMetadata', () => {
'agent.someKey',
'url.someKey',
'user.someKey',
'transaction.custom.someKey'
'transaction.custom.someKey',
'transaction.message.age.ms',
'transaction.message.queue.name'
]);

// excluded keys
Expand Down Expand Up @@ -109,7 +116,9 @@ describe('TransactionMetadata', () => {
'agent value',
'url value',
'user value',
'custom value'
'custom value',
'1577958057123',
'queue name'
]);

// excluded values
Expand Down Expand Up @@ -138,7 +147,8 @@ describe('TransactionMetadata', () => {
'Process',
'Agent',
'URL',
'Custom'
'Custom',
'Message'
]);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ import {
PAGE,
USER,
USER_AGENT,
CUSTOM_TRANSACTION
CUSTOM_TRANSACTION,
MESSAGE_TRANSACTION
} from '../sections';

export const TRANSACTION_METADATA_SECTIONS: Section[] = [
Expand All @@ -29,6 +30,7 @@ export const TRANSACTION_METADATA_SECTIONS: Section[] = [
CONTAINER,
SERVICE,
PROCESS,
MESSAGE_TRANSACTION,
AGENT,
URL,
{ ...PAGE, key: 'transaction.page' },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,3 +136,20 @@ export const CUSTOM_TRANSACTION: Section = {
key: 'transaction.custom',
label: customLabel
};

const messageLabel = i18n.translate(
'xpack.apm.metadataTable.section.messageLabel',
{
defaultMessage: 'Message'
}
);

export const MESSAGE_TRANSACTION: Section = {
key: 'transaction.message',
label: messageLabel
};

export const MESSAGE_SPAN: Section = {
key: 'span.message',
label: messageLabel
};
6 changes: 6 additions & 0 deletions x-pack/legacy/plugins/apm/typings/es_schemas/raw/SpanRaw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ export interface SpanRaw extends APMBaseDoc {
statement?: string;
type?: string;
};
message?: {
queue?: { name: string };
age?: { ms: number };
body?: string;
headers?: Record<string, unknown>;
};
};
transaction?: {
id: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ export interface TransactionRaw extends APMBaseDoc {
};
type: string;
custom?: Record<string, unknown>;
message?: {
queue?: { name: string };
age?: { ms: number };
body?: string;
headers?: Record<string, unknown>;
};
};

// Shared by errors and transactions
Expand Down