[APM] fix action menu infra link for docker.container.id (#28140) (#28521)

* Fixes #27573 by targeting `docker.container.id` to populate the action menu

* [APM] replace lodash get with idx accessor to not lose type information

* [APM] fix type inconsistencies between v1 and v2 transaction types
This commit is contained in:
Oliver Gupte 2019-01-11 09:43:56 -08:00 committed by GitHub
parent fe1706bd26
commit 930d6ef8c7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 27 additions and 8 deletions

View file

@ -182,6 +182,7 @@
"history-extra": "^4.0.2",
"humps": "2.0.1",
"icalendar": "0.7.1",
"idx": "^2.5.2",
"inline-style": "^2.0.0",
"intl": "^1.2.5",
"io-ts": "^1.4.2",

View file

@ -14,10 +14,13 @@ import {
EuiLink,
EuiPopover
} from '@elastic/eui';
import { get } from 'lodash';
import idx from 'idx';
import React from 'react';
import { getKibanaHref } from 'x-pack/plugins/apm/public/utils/url';
import { Transaction } from 'x-pack/plugins/apm/typings/es_schemas/Transaction';
import {
Transaction,
TransactionV2
} from 'x-pack/plugins/apm/typings/es_schemas/Transaction';
import { getDiscoverQuery } from '../DiscoverButtons/DiscoverTransactionButton';
import { QueryWithIndexPattern } from '../DiscoverButtons/QueryWithIndexPattern';
@ -65,9 +68,12 @@ export class TransactionActionMenu extends React.Component<Props, State> {
};
public getInfraActions(transaction: Transaction) {
const hostName = get(transaction, 'context.system.hostname');
const podId = get(transaction, 'kubernetes.pod.uid');
const containerId = get(transaction, 'container.id');
const hostName = idx(transaction, _ => _.context.system.hostname);
const podId = idx(transaction as TransactionV2, _ => _.kubernetes.pod.uid);
const containerId = idx(
transaction as TransactionV2,
_ => _.docker.container.id
);
const pathname = '/app/infra';
const time = new Date(transaction['@timestamp']).getTime();
const infraMetricsQuery = getInfraMetricsQuery(transaction);

View file

@ -106,8 +106,10 @@
"uid": "pod123456abcdef"
}
},
"container": {
"id": "container123456abcdef"
"docker": {
"container": {
"id": "container123456abcdef"
}
},
"timestamp": {
"us": 1545092070952472

View file

@ -80,11 +80,16 @@ export interface TransactionV2 extends APMDocV2 {
};
type: string;
};
kubernetes: {
kubernetes?: {
pod: {
uid: string;
};
};
docker?: {
container: {
id: string;
};
};
container: {
id: string;
};

View file

@ -11110,6 +11110,11 @@ icss-utils@^2.1.0:
dependencies:
postcss "^6.0.1"
idx@^2.5.2:
version "2.5.2"
resolved "https://registry.yarnpkg.com/idx/-/idx-2.5.2.tgz#4b405c2e6d68d04136e0a368a7ab35b9caa0595f"
integrity sha512-MLoGF4lQU5q/RqJJjRsuid52emu7tPVtSSZaYXsqRvSjvXdBEmIwk2urvbNvPBRU9Ox9I4WYnxiz2GjhU34Lrw==
ieee754@^1.1.4:
version "1.1.8"
resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.1.8.tgz#be33d40ac10ef1926701f6f08a2d86fbfd1ad3e4"