Skip to content

Commit

Permalink
Merge branch 'master' of github.com:elastic/kibana into security-rac-…
Browse files Browse the repository at this point in the history
…rules-migration
  • Loading branch information
madirey committed Oct 26, 2021
2 parents 8ef98a7 + 9911883 commit 5f70fc6
Show file tree
Hide file tree
Showing 25 changed files with 273 additions and 296 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/add-to-apm-project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ jobs:
contentid: ${{ github.event.issue.node_id }}
env:
PROJECT_ID: "PN_kwDOAGc3Zs0VSg"
GITHUB_TOKEN: ${{ secrets.KIBANAMACHINE_TOKEN }}
GITHUB_TOKEN: ${{ secrets.APM_TECH_KIBANA_USER_TOKEN }}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { useUrlParams } from '../../../context/url_params_context/use_url_params
import { useFetcher } from '../../../hooks/use_fetcher';
import { getTimeRangeComparison } from '../../shared/time_comparison/get_time_range_comparison';
import { DependenciesTable } from '../../shared/dependencies_table';
import { useApmBackendContext } from '../../../context/apm_backend/use_apm_backend_context';
import { ServiceLink } from '../../shared/service_link';
import { useTimeRange } from '../../../hooks/use_time_range';

Expand All @@ -23,8 +22,8 @@ export function BackendDetailDependenciesTable() {
} = useUrlParams();

const {
query: { rangeFrom, rangeTo, kuery, environment },
} = useApmParams('/backends/{backendName}/overview');
query: { backendName, rangeFrom, rangeTo, kuery, environment },
} = useApmParams('/backends/overview');

const { start, end } = useTimeRange({ rangeFrom, rangeTo });

Expand All @@ -35,21 +34,24 @@ export function BackendDetailDependenciesTable() {
comparisonType,
});

const { backendName } = useApmBackendContext();

const { data, status } = useFetcher(
(callApmApi) => {
if (!start || !end) {
return;
}

return callApmApi({
endpoint: 'GET /internal/apm/backends/{backendName}/upstream_services',
endpoint: 'GET /internal/apm/backends/upstream_services',
params: {
path: {
query: {
backendName,
start,
end,
environment,
numBuckets: 20,
offset,
kuery,
},
query: { start, end, environment, numBuckets: 20, offset, kuery },
},
});
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import React, { useMemo } from 'react';
import { i18n } from '@kbn/i18n';
import { asPercent } from '../../../../common/utils/formatters';
import { useApmBackendContext } from '../../../context/apm_backend/use_apm_backend_context';
import { useComparison } from '../../../hooks/use_comparison';
import { useFetcher } from '../../../hooks/use_fetcher';
import { useTimeRange } from '../../../hooks/use_time_range';
Expand All @@ -25,13 +24,11 @@ export function BackendFailedTransactionRateChart({
}: {
height: number;
}) {
const { backendName } = useApmBackendContext();

const theme = useTheme();

const {
query: { kuery, environment, rangeFrom, rangeTo },
} = useApmParams('/backends/{backendName}/overview');
query: { backendName, kuery, environment, rangeFrom, rangeTo },
} = useApmParams('/backends/overview');

const { start, end } = useTimeRange({ rangeFrom, rangeTo });

Expand All @@ -44,12 +41,10 @@ export function BackendFailedTransactionRateChart({
}

return callApmApi({
endpoint: 'GET /internal/apm/backends/{backendName}/charts/error_rate',
endpoint: 'GET /internal/apm/backends/charts/error_rate',
params: {
path: {
backendName,
},
query: {
backendName,
start,
end,
offset,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import React, { useMemo } from 'react';
import { i18n } from '@kbn/i18n';
import { getDurationFormatter } from '../../../../common/utils/formatters';
import { useApmBackendContext } from '../../../context/apm_backend/use_apm_backend_context';
import { useComparison } from '../../../hooks/use_comparison';
import { useFetcher } from '../../../hooks/use_fetcher';
import { useTimeRange } from '../../../hooks/use_time_range';
Expand All @@ -21,13 +20,11 @@ import {
import { useApmParams } from '../../../hooks/use_apm_params';

export function BackendLatencyChart({ height }: { height: number }) {
const { backendName } = useApmBackendContext();

const theme = useTheme();

const {
query: { rangeFrom, rangeTo, kuery, environment },
} = useApmParams('/backends/{backendName}/overview');
query: { backendName, rangeFrom, rangeTo, kuery, environment },
} = useApmParams('/backends/overview');

const { start, end } = useTimeRange({ rangeFrom, rangeTo });

Expand All @@ -40,12 +37,10 @@ export function BackendLatencyChart({ height }: { height: number }) {
}

return callApmApi({
endpoint: 'GET /internal/apm/backends/{backendName}/charts/latency',
endpoint: 'GET /internal/apm/backends/charts/latency',
params: {
path: {
backendName,
},
query: {
backendName,
start,
end,
offset,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import React, { useMemo } from 'react';
import { i18n } from '@kbn/i18n';
import { asTransactionRate } from '../../../../common/utils/formatters';
import { useApmBackendContext } from '../../../context/apm_backend/use_apm_backend_context';
import { useComparison } from '../../../hooks/use_comparison';
import { useFetcher } from '../../../hooks/use_fetcher';
import { useTimeRange } from '../../../hooks/use_time_range';
Expand All @@ -17,13 +16,11 @@ import { useTheme } from '../../../hooks/use_theme';
import { useApmParams } from '../../../hooks/use_apm_params';

export function BackendThroughputChart({ height }: { height: number }) {
const { backendName } = useApmBackendContext();

const theme = useTheme();

const {
query: { rangeFrom, rangeTo, kuery, environment },
} = useApmParams('/backends/{backendName}/overview');
query: { backendName, rangeFrom, rangeTo, kuery, environment },
} = useApmParams('/backends/overview');

const { start, end } = useTimeRange({ rangeFrom, rangeTo });

Expand All @@ -36,12 +33,10 @@ export function BackendThroughputChart({ height }: { height: number }) {
}

return callApmApi({
endpoint: 'GET /internal/apm/backends/{backendName}/charts/throughput',
endpoint: 'GET /internal/apm/backends/charts/throughput',
params: {
path: {
backendName,
},
query: {
backendName,
start,
end,
offset,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import React from 'react';
import { EuiSpacer } from '@elastic/eui';
import { EuiTitle } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { ApmBackendContextProvider } from '../../../context/apm_backend/apm_backend_context';
import { useBreadcrumb } from '../../../context/breadcrumbs/use_breadcrumb';
import { ChartPointerEventContextProvider } from '../../../context/chart_pointer_event/chart_pointer_event_context';
import { useApmParams } from '../../../hooks/use_apm_params';
Expand All @@ -31,16 +30,16 @@ import { useBreakpoints } from '../../../hooks/use_breakpoints';

export function BackendDetailOverview() {
const {
path: { backendName },
query: {
backendName,
rangeFrom,
rangeTo,
refreshInterval,
refreshPaused,
environment,
kuery,
},
} = useApmParams('/backends/{backendName}/overview');
} = useApmParams('/backends/overview');

const apmRouter = useApmRouter();

Expand All @@ -60,9 +59,9 @@ export function BackendDetailOverview() {
},
{
title: backendName,
href: apmRouter.link('/backends/{backendName}/overview', {
path: { backendName },
href: apmRouter.link('/backends/overview', {
query: {
backendName,
rangeFrom,
rangeTo,
refreshInterval,
Expand All @@ -82,62 +81,59 @@ export function BackendDetailOverview() {
const largeScreenOrSmaller = useBreakpoints().isLarge;

return (
<ApmBackendContextProvider>
<BackendDetailTemplate title={backendName}>
<SearchBar
showTimeComparison
kueryBarPlaceholder={kueryBarPlaceholder}
kueryBarBoolFilter={kueryBarBoolFilter}
/>
<ChartPointerEventContextProvider>
<EuiFlexGroup
direction={largeScreenOrSmaller ? 'column' : 'row'}
gutterSize="s"
>
<EuiFlexItem>
<EuiPanel hasBorder={true}>
<EuiTitle size="xs">
<h2>
{i18n.translate(
'xpack.apm.backendDetailLatencyChartTitle',
{ defaultMessage: 'Latency' }
)}
</h2>
</EuiTitle>
<BackendLatencyChart height={200} />
</EuiPanel>
</EuiFlexItem>
<EuiFlexItem>
<EuiPanel hasBorder={true}>
<EuiTitle size="xs">
<h2>
{i18n.translate(
'xpack.apm.backendDetailThroughputChartTitle',
{ defaultMessage: 'Throughput' }
)}
</h2>
</EuiTitle>
<BackendThroughputChart height={200} />
</EuiPanel>
</EuiFlexItem>
<EuiFlexItem>
<EuiPanel hasBorder={true}>
<EuiTitle size="xs">
<h2>
{i18n.translate(
'xpack.apm.backendDetailFailedTransactionRateChartTitle',
{ defaultMessage: 'Failed transaction rate' }
)}
</h2>
</EuiTitle>
<BackendFailedTransactionRateChart height={200} />
</EuiPanel>
</EuiFlexItem>
</EuiFlexGroup>
</ChartPointerEventContextProvider>
<EuiSpacer size="l" />
<BackendDetailDependenciesTable />
</BackendDetailTemplate>
</ApmBackendContextProvider>
<BackendDetailTemplate title={backendName}>
<SearchBar
showTimeComparison
kueryBarPlaceholder={kueryBarPlaceholder}
kueryBarBoolFilter={kueryBarBoolFilter}
/>
<ChartPointerEventContextProvider>
<EuiFlexGroup
direction={largeScreenOrSmaller ? 'column' : 'row'}
gutterSize="s"
>
<EuiFlexItem>
<EuiPanel hasBorder={true}>
<EuiTitle size="xs">
<h2>
{i18n.translate('xpack.apm.backendDetailLatencyChartTitle', {
defaultMessage: 'Latency',
})}
</h2>
</EuiTitle>
<BackendLatencyChart height={200} />
</EuiPanel>
</EuiFlexItem>
<EuiFlexItem>
<EuiPanel hasBorder={true}>
<EuiTitle size="xs">
<h2>
{i18n.translate(
'xpack.apm.backendDetailThroughputChartTitle',
{ defaultMessage: 'Throughput' }
)}
</h2>
</EuiTitle>
<BackendThroughputChart height={200} />
</EuiPanel>
</EuiFlexItem>
<EuiFlexItem>
<EuiPanel hasBorder={true}>
<EuiTitle size="xs">
<h2>
{i18n.translate(
'xpack.apm.backendDetailFailedTransactionRateChartTitle',
{ defaultMessage: 'Failed transaction rate' }
)}
</h2>
</EuiTitle>
<BackendFailedTransactionRateChart height={200} />
</EuiPanel>
</EuiFlexItem>
</EuiFlexGroup>
</ChartPointerEventContextProvider>
<EuiSpacer size="l" />
<BackendDetailDependenciesTable />
</BackendDetailTemplate>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ export function BackendInventoryDependenciesTable() {
}
const link = (
<BackendLink
backendName={location.backendName}
type={location.spanType}
subtype={location.spanSubtype}
query={{
backendName: location.backendName,
comparisonEnabled,
comparisonType,
environment,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ export function BackendContents({
(callApmApi) => {
if (backendName) {
return callApmApi({
endpoint: 'GET /internal/apm/service-map/backend/{backendName}',
endpoint: 'GET /internal/apm/service-map/backend',
params: {
path: { backendName },
query: {
backendName,
environment,
start,
end,
Expand All @@ -57,12 +57,11 @@ export function BackendContents({
);

const isLoading = status === FETCH_STATUS.LOADING;
const detailsUrl = apmRouter.link('/backends/{backendName}/overview', {
path: { backendName },
query: query as TypeOf<
ApmRoutes,
'/backends/{backendName}/overview'
>['query'],
const detailsUrl = apmRouter.link('/backends/overview', {
query: {
...query,
backendName,
} as TypeOf<ApmRoutes, '/backends/overview'>['query'],
});

const trackEvent = useUiTracker();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,10 @@ export function ServiceOverviewDependenciesTable({
const itemLink =
location.type === NodeType.backend ? (
<BackendLink
backendName={location.backendName}
type={location.spanType}
subtype={location.spanSubtype}
query={{
backendName: location.backendName,
comparisonEnabled,
comparisonType,
environment,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,10 @@ export function StickySpanProperties({ span, transaction }: Props) {
fieldName: SPAN_DESTINATION_SERVICE_RESOURCE,
val: (
<BackendLink
backendName={backendName}
query={query}
query={{
...query,
backendName,
}}
subtype={span.span.subtype}
type={span.span.type}
onClick={() => {
Expand Down
Loading

0 comments on commit 5f70fc6

Please sign in to comment.