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

[Observability] Change appLink passing the date range #71259

Merged
merged 13 commits into from
Jul 14, 2020
4 changes: 2 additions & 2 deletions x-pack/plugins/apm/server/routes/create_apm_api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ import {
} from './rum_client';
import {
observabilityOverviewHasDataRoute,
observabilityOverviewDataRoute,
observabilityOverviewRoute,
} from './observability_overview';
import {
anomalyDetectionJobsRoute,
Expand Down Expand Up @@ -177,7 +177,7 @@ const createApmApi = () => {

// Observability dashboard
.add(observabilityOverviewHasDataRoute)
.add(observabilityOverviewDataRoute)
.add(observabilityOverviewRoute)

// Anomaly detection
.add(anomalyDetectionJobsRoute)
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/apm/server/routes/observability_overview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const observabilityOverviewHasDataRoute = createRoute(() => ({
},
}));

export const observabilityOverviewDataRoute = createRoute(() => ({
export const observabilityOverviewRoute = createRoute(() => ({
path: '/api/apm/observability_overview',
params: {
query: t.intersection([rangeRt, t.type({ bucketSize: t.string })]),
Expand Down
1 change: 0 additions & 1 deletion x-pack/plugins/infra/public/metrics_overview_fetchers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
*/

import { isFinite, isNumber, sum } from 'lodash';
import moment from 'moment';
import { FetchDataParams, MetricsFetchDataResponse } from '../../observability/public';
import {
SnapshotMetricInput,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import * as fetcherHook from '../../../../hooks/use_fetcher';
import { render } from '../../../../utils/test_helper';
import { APMSection } from './';
import { response } from './mock_data/apm.mock';
import moment from 'moment';

describe('APMSection', () => {
it('renders with transaction series and stats', () => {
Expand All @@ -18,7 +19,10 @@ describe('APMSection', () => {
});
const { getByText, queryAllByTestId } = render(
<APMSection
absoluteTime={{ start: '2020-06-29T11:38:23.747Z', end: '2020-06-29T12:08:23.748Z' }}
absoluteTime={{
start: moment('2020-06-29T11:38:23.747Z').valueOf(),
end: moment('2020-06-29T12:08:23.748Z').valueOf(),
}}
relativeTime={{ start: 'now-15m', end: 'now' }}
bucketSize="60s"
/>
Expand All @@ -38,7 +42,10 @@ describe('APMSection', () => {
});
const { getByText, queryAllByText, getByTestId } = render(
<APMSection
absoluteTime={{ start: '2020-06-29T11:38:23.747Z', end: '2020-06-29T12:08:23.748Z' }}
absoluteTime={{
start: moment('2020-06-29T11:38:23.747Z').valueOf(),
end: moment('2020-06-29T12:08:23.748Z').valueOf(),
}}
relativeTime={{ start: 'now-15m', end: 'now' }}
bucketSize="60s"
/>
Expand Down
5 changes: 3 additions & 2 deletions x-pack/plugins/observability/public/data_handler.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
* you may not use this file except in compliance with the Elastic License.
*/
import { registerDataHandler, getDataHandler } from './data_handler';
import moment from 'moment';

const params = {
absoluteTime: {
start: '2020-07-02T13:25:11.629Z',
end: '2020-07-09T13:25:11.629Z',
start: moment('2020-07-02T13:25:11.629Z').valueOf(),
end: moment('2020-07-09T13:25:11.629Z').valueOf(),
},
relativeTime: {
start: 'now-15m',
Expand Down
5 changes: 2 additions & 3 deletions x-pack/plugins/observability/public/pages/overview/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
* you may not use this file except in compliance with the Elastic License.
*/
import { EuiFlexGrid, EuiFlexGroup, EuiFlexItem, EuiHorizontalRule, EuiSpacer } from '@elastic/eui';
import moment from 'moment';
import React, { useContext } from 'react';
import { ThemeContext } from 'styled-components';
import { EmptySection } from '../../components/app/empty_section';
Expand Down Expand Up @@ -66,8 +65,8 @@ export const OverviewPage = ({ routeParams }: Props) => {
};

const absoluteTime = {
start: moment.utc(getAbsoluteTime(relativeTime.start)).valueOf(),
end: moment.utc(getAbsoluteTime(relativeTime.end, { roundUp: true })).valueOf(),
start: getAbsoluteTime(relativeTime.start),
end: getAbsoluteTime(relativeTime.end, { roundUp: true }),
};

const bucketSize = calculatetBucketSize({
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/observability/public/utils/date.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export function getAbsoluteTime(range?: string, opts = {}) {
if (range) {
cauemarcondes marked this conversation as resolved.
Show resolved Hide resolved
const parsed = datemath.parse(range, opts);
if (parsed) {
return parsed.toISOString();
return parsed.valueOf();
}
}
}