[Infra UI]Adding linking support for APM (#27319)
* Fixes #26620 - Adding linking support for APM * Fixing some weird merge artifacts * Finalizing URL linking to APM
This commit is contained in:
parent
8964523f41
commit
4eb5e64758
|
@ -25,23 +25,43 @@ interface Props {
|
||||||
|
|
||||||
export const NodeContextMenu = injectI18n(
|
export const NodeContextMenu = injectI18n(
|
||||||
({ options, timeRange, children, node, isPopoverOpen, closePopover, nodeType, intl }: Props) => {
|
({ options, timeRange, children, node, isPopoverOpen, closePopover, nodeType, intl }: Props) => {
|
||||||
const nodeId = node.path.length > 0 ? node.path[node.path.length - 1].value : undefined;
|
// Due to the changing nature of the fields between APM and this UI,
|
||||||
const nodeLogsUrl = nodeId
|
// 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({
|
? getNodeLogsUrl({
|
||||||
nodeType,
|
nodeType,
|
||||||
nodeId,
|
nodeId: node.id,
|
||||||
time: timeRange.to,
|
time: timeRange.to,
|
||||||
})
|
})
|
||||||
: undefined;
|
: undefined;
|
||||||
const nodeDetailUrl = nodeId
|
const nodeDetailUrl = node.id
|
||||||
? getNodeDetailUrl({
|
? getNodeDetailUrl({
|
||||||
nodeType,
|
nodeType,
|
||||||
nodeId,
|
nodeId: node.id,
|
||||||
from: timeRange.from,
|
from: timeRange.from,
|
||||||
to: timeRange.to,
|
to: timeRange.to,
|
||||||
})
|
})
|
||||||
: undefined;
|
: 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[] = [
|
const panels: EuiContextMenuPanelDescriptor[] = [
|
||||||
{
|
{
|
||||||
id: 0,
|
id: 0,
|
||||||
|
@ -69,6 +89,7 @@ export const NodeContextMenu = injectI18n(
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
: []),
|
: []),
|
||||||
|
...[apmTracesUrl],
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
Loading…
Reference in a new issue