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

[APM][RUM] adjust data types for uiFilters and range in APM requests #99257

Merged
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