Skip to content

Commit

Permalink
[APM][RUM] adjust data types for uiFilters and range in APM requests (e…
Browse files Browse the repository at this point in the history
…lastic#99257)

* update has_rum_data api query types

Co-authored-by: Kibana Machine <[email protected]>
  • Loading branch information
2 people authored and yctercero committed May 25, 2021
1 parent a3c7a4e commit d98feba
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
6 changes: 5 additions & 1 deletion x-pack/plugins/apm/server/lib/rum_client/has_rum_data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ import { ProcessorEvent } from '../../../common/processor_event';
import { rangeQuery } from '../../../server/utils/queries';
import { TRANSACTION_PAGE_LOAD } from '../../../common/transaction_types';

export async function hasRumData({ setup }: { setup: Setup & SetupTimeRange }) {
export async function hasRumData({
setup,
}: {
setup: Setup & Partial<SetupTimeRange>;
}) {
try {
const { start, end } = setup;

Expand Down
7 changes: 6 additions & 1 deletion x-pack/plugins/apm/server/routes/rum_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import * as t from 'io-ts';
import { jsonRt } from '@kbn/io-ts-utils';
import { isoToEpochRt } from '@kbn/io-ts-utils';
import { LocalUIFilterName } from '../../common/ui_filter';
import {
Setup,
Expand Down Expand Up @@ -264,7 +265,11 @@ const rumJSErrors = createApmServerRoute({
const rumHasDataRoute = createApmServerRoute({
endpoint: 'GET /api/apm/observability_overview/has_rum_data',
params: t.partial({
query: t.intersection([uiFiltersRt, rangeRt]),
query: t.partial({
uiFilters: t.string,
start: isoToEpochRt,
end: isoToEpochRt,
}),
}),
options: { tags: ['access:apm'] },
handler: async (resources) => {
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/observability/server/utils/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import { QueryContainer } from '@elastic/elasticsearch/api/types';
import { esKuery } from '../../../../../src/plugins/data/server';

export function rangeQuery(start: number, end: number, field = '@timestamp'): QueryContainer[] {
export function rangeQuery(start?: number, end?: number, field = '@timestamp'): QueryContainer[] {
return [
{
range: {
Expand Down

0 comments on commit d98feba

Please sign in to comment.