mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
Drop explicit type annotations, fix typing (#113230)
This commit is contained in:
parent
f7120d9fe4
commit
93debf4b52
6 changed files with 18 additions and 13 deletions
|
@ -25,6 +25,7 @@ import { CorrelationsOptions, getCorrelationsFilters } from '../get_filters';
|
|||
|
||||
interface Options extends CorrelationsOptions {
|
||||
fieldNames: string[];
|
||||
setup: Setup;
|
||||
}
|
||||
export async function getCorrelationsForFailedTransactions(options: Options) {
|
||||
const { fieldNames, setup, start, end } = options;
|
||||
|
|
|
@ -11,9 +11,14 @@ import {
|
|||
getTimeseriesAggregation,
|
||||
getFailedTransactionRateTimeSeries,
|
||||
} from '../../helpers/transaction_error_rate';
|
||||
import { Setup } from '../../helpers/setup_request';
|
||||
import { CorrelationsOptions, getCorrelationsFilters } from '../get_filters';
|
||||
|
||||
export async function getOverallErrorTimeseries(options: CorrelationsOptions) {
|
||||
interface Options extends CorrelationsOptions {
|
||||
setup: Setup;
|
||||
}
|
||||
|
||||
export async function getOverallErrorTimeseries(options: Options) {
|
||||
const { setup, start, end } = options;
|
||||
const filters = getCorrelationsFilters(options);
|
||||
const { apmEventClient } = setup;
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { Setup } from '../helpers/setup_request';
|
||||
import { ESFilter } from '../../../../../../src/core/types/elasticsearch';
|
||||
import { rangeQuery, kqlQuery } from '../../../../observability/server';
|
||||
import { environmentQuery } from '../../../common/utils/environment_query';
|
||||
|
@ -18,7 +17,6 @@ import {
|
|||
import { ProcessorEvent } from '../../../common/processor_event';
|
||||
|
||||
export interface CorrelationsOptions {
|
||||
setup: Setup;
|
||||
environment: string;
|
||||
kuery: string;
|
||||
serviceName: string | undefined;
|
||||
|
@ -29,7 +27,6 @@ export interface CorrelationsOptions {
|
|||
}
|
||||
|
||||
export function getCorrelationsFilters({
|
||||
setup,
|
||||
environment,
|
||||
kuery,
|
||||
serviceName,
|
||||
|
|
|
@ -13,12 +13,14 @@ import { processSignificantTermAggs } from '../process_significant_term_aggs';
|
|||
import { getLatencyDistribution } from './get_latency_distribution';
|
||||
import { withApmSpan } from '../../../utils/with_apm_span';
|
||||
import { CorrelationsOptions, getCorrelationsFilters } from '../get_filters';
|
||||
import { Setup } from '../../helpers/setup_request';
|
||||
|
||||
interface Options extends CorrelationsOptions {
|
||||
durationPercentile: number;
|
||||
fieldNames: string[];
|
||||
maxLatency: number;
|
||||
distributionInterval: number;
|
||||
setup: Setup;
|
||||
}
|
||||
export async function getCorrelationsForSlowTransactions(options: Options) {
|
||||
return withApmSpan('get_correlations_for_slow_transactions', async () => {
|
||||
|
|
|
@ -11,8 +11,12 @@ import { ProcessorEvent } from '../../../../common/processor_event';
|
|||
import { getMaxLatency } from './get_max_latency';
|
||||
import { withApmSpan } from '../../../utils/with_apm_span';
|
||||
import { CorrelationsOptions, getCorrelationsFilters } from '../get_filters';
|
||||
import { Setup } from '../../helpers/setup_request';
|
||||
|
||||
export const INTERVAL_BUCKETS = 15;
|
||||
interface Options extends CorrelationsOptions {
|
||||
setup: Setup;
|
||||
}
|
||||
|
||||
export function getDistributionAggregation(
|
||||
maxLatency: number,
|
||||
|
@ -37,9 +41,7 @@ export function getDistributionAggregation(
|
|||
};
|
||||
}
|
||||
|
||||
export async function getOverallLatencyDistribution(
|
||||
options: CorrelationsOptions
|
||||
) {
|
||||
export async function getOverallLatencyDistribution(options: Options) {
|
||||
const { setup } = options;
|
||||
const filters = getCorrelationsFilters(options);
|
||||
|
||||
|
|
|
@ -16,7 +16,6 @@ import type {
|
|||
} from '../../../../common/search_strategies/types';
|
||||
import { rangeRt } from '../../../routes/default_api_types';
|
||||
import { getCorrelationsFilters } from '../../correlations/get_filters';
|
||||
import { Setup } from '../../helpers/setup_request';
|
||||
|
||||
export const getTermsQuery = ({ fieldName, fieldValue }: FieldValuePair) => {
|
||||
return { term: { [fieldName]: fieldValue } };
|
||||
|
@ -38,22 +37,21 @@ export const getQueryWithParams = ({ params, termFilters }: QueryParams) => {
|
|||
} = params;
|
||||
|
||||
// converts string based start/end to epochmillis
|
||||
const setup = pipe(
|
||||
const decodedRange = pipe(
|
||||
rangeRt.decode({ start, end }),
|
||||
getOrElse<t.Errors, { start: number; end: number }>((errors) => {
|
||||
throw new Error(failure(errors).join('\n'));
|
||||
})
|
||||
) as Setup & { start: number; end: number };
|
||||
);
|
||||
|
||||
const correlationFilters = getCorrelationsFilters({
|
||||
setup,
|
||||
environment,
|
||||
kuery,
|
||||
serviceName,
|
||||
transactionType,
|
||||
transactionName,
|
||||
start: setup.start,
|
||||
end: setup.end,
|
||||
start: decodedRange.start,
|
||||
end: decodedRange.end,
|
||||
});
|
||||
|
||||
return {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue