[APM] Fix issue with missing agentName on metrics page (#37210) (#37501)

This commit is contained in:
Søren Louv-Jansen 2019-05-30 18:31:21 +02:00 committed by GitHub
parent a30dc7dae2
commit 2215c019a3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 7 deletions

View file

@ -17,7 +17,7 @@ interface Props {
transactionTypes: string[];
urlParams: IUrlParams;
isRumAgent?: boolean;
agentName: string;
agentName?: string;
}
export function ServiceDetailTabs({

View file

@ -13,7 +13,7 @@ import { MetricsChart } from './MetricsChart';
interface ServiceMetricsProps {
urlParams: IUrlParams;
agentName: string;
agentName?: string;
}
export function ServiceMetrics({ urlParams, agentName }: ServiceMetricsProps) {

View file

@ -16,7 +16,7 @@ const INITIAL_DATA: MetricsChartsByAgentAPIResponse = {
export function useServiceMetricCharts(
urlParams: IUrlParams,
agentName: string
agentName?: string
) {
const { serviceName, start, end } = urlParams;
const uiFilters = useUiFilters(urlParams);
@ -24,17 +24,17 @@ export function useServiceMetricCharts(
MetricsChartsByAgentAPIResponse
>(
() => {
if (serviceName && start && end) {
if (serviceName && start && end && agentName) {
return loadMetricsChartData({
serviceName,
agentName,
start,
end,
agentName,
uiFilters
});
}
},
[serviceName, start, end, uiFilters]
[serviceName, start, end, agentName, uiFilters]
);
return {

View file

@ -60,7 +60,7 @@ export async function getService(serviceName: string, setup: Setup) {
const { aggregations } = await client<void, Aggs>('search', params);
const buckets = idx(aggregations, _ => _.types.buckets) || [];
const types = buckets.map(bucket => bucket.key);
const agentName = idx(aggregations, _ => _.agents.buckets[0].key) || '';
const agentName = idx(aggregations, _ => _.agents.buckets[0].key);
return {
serviceName,
types,