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

[Infra UI]Adding linking support for APM #27319

Merged
merged 4 commits into from
Dec 17, 2018
Merged
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 @@ -25,23 +25,43 @@ interface Props {

export const NodeContextMenu = injectI18n(
({ options, timeRange, children, node, isPopoverOpen, closePopover, nodeType, intl }: Props) => {
const nodeId = node.path.length > 0 ? node.path[node.path.length - 1].value : undefined;
const nodeLogsUrl = nodeId
// Due to the changing nature of the fields between APM and this UI,
// We need to have some exceptions until 7.0 & ECS is finalized. Reference
// #26620 for the details for these fields.
// TODO: This is tech debt, remove it after 7.0 & ECS migration.
const APM_FIELDS = {
[InfraNodeType.host]: 'context.system.hostname',
[InfraNodeType.container]: 'container.id',
[InfraNodeType.pod]: 'kubernetes.pod.uid',
};

const nodeLogsUrl = node.id
? getNodeLogsUrl({
nodeType,
nodeId,
nodeId: node.id,
time: timeRange.to,
})
: undefined;
const nodeDetailUrl = nodeId
const nodeDetailUrl = node.id
? getNodeDetailUrl({
nodeType,
nodeId,
nodeId: node.id,
from: timeRange.from,
to: timeRange.to,
})
: undefined;

const apmTracesUrl = {
name: intl.formatMessage(
{
id: 'xpack.infra.nodeContextMenu.viewAPMTraces',
defaultMessage: 'View {nodeType} APM traces',
},
{ nodeType }
),
href: `../app/apm#/services?_g=()&kuery=${APM_FIELDS[nodeType]}~20~3A~20~22${node.id}~22`,
};

const panels: EuiContextMenuPanelDescriptor[] = [
{
id: 0,
Expand Down Expand Up @@ -69,6 +89,7 @@ export const NodeContextMenu = injectI18n(
},
]
: []),
...[apmTracesUrl],
],
},
];
Expand Down