Add consistent-type-imports eslint rule in obs-ux-infra_services-team owned plugins (#204549)

Closes #204412

## Summary

This PR enforces `consistent-type-imports` eslint rule in
`x-pack/solutions/observability/plugins/*` plugins owned by
`obs-ux-infra_services-team`.

Detailed list of plugins:
- `x-pack/solutions/observability/plugins/apm`,
- `x-pack/solutions/observability/plugins/apm_data_access`,
- `x-pack/solutions/observability/plugins/infra`,
- `x-pack/solutions/observability/plugins/inventory`,
- `x-pack/solutions/observability/plugins/metrics_data_access`,
- `x-pack/solutions/observability/plugins/profiling`,
- `x-pack/solutions/observability/plugins/profiling_data_access`

Script for fixing eslint rules in above plugins:
```bash
yarn eslint --no-error-on-unmatched-pattern --quiet --fix "x-pack/solutions/observability/plugins/apm/**/*.{js,mjs,ts,tsx}" "x-pack/solutions/observability/plugins/apm_data_access/**/*.{js,mjs,ts,tsx}" "x-pack/solutions/observability/plugins/infra/**/*.{js,mjs,ts,tsx}" "x-pack/solutions/observability/plugins/inventory/**/*.{js,mjs,ts,tsx}" "x-pack/solutions/observability/plugins/metrics_data_access/**/*.{js,mjs,ts,tsx}" "x-pack/solutions/observability/plugins/profiling/**/*.{js,mjs,ts,tsx}" "x-pack/solutions/observability/plugins/profiling_data_access/**/*.{js,mjs,ts,tsx}"
```

## Results

The affected plugins have been profiled using `node
scripts/build_kibana_platform_plugins.js --dist --profile --focus=apm
--no-cache` command and bundle size checked manually (`du -s` command).

#### APM plugin
Zero benefits in terms of size.
<img width="1728" alt="Screenshot 2024-12-19 at 12 18 36"
src="https://github.com/user-attachments/assets/d86be5d8-a4ad-4d9c-bac1-110a0c6bba81"
/>

#### Infra plugin
Zero benefits in terms of size.
<img width="1728" alt="Screenshot 2024-12-19 at 12 56 08"
src="https://github.com/user-attachments/assets/410bc068-1f20-4de8-ac4e-89c74478ec59"
/>

#### Profiling plugin
Zero benefits in terms of size.
<img width="1725" alt="image"
src="https://github.com/user-attachments/assets/bf47c319-0716-4a5b-9858-94ce7d2a3251"
/>

## Conclusions

- Using [type-only
imports](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html#type-only-imports-and-export)
in Kibana doesn't provide any benefits in terms of bundle size,
- Possible safeguarding against edge-case TS errors
- avoiding unintentional side effects
([source](https://typescript-eslint.io/blog/consistent-type-imports-and-exports-why-and-how/#avoiding-unintentional-side-effects))
- circular dependency reference error
[(source)](https://stackoverflow.com/questions/40982927/using-import-type-statement-to-fix-circular-dependency-reference-error)
- Better ground for incoming tooling (improving performance, reliability
with type definition analysis),
- Clearer code intent.
This commit is contained in:
Milosz Marcinkowski 2025-01-02 14:30:47 +01:00 committed by GitHub
parent 1f8d841a57
commit 6461b7e26a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2080 changed files with 5256 additions and 5155 deletions

View file

@ -1024,6 +1024,20 @@ module.exports = {
],
},
},
{
files: [
'x-pack/solutions/observability/plugins/apm/**/*.{js,mjs,ts,tsx}',
'x-pack/solutions/observability/plugins/apm_data_access/**/*.{js,mjs,ts,tsx}',
'x-pack/solutions/observability/plugins/infra/**/*.{js,mjs,ts,tsx}',
'x-pack/solutions/observability/plugins/inventory/**/*.{js,mjs,ts,tsx}',
'x-pack/solutions/observability/plugins/metrics_data_access/**/*.{js,mjs,ts,tsx}',
'x-pack/solutions/observability/plugins/profiling/**/*.{js,mjs,ts,tsx}',
'x-pack/solutions/observability/plugins/profiling_data_access/**/*.{js,mjs,ts,tsx}',
],
rules: {
'@typescript-eslint/consistent-type-imports': 'error',
},
},
/**
* Fleet overrides

View file

@ -5,8 +5,8 @@
* 2.0.
*/
import t from 'io-ts';
import { agentConfigurationIntakeRt } from './runtime_types/agent_configuration_intake_rt';
import type t from 'io-ts';
import type { agentConfigurationIntakeRt } from './runtime_types/agent_configuration_intake_rt';
export type AgentConfigurationIntake = t.TypeOf<typeof agentConfigurationIntakeRt>;

View file

@ -7,7 +7,7 @@
import * as t from 'io-ts';
import { settingDefinitions } from '../setting_definitions';
import { SettingValidation } from '../setting_definitions/types';
import type { SettingValidation } from '../setting_definitions/types';
// retrieve validation from config definitions settings and validate on the server
const knownSettings = settingDefinitions.reduce<Record<string, SettingValidation>>(

View file

@ -7,8 +7,10 @@
import * as t from 'io-ts';
import { either } from 'fp-ts/lib/Either';
import moment, { unitOfTime } from 'moment';
import { amountAndUnitToObject, AmountAndUnit } from '../amount_and_unit';
import type { unitOfTime } from 'moment';
import moment from 'moment';
import type { AmountAndUnit } from '../amount_and_unit';
import { amountAndUnitToObject } from '../amount_and_unit';
import { getRangeTypeMessage } from './get_range_type_message';
function toMilliseconds({ amount, unit }: AmountAndUnit) {

View file

@ -10,7 +10,7 @@ import { captureBodyRt } from '../runtime_types/capture_body_rt';
import { logLevelRt } from '../runtime_types/log_level_rt';
import { logEcsReformattingRt } from '../runtime_types/log_ecs_reformatting_rt';
import { traceContinuationStrategyRt } from '../runtime_types/trace_continuation_strategy_rt';
import { RawSettingDefinition } from './types';
import type { RawSettingDefinition } from './types';
export const generalSettings: RawSettingDefinition[] = [
// API Request Size

View file

@ -7,8 +7,8 @@
import { omit } from 'lodash';
import { filterByAgent, settingDefinitions } from '.';
import { AgentName } from '../../../typings/es_schemas/ui/fields/agent';
import { SettingDefinition } from './types';
import type { AgentName } from '../../../typings/es_schemas/ui/fields/agent';
import type { SettingDefinition } from './types';
describe('filterByAgent', () => {
describe('when `excludeAgents` is dotnet and nodejs', () => {

View file

@ -9,13 +9,13 @@ import * as t from 'io-ts';
import { sortBy } from 'lodash';
import { isRight } from 'fp-ts/lib/Either';
import { PathReporter } from 'io-ts/lib/PathReporter';
import { AgentName } from '../../../typings/es_schemas/ui/fields/agent';
import type { AgentName } from '../../../typings/es_schemas/ui/fields/agent';
import { booleanRt } from '../runtime_types/boolean_rt';
import { getIntegerRt } from '../runtime_types/integer_rt';
import { isRumOrMobileAgentName } from '../../agent_name';
import { floatThreeDecimalPlacesRt } from '../runtime_types/float_three_decimal_places_rt';
import { floatFourDecimalPlacesRt } from '../runtime_types/float_four_decimal_places_rt';
import { RawSettingDefinition, SettingDefinition } from './types';
import type { RawSettingDefinition, SettingDefinition } from './types';
import { generalSettings } from './general_settings';
import { javaSettings } from './java_settings';
import { mobileSettings } from './mobile_settings';

View file

@ -6,7 +6,7 @@
*/
import { i18n } from '@kbn/i18n';
import { RawSettingDefinition } from './types';
import type { RawSettingDefinition } from './types';
export const javaSettings: RawSettingDefinition[] = [
{

View file

@ -6,7 +6,7 @@
*/
import { i18n } from '@kbn/i18n';
import { RawSettingDefinition } from './types';
import type { RawSettingDefinition } from './types';
export const mobileSettings: RawSettingDefinition[] = [
// Session sample rate

View file

@ -5,8 +5,8 @@
* 2.0.
*/
import * as t from 'io-ts';
import { AgentName } from '../../../typings/es_schemas/ui/fields/agent';
import type * as t from 'io-ts';
import type { AgentName } from '../../../typings/es_schemas/ui/fields/agent';
// TODO: is it possible to get rid of `any`?
export type SettingValidation = t.Type<any, string, unknown>;

View file

@ -4,8 +4,8 @@
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { DATAFEED_STATE, JOB_STATE } from '@kbn/ml-plugin/common';
import { Environment } from '../environment_rt';
import type { DATAFEED_STATE, JOB_STATE } from '@kbn/ml-plugin/common';
import type { Environment } from '../environment_rt';
export interface ApmMlJob {
environment: Environment;

View file

@ -6,10 +6,10 @@
*/
import { v4 as uuidv4 } from 'uuid';
import { ENVIRONMENT_ALL } from '../environment_filter_values';
import { Environment } from '../environment_rt';
import type { Environment } from '../environment_rt';
import { AnomalyDetectorType } from './apm_ml_detectors';
import { getPreferredServiceAnomalyTimeseries } from './get_preferred_service_anomaly_timeseries';
import { ServiceAnomalyTimeseries } from './service_anomaly_timeseries';
import type { ServiceAnomalyTimeseries } from './service_anomaly_timeseries';
const PROD = 'production' as Environment;
const DEV = 'development' as Environment;

View file

@ -5,9 +5,9 @@
* 2.0.
*/
import { Environment } from '../environment_rt';
import { AnomalyDetectorType } from './apm_ml_detectors';
import { ServiceAnomalyTimeseries } from './service_anomaly_timeseries';
import type { Environment } from '../environment_rt';
import type { AnomalyDetectorType } from './apm_ml_detectors';
import type { ServiceAnomalyTimeseries } from './service_anomaly_timeseries';
export function getPreferredServiceAnomalyTimeseries({
preferredEnvironment,

View file

@ -9,7 +9,7 @@ import { i18n } from '@kbn/i18n';
import { getSeverityType } from '@kbn/ml-anomaly-utils/get_severity_type';
import { getSeverityColor as mlGetSeverityColor } from '@kbn/ml-anomaly-utils/get_severity_color';
import { ML_ANOMALY_SEVERITY } from '@kbn/ml-anomaly-utils/anomaly_severity';
import { ServiceHealthStatus } from '../service_health_status';
import type { ServiceHealthStatus } from '../service_health_status';
export interface ServiceAnomalyStats {
transactionType?: string;

View file

@ -5,8 +5,8 @@
* 2.0.
*/
import { Coordinate } from '../../typings/timeseries';
import { AnomalyDetectorType } from './apm_ml_detectors';
import type { Coordinate } from '../../typings/timeseries';
import type { AnomalyDetectorType } from './apm_ml_detectors';
export interface ServiceAnomalyTimeseries {
jobId: string;

View file

@ -4,8 +4,8 @@
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { AgentName } from '../typings/es_schemas/ui/fields/agent';
import { Coordinate } from '../typings/timeseries';
import type { AgentName } from '../typings/es_schemas/ui/fields/agent';
import type { Coordinate } from '../typings/timeseries';
export enum NodeType {
service = 'service',

View file

@ -5,9 +5,9 @@
* 2.0.
*/
import { FieldValuePair, HistogramItem } from '../types';
import type { FieldValuePair, HistogramItem } from '../types';
import { CORRELATIONS_IMPACT_THRESHOLD } from './constants';
import type { CORRELATIONS_IMPACT_THRESHOLD } from './constants';
export interface FailedTransactionsCorrelation extends FieldValuePair {
doc_count: number;

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import { FieldValuePair, HistogramItem } from '../types';
import type { FieldValuePair, HistogramItem } from '../types';
export interface LatencyCorrelation extends FieldValuePair {
correlation: number;

View file

@ -5,8 +5,8 @@
* 2.0.
*/
import { QueryDslQueryContainer } from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
import { Environment } from '../environment_rt';
import type { QueryDslQueryContainer } from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
import type { Environment } from '../environment_rt';
export interface FieldValuePair {
fieldName: string;

View file

@ -4,10 +4,11 @@
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { apm, ApmFields, dedot } from '@kbn/apm-synthtrace-client';
import type { ApmFields } from '@kbn/apm-synthtrace-client';
import { apm, dedot } from '@kbn/apm-synthtrace-client';
import { getWaterfall } from '../../public/components/app/transaction_details/waterfall_with_summary/waterfall_container/waterfall/waterfall_helpers/waterfall_helpers';
import { Span } from '../../typings/es_schemas/ui/span';
import { Transaction } from '../../typings/es_schemas/ui/transaction';
import type { Span } from '../../typings/es_schemas/ui/span';
import type { Transaction } from '../../typings/es_schemas/ui/transaction';
import { getCriticalPath } from './get_critical_path';
describe('getCriticalPath', () => {

View file

@ -9,7 +9,7 @@ import type {
IWaterfall,
IWaterfallSpanOrTransaction,
} from '../../public/components/app/transaction_details/waterfall_with_summary/waterfall_container/waterfall/waterfall_helpers/waterfall_helpers';
import { CriticalPath, CriticalPathSegment } from './types';
import type { CriticalPath, CriticalPathSegment } from './types';
export function getCriticalPath(waterfall: IWaterfall): CriticalPath {
const segments: CriticalPathSegment[] = [];

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import { extractTemplateVariableNames, getEncodedCustomLinkUrl } from '.';
import { Transaction } from '../../typings/es_schemas/ui/transaction';
import type { Transaction } from '../../typings/es_schemas/ui/transaction';
describe('Custom link', () => {
describe('extractTemplateVariableNames', () => {

View file

@ -5,13 +5,13 @@
* 2.0.
*/
import {
import type {
SERVICE_NAME,
SERVICE_ENVIRONMENT,
TRANSACTION_NAME,
TRANSACTION_TYPE,
} from '../es_fields/apm';
import { FILTER_OPTIONS } from './custom_link_filter_options';
import type { FILTER_OPTIONS } from './custom_link_filter_options';
export interface CustomLinkES {
id?: string;

View file

@ -9,7 +9,7 @@ import { i18n } from '@kbn/i18n';
import { get } from 'lodash';
import { set } from '@kbn/safer-lodash-set';
import Mustache from 'mustache';
import { Transaction } from '../../typings/es_schemas/ui/transaction';
import type { Transaction } from '../../typings/es_schemas/ui/transaction';
export const INVALID_LICENSE = i18n.translate('xpack.apm.settings.customLink.license.text', {
defaultMessage:

View file

@ -8,7 +8,7 @@
import { i18n } from '@kbn/i18n';
import { escapeKuery } from '@kbn/es-query';
import { SERVICE_ENVIRONMENT } from './es_fields/apm';
import { Environment } from './environment_rt';
import type { Environment } from './environment_rt';
export const ENVIRONMENT_ALL_VALUE = 'ENVIRONMENT_ALL' as const;
const ENVIRONMENT_NOT_DEFINED_VALUE = 'ENVIRONMENT_NOT_DEFINED' as const;

View file

@ -6,10 +6,10 @@
*/
import { get } from 'lodash';
import { AllowUnknownProperties } from '../../typings/common';
import { APMError } from '../../typings/es_schemas/ui/apm_error';
import { Span } from '../../typings/es_schemas/ui/span';
import { Transaction } from '../../typings/es_schemas/ui/transaction';
import type { AllowUnknownProperties } from '../../typings/common';
import type { APMError } from '../../typings/es_schemas/ui/apm_error';
import type { Span } from '../../typings/es_schemas/ui/span';
import type { Transaction } from '../../typings/es_schemas/ui/transaction';
import * as allApmFieldNames from './apm';
import * as infraMetricsFieldNames from './infra_metrics';

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import { ILicense, LicenseType } from '@kbn/licensing-plugin/common/types';
import type { ILicense, LicenseType } from '@kbn/licensing-plugin/common/types';
function isActiveLicense(licenseType: LicenseType, license?: ILicense) {
return license && license.isActive && license.hasAtLeast(licenseType);

View file

@ -5,9 +5,10 @@
* 2.0.
*/
import { schema, TypeOf } from '@kbn/config-schema';
import type { TypeOf } from '@kbn/config-schema';
import { schema } from '@kbn/config-schema';
import { ML_ANOMALY_SEVERITY } from '@kbn/ml-anomaly-utils/anomaly_severity';
import { ApmRuleType } from '@kbn/rule-data-utils';
import type { ApmRuleType } from '@kbn/rule-data-utils';
import { AnomalyDetectorType } from '../anomaly_detection/apm_ml_detectors';
import { AggregationType } from './apm_rule_types';

View file

@ -5,8 +5,8 @@
* 2.0.
*/
import { AgentName } from '@kbn/elastic-agent-utils';
import { ServiceHealthStatus } from './service_health_status';
import type { AgentName } from '@kbn/elastic-agent-utils';
import type { ServiceHealthStatus } from './service_health_status';
export interface ServiceListItem {
serviceName: string;

View file

@ -6,9 +6,9 @@
*/
import { i18n } from '@kbn/i18n';
import cytoscape from 'cytoscape';
import { Coordinate } from '../typings/timeseries';
import { ServiceAnomalyStats } from './anomaly_detection';
import type cytoscape from 'cytoscape';
import type { Coordinate } from '../typings/timeseries';
import type { ServiceAnomalyStats } from './anomaly_detection';
// These should be imported, but until TypeScript 4.2 we're inlining them here.
// All instances of "agent.name", "service.name", "service.environment", "span.type",

View file

@ -5,8 +5,8 @@
* 2.0.
*/
import { AgentName } from '../typings/es_schemas/ui/fields/agent';
import { Environment } from './environment_rt';
import type { AgentName } from '../typings/es_schemas/ui/fields/agent';
import type { Environment } from './environment_rt';
export interface SpanLinkDetails {
traceId: string;

View file

@ -6,7 +6,7 @@
*/
import { i18n } from '@kbn/i18n';
import { CustomIntegration } from '@kbn/custom-integrations-plugin/common';
import type { CustomIntegration } from '@kbn/custom-integrations-plugin/common';
const APM_INTEGRATION_CATEGORIES = ['observability', 'apm'];

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import { ValuesType } from 'utility-types';
import type { ValuesType } from 'utility-types';
// work around a TypeScript limitation described in https://stackoverflow.com/posts/49511416

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import { QueryDslQueryContainer } from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
import type { QueryDslQueryContainer } from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
import { SERVICE_ENVIRONMENT, SERVICE_NODE_NAME } from '../es_fields/apm';
import { ENVIRONMENT_ALL, ENVIRONMENT_NOT_DEFINED } from '../environment_filter_values';
import { SERVICE_NODE_NAME_MISSING } from '../service_nodes';

View file

@ -6,7 +6,7 @@
*/
import { compact, isObject } from 'lodash';
import { Maybe } from '../../typings/common';
import type { Maybe } from '../../typings/common';
export interface KeyValuePair {
key: string;

View file

@ -10,8 +10,8 @@ import moment from 'moment';
import { memoize } from 'lodash';
import { NOT_AVAILABLE_LABEL } from '../../i18n';
import { asDecimalOrInteger, asInteger, asDecimal } from './formatters';
import { TimeUnit } from './datetime';
import { Maybe } from '../../../typings/common';
import type { TimeUnit } from './datetime';
import type { Maybe } from '../../../typings/common';
import { isFiniteNumber } from '../is_finite_number';
interface FormatterOptions {

View file

@ -7,7 +7,7 @@
import { asPercent as obltAsPercent } from '@kbn/observability-plugin/common';
import numeral from '@elastic/numeral';
import { Maybe } from '../../../typings/common';
import type { Maybe } from '../../../typings/common';
import { NOT_AVAILABLE_LABEL } from '../../i18n';
import { isFiniteNumber } from '../is_finite_number';

View file

@ -7,7 +7,7 @@
import { memoize } from 'lodash';
import { asDecimal } from './formatters';
import { Maybe } from '../../../typings/common';
import type { Maybe } from '../../../typings/common';
function asKilobytes(value: number) {
return `${asDecimal(value / 1000)} KB`;

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import { UnionToIntersection, ValuesType } from 'utility-types';
import type { UnionToIntersection, ValuesType } from 'utility-types';
import { merge, castArray } from 'lodash';
import stableStringify from 'json-stable-stringify';

View file

@ -4,7 +4,7 @@
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { Coordinate } from '../../typings/timeseries';
import type { Coordinate } from '../../typings/timeseries';
import { offsetPreviousPeriodCoordinates } from './offset_previous_period_coordinate';
const currentPeriodTimeseries: Coordinate[] = [

View file

@ -6,7 +6,7 @@
*/
import moment from 'moment';
import { Coordinate } from '../../typings/timeseries';
import type { Coordinate } from '../../typings/timeseries';
export function offsetPreviousPeriodCoordinates({
currentPeriodTimeseries,

View file

@ -5,11 +5,11 @@
* 2.0.
*/
import { Exception } from '../../typings/es_schemas/raw/error_raw';
import { EventOutcome } from '../../typings/es_schemas/raw/fields/event_outcome';
import { SpanLink } from '../../typings/es_schemas/raw/fields/span_links';
import { TimestampUs } from '../../typings/es_schemas/raw/fields/timestamp_us';
import { AgentName } from '../../typings/es_schemas/ui/fields/agent';
import type { Exception } from '../../typings/es_schemas/raw/error_raw';
import type { EventOutcome } from '../../typings/es_schemas/raw/fields/event_outcome';
import type { SpanLink } from '../../typings/es_schemas/raw/fields/span_links';
import type { TimestampUs } from '../../typings/es_schemas/raw/fields/timestamp_us';
import type { AgentName } from '../../typings/es_schemas/ui/fields/agent';
export interface WaterfallTransaction {
timestamp: TimestampUs;

View file

@ -5,7 +5,8 @@
* 2.0.
*/
import { apm, Instance, timerange } from '@kbn/apm-synthtrace-client';
import type { Instance } from '@kbn/apm-synthtrace-client';
import { apm, timerange } from '@kbn/apm-synthtrace-client';
const MAX_DEPENDENCIES = 10000;
const MAX_DEPENDENCIES_PER_SERVICE = 500;

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import { apm, timerange } from '@kbn/apm-synthtrace-client';
import { SpanLink } from '@kbn/apm-plugin/typings/es_schemas/raw/fields/span_links';
import type { SpanLink } from '@kbn/apm-plugin/typings/es_schemas/raw/fields/span_links';
import { synthtrace } from '../../../synthtrace';
function getProducerInternalOnly() {

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import 'cypress-real-events/support';
import { Interception } from 'cypress/types/net-stubbing';
import type { Interception } from 'cypress/types/net-stubbing';
import 'cypress-axe';
import moment from 'moment';
import '@frsource/cypress-plugin-visual-regression-diff';

View file

@ -10,7 +10,7 @@ import cypress from 'cypress';
import path from 'path';
import Url from 'url';
import { createApmUsers } from '@kbn/apm-plugin/server/test_helpers/create_apm_users/create_apm_users';
import { FtrProviderContext } from './ftr_provider_context';
import type { FtrProviderContext } from './ftr_provider_context';
export async function cypressTestRunner({ getService }: FtrProviderContext) {
const config = getService('config');

View file

@ -5,12 +5,12 @@
* 2.0.
*/
import { FtrConfigProviderContext } from '@kbn/test';
import type { FtrConfigProviderContext } from '@kbn/test';
import { CA_CERT_PATH } from '@kbn/dev-utils';
import { commonFunctionalServices } from '@kbn/ftr-common-functional-services';
import { commonFunctionalUIServices } from '@kbn/ftr-common-functional-ui-services';
import { cypressTestRunner } from './cypress_test_runner';
import { FtrProviderContext } from './ftr_provider_context';
import type { FtrProviderContext } from './ftr_provider_context';
async function ftrConfig({ readConfigFile }: FtrConfigProviderContext) {
const kibanaCommonTestsConfig = await readConfigFile(

View file

@ -5,6 +5,6 @@
* 2.0.
*/
import { GenericFtrProviderContext } from '@kbn/test';
import type { GenericFtrProviderContext } from '@kbn/test';
export type FtrProviderContext = GenericFtrProviderContext<{}, {}>;

View file

@ -8,11 +8,12 @@
import React from 'react';
import ReactDOM from 'react-dom';
import type { ObservabilityRuleTypeRegistry } from '@kbn/observability-plugin/public';
import { AppMountParameters, CoreStart, APP_WRAPPER_CLASS } from '@kbn/core/public';
import type { AppMountParameters, CoreStart } from '@kbn/core/public';
import { APP_WRAPPER_CLASS } from '@kbn/core/public';
import { KibanaRenderContextProvider } from '@kbn/react-kibana-context-render';
import { KibanaThemeProvider } from '@kbn/react-kibana-context-theme';
import { ConfigSchema } from '..';
import { ApmPluginSetupDeps, ApmPluginStartDeps, ApmServices } from '../plugin';
import type { ConfigSchema } from '..';
import type { ApmPluginSetupDeps, ApmPluginStartDeps, ApmServices } from '../plugin';
import { createCallApmApi } from '../services/rest/create_call_apm_api';
import { setHelpExtension } from '../set_help_extension';
import { setReadonlyBadge } from '../update_badge';

View file

@ -19,7 +19,7 @@ import type {
GetApmTimeseriesFunctionArguments,
GetApmTimeseriesFunctionResponse,
} from '../../server/assistant_functions/get_apm_timeseries';
import { Coordinate, TimeSeries } from '../../typings/timeseries';
import type { Coordinate, TimeSeries } from '../../typings/timeseries';
import {
ChartType,
getTimeSeriesColor,

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import { RegisterRenderFunctionDefinition } from '@kbn/observability-ai-assistant-plugin/public/types';
import type { RegisterRenderFunctionDefinition } from '@kbn/observability-ai-assistant-plugin/public/types';
import { registerGetApmTimeseriesFunction } from './get_apm_timeseries';
export async function registerAssistantFunctions({

View file

@ -9,7 +9,7 @@ import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n-react';
import { defaults, omit } from 'lodash';
import React, { useEffect } from 'react';
import { CoreStart } from '@kbn/core/public';
import type { CoreStart } from '@kbn/core/public';
import { useKibana } from '@kbn/kibana-react-plugin/public';
import { TIME_UNITS } from '@kbn/triggers-actions-ui-plugin/public';
import { ML_ANOMALY_SEVERITY } from '@kbn/ml-anomaly-utils/anomaly_severity';
@ -17,7 +17,7 @@ import { EuiText } from '@elastic/eui';
import { ENVIRONMENT_ALL } from '../../../../../common/environment_filter_values';
import { createCallApmApi } from '../../../../services/rest/create_call_apm_api';
import { EnvironmentField, ServiceField, TransactionTypeField } from '../../utils/fields';
import { AlertMetadata } from '../../utils/helper';
import type { AlertMetadata } from '../../utils/helper';
import { ApmRuleParamsContainer } from '../../ui_components/apm_rule_params_container';
import { PopoverExpression } from '../../ui_components/popover_expression';
import { AnomalySeverity, SelectAnomalySeverity } from './select_anomaly_severity';
@ -26,7 +26,7 @@ import {
ANOMALY_DETECTOR_SELECTOR_OPTIONS,
getApmMlDetectorLabel,
} from '../../../../../common/rules/apm_rule_types';
import { AnomalyDetectorType } from '../../../../../common/anomaly_detection/apm_ml_detectors';
import type { AnomalyDetectorType } from '../../../../../common/anomaly_detection/apm_ml_detectors';
export interface AlertParams {
anomalySeverityType?:

View file

@ -6,9 +6,10 @@
*/
import React, { useCallback } from 'react';
import { EuiSelectable, EuiSelectableOption } from '@elastic/eui';
import type { EuiSelectableOption } from '@elastic/eui';
import { EuiSelectable } from '@elastic/eui';
import { ANOMALY_DETECTOR_SELECTOR_OPTIONS } from '../../../../../common/rules/apm_rule_types';
import { AnomalyDetectorType } from '../../../../../common/anomaly_detection/apm_ml_detectors';
import type { AnomalyDetectorType } from '../../../../../common/anomaly_detection/apm_ml_detectors';
interface Props {
values: AnomalyDetectorType[];

View file

@ -9,10 +9,8 @@ import React from 'react';
import { FormattedMessage } from '@kbn/i18n-react';
import { EuiHealth, EuiSpacer, EuiSuperSelect, EuiText } from '@elastic/eui';
import { getSeverityColor } from '../../../../../common/anomaly_detection';
import {
AnomalyAlertSeverityType,
ANOMALY_ALERT_SEVERITY_TYPES,
} from '../../../../../common/rules/apm_rule_types';
import type { AnomalyAlertSeverityType } from '../../../../../common/rules/apm_rule_types';
import { ANOMALY_ALERT_SEVERITY_TYPES } from '../../../../../common/rules/apm_rule_types';
export function AnomalySeverity({ type }: { type: AnomalyAlertSeverityType }) {
const selectedOption = ANOMALY_ALERT_SEVERITY_TYPES.find((option) => option.type === type)!;

View file

@ -5,16 +5,17 @@
* 2.0.
*/
import { Meta, Story } from '@storybook/react';
import type { Meta, Story } from '@storybook/react';
import React, { useState } from 'react';
import { CoreStart } from '@kbn/core/public';
import type { CoreStart } from '@kbn/core/public';
import { createKibanaReactContext } from '@kbn/kibana-react-plugin/public';
import { TIME_UNITS } from '@kbn/triggers-actions-ui-plugin/public';
import { __IntlProvider as IntlProvider } from '@kbn/i18n-react';
import { ErrorCountRuleParams, ErrorCountRuleType } from '.';
import type { ErrorCountRuleParams } from '.';
import { ErrorCountRuleType } from '.';
import { ENVIRONMENT_ALL } from '../../../../../common/environment_filter_values';
import { createCallApmApi } from '../../../../services/rest/create_call_apm_api';
import { AlertMetadata } from '../../utils/helper';
import type { AlertMetadata } from '../../utils/helper';
const coreMock = {
http: { get: async () => ({}) },

View file

@ -8,13 +8,13 @@
import { i18n } from '@kbn/i18n';
import { defaults, omit } from 'lodash';
import React, { useCallback, useEffect } from 'react';
import { CoreStart } from '@kbn/core/public';
import type { CoreStart } from '@kbn/core/public';
import { useKibana } from '@kbn/kibana-react-plugin/public';
import { ForLastExpression, TIME_UNITS } from '@kbn/triggers-actions-ui-plugin/public';
import { EuiFormRow } from '@elastic/eui';
import { EuiSpacer } from '@elastic/eui';
import { EuiSwitchEvent } from '@elastic/eui';
import { SearchConfigurationType } from '../../../../../common/rules/schema';
import type { EuiSwitchEvent } from '@elastic/eui';
import type { SearchConfigurationType } from '../../../../../common/rules/schema';
import { ENVIRONMENT_ALL } from '../../../../../common/environment_filter_values';
import { asInteger } from '../../../../../common/utils/formatters';
import { FETCH_STATUS, isPending, useFetcher } from '../../../../hooks/use_fetcher';
@ -26,7 +26,8 @@ import {
IsAboveField,
ServiceField,
} from '../../utils/fields';
import { AlertMetadata, getIntervalAndTimeRange } from '../../utils/helper';
import type { AlertMetadata } from '../../utils/helper';
import { getIntervalAndTimeRange } from '../../utils/helper';
import { ApmRuleParamsContainer } from '../../ui_components/apm_rule_params_container';
import { APMRuleGroupBy } from '../../ui_components/apm_rule_group_by';
import {

View file

@ -16,7 +16,7 @@ import {
transactionDurationMessage,
transactionErrorRateMessage,
} from '../../../../common/rules/default_action_message';
import { AlertParams } from './anomaly_rule_type';
import type { AlertParams } from './anomaly_rule_type';
// copied from elasticsearch_fieldnames.ts to limit page load bundle size
const SERVICE_ENVIRONMENT = 'service.environment';

View file

@ -5,13 +5,15 @@
* 2.0.
*/
import { Story } from '@storybook/react';
import React, { ComponentType, useState } from 'react';
import { CoreStart } from '@kbn/core/public';
import type { Story } from '@storybook/react';
import type { ComponentType } from 'react';
import React, { useState } from 'react';
import type { CoreStart } from '@kbn/core/public';
import { createKibanaReactContext } from '@kbn/kibana-react-plugin/public';
import { TransactionDurationRuleParams, TransactionDurationRuleType } from '.';
import type { TransactionDurationRuleParams } from '.';
import { TransactionDurationRuleType } from '.';
import { AggregationType } from '../../../../../common/rules/apm_rule_types';
import { AlertMetadata } from '../../utils/helper';
import type { AlertMetadata } from '../../utils/helper';
import { ENVIRONMENT_ALL } from '../../../../../common/environment_filter_values';
const KibanaReactContext = createKibanaReactContext({

View file

@ -9,13 +9,13 @@ import { EuiSelect } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { defaults, map, omit } from 'lodash';
import React, { useCallback, useEffect } from 'react';
import { CoreStart } from '@kbn/core/public';
import type { CoreStart } from '@kbn/core/public';
import { useKibana } from '@kbn/kibana-react-plugin/public';
import { ForLastExpression, TIME_UNITS } from '@kbn/triggers-actions-ui-plugin/public';
import { EuiFormRow } from '@elastic/eui';
import { EuiSpacer } from '@elastic/eui';
import { EuiSwitchEvent } from '@elastic/eui';
import { SearchConfigurationType } from '../../../../../common/rules/schema';
import type { EuiSwitchEvent } from '@elastic/eui';
import type { SearchConfigurationType } from '../../../../../common/rules/schema';
import { AggregationType } from '../../../../../common/rules/apm_rule_types';
import { ENVIRONMENT_ALL } from '../../../../../common/environment_filter_values';
import { getDurationFormatter } from '../../../../../common/utils/formatters';
@ -33,7 +33,8 @@ import {
TransactionTypeField,
TransactionNameField,
} from '../../utils/fields';
import { AlertMetadata, getIntervalAndTimeRange } from '../../utils/helper';
import type { AlertMetadata } from '../../utils/helper';
import { getIntervalAndTimeRange } from '../../utils/helper';
import { ApmRuleParamsContainer } from '../../ui_components/apm_rule_params_container';
import { PopoverExpression } from '../../ui_components/popover_expression';
import { APMRuleGroupBy } from '../../ui_components/apm_rule_group_by';

View file

@ -5,12 +5,14 @@
* 2.0.
*/
import { Story } from '@storybook/react';
import React, { ComponentType, useState } from 'react';
import { CoreStart } from '@kbn/core/public';
import type { Story } from '@storybook/react';
import type { ComponentType } from 'react';
import React, { useState } from 'react';
import type { CoreStart } from '@kbn/core/public';
import { createKibanaReactContext } from '@kbn/kibana-react-plugin/public';
import { ErrorRateRuleParams, TransactionErrorRateRuleType } from '.';
import { AlertMetadata } from '../../utils/helper';
import type { ErrorRateRuleParams } from '.';
import { TransactionErrorRateRuleType } from '.';
import type { AlertMetadata } from '../../utils/helper';
import { ENVIRONMENT_ALL } from '../../../../../common/environment_filter_values';
const KibanaReactContext = createKibanaReactContext({

View file

@ -8,13 +8,13 @@
import { defaults, omit } from 'lodash';
import { i18n } from '@kbn/i18n';
import React, { useCallback, useEffect } from 'react';
import { CoreStart } from '@kbn/core/public';
import type { CoreStart } from '@kbn/core/public';
import { useKibana } from '@kbn/kibana-react-plugin/public';
import { ForLastExpression, TIME_UNITS } from '@kbn/triggers-actions-ui-plugin/public';
import { EuiFormRow } from '@elastic/eui';
import { EuiSpacer } from '@elastic/eui';
import { EuiSwitchEvent } from '@elastic/eui';
import { SearchConfigurationType } from '../../../../../common/rules/schema';
import type { EuiSwitchEvent } from '@elastic/eui';
import type { SearchConfigurationType } from '../../../../../common/rules/schema';
import { ENVIRONMENT_ALL } from '../../../../../common/environment_filter_values';
import { asPercent } from '../../../../../common/utils/formatters';
import { FETCH_STATUS, isPending, useFetcher } from '../../../../hooks/use_fetcher';
@ -27,7 +27,8 @@ import {
TransactionTypeField,
TransactionNameField,
} from '../../utils/fields';
import { AlertMetadata, getIntervalAndTimeRange } from '../../utils/helper';
import type { AlertMetadata } from '../../utils/helper';
import { getIntervalAndTimeRange } from '../../utils/helper';
import { ApmRuleParamsContainer } from '../../ui_components/apm_rule_params_container';
import { APMRuleGroupBy } from '../../ui_components/apm_rule_group_by';
import {

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import { SettingsSpec } from '@elastic/charts';
import type { SettingsSpec } from '@elastic/charts';
export const DEFAULT_DATE_FORMAT = 'HH:mm:ss';
export const CHART_SETTINGS: Partial<SettingsSpec> = {

View file

@ -7,27 +7,27 @@
/* Error Rate */
import React from 'react';
import type { RecursivePartial } from '@elastic/eui';
import {
EuiFlexItem,
EuiPanel,
EuiFlexGroup,
EuiTitle,
EuiIconTip,
RecursivePartial,
useEuiTheme,
transparentize,
} from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { BoolQuery } from '@kbn/es-query';
import type { BoolQuery } from '@kbn/es-query';
import { UI_SETTINGS } from '@kbn/data-plugin/public';
import { Theme } from '@elastic/charts';
import type { Theme } from '@elastic/charts';
import { AlertActiveTimeRangeAnnotation, AlertAnnotation } from '@kbn/observability-alert-details';
import { useKibana } from '@kbn/kibana-react-plugin/public';
import { CHART_SETTINGS, DEFAULT_DATE_FORMAT } from './constants';
import { useFetcher } from '../../../../hooks/use_fetcher';
import { ChartType } from '../../../shared/charts/helper/get_timeseries_color';
import * as get_timeseries_color from '../../../shared/charts/helper/get_timeseries_color';
import { APIReturnType } from '../../../../services/rest/create_call_apm_api';
import type { APIReturnType } from '../../../../services/rest/create_call_apm_api';
import { errorRateI18n } from '../../../shared/charts/failed_transaction_rate_chart';
import { TimeseriesChart } from '../../../shared/charts/timeseries_chart';
import { yLabelFormat } from './helpers';

View file

@ -22,7 +22,7 @@ import {
ALERT_START,
} from '@kbn/rule-data-utils';
import { EuiCallOut } from '@elastic/eui';
import { CoreStart } from '@kbn/core/public';
import type { CoreStart } from '@kbn/core/public';
import {
SERVICE_ENVIRONMENT,
SERVICE_NAME,
@ -36,7 +36,7 @@ import FailedTransactionChart from './failed_transaction_chart';
import { getAggsTypeFromRule } from './helpers';
import LatencyChart from './latency_chart';
import ThroughputChart from './throughput_chart';
import { AlertDetailsAppSectionProps } from './types';
import type { AlertDetailsAppSectionProps } from './types';
import { createCallApmApi } from '../../../../services/rest/create_call_apm_api';
export function AlertDetailsAppSection({ rule, alert, timeZone }: AlertDetailsAppSectionProps) {

View file

@ -5,12 +5,13 @@
* 2.0.
*/
import { Theme } from '@elastic/charts';
import { RecursivePartial } from '@elastic/eui';
import React, { useMemo, ReactElement } from 'react';
import type { Theme } from '@elastic/charts';
import type { RecursivePartial } from '@elastic/eui';
import type { ReactElement } from 'react';
import React, { useMemo } from 'react';
import { EuiFlexItem, EuiPanel, EuiFlexGroup, EuiTitle } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { BoolQuery } from '@kbn/es-query';
import type { BoolQuery } from '@kbn/es-query';
import { getDurationFormatter } from '@kbn/observability-plugin/common';
import { ALERT_RULE_TYPE_ID, ALERT_EVALUATION_THRESHOLD, ALERT_END } from '@kbn/rule-data-utils';
import type { TopAlert } from '@kbn/observability-plugin/public';

View file

@ -6,16 +6,10 @@
*/
import React from 'react';
import { Theme } from '@elastic/charts';
import { BoolQuery } from '@kbn/es-query';
import {
RecursivePartial,
EuiFlexItem,
EuiPanel,
EuiFlexGroup,
EuiTitle,
EuiIconTip,
} from '@elastic/eui';
import type { Theme } from '@elastic/charts';
import type { BoolQuery } from '@kbn/es-query';
import type { RecursivePartial } from '@elastic/eui';
import { EuiFlexItem, EuiPanel, EuiFlexGroup, EuiTitle, EuiIconTip } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { CHART_SETTINGS } from './constants';

View file

@ -11,10 +11,10 @@ import { ApmRuleType } from '@kbn/rule-data-utils';
import type { RuleTypeParams } from '@kbn/alerting-plugin/common';
import { APM_SERVER_FEATURE_ID } from '../../../../../common/rules/apm_rule_types';
import { getInitialAlertValues } from '../../utils/get_initial_alert_values';
import { ApmPluginStartDeps } from '../../../../plugin';
import type { ApmPluginStartDeps } from '../../../../plugin';
import { useServiceName } from '../../../../hooks/use_service_name';
import { useApmParams } from '../../../../hooks/use_apm_params';
import { AlertMetadata } from '../../utils/helper';
import type { AlertMetadata } from '../../utils/helper';
import { ENVIRONMENT_ALL } from '../../../../../common/environment_filter_values';
import { useTimeRange } from '../../../../hooks/use_time_range';

View file

@ -10,10 +10,10 @@ import React from 'react';
import { EuiSwitch } from '@elastic/eui';
import { EuiFormRow } from '@elastic/eui';
import { EuiSpacer } from '@elastic/eui';
import { EuiSwitchEvent } from '@elastic/eui';
import { TransactionDurationRuleParams } from '../rule_types/transaction_duration_rule_type';
import { ErrorRateRuleParams } from '../rule_types/transaction_error_rate_rule_type';
import { ErrorCountRuleParams } from '../rule_types/error_count_rule_type';
import type { EuiSwitchEvent } from '@elastic/eui';
import type { TransactionDurationRuleParams } from '../rule_types/transaction_duration_rule_type';
import type { ErrorRateRuleParams } from '../rule_types/transaction_error_rate_rule_type';
import type { ErrorCountRuleParams } from '../rule_types/error_count_rule_type';
import { ApmRuleUnifiedSearchBar } from './apm_rule_unified_search_bar';
interface Props {

View file

@ -6,7 +6,8 @@
*/
import { render } from '@testing-library/react';
import React, { ReactNode } from 'react';
import type { ReactNode } from 'react';
import React from 'react';
import { MemoryRouter } from 'react-router-dom';
import { ApmRuleParamsContainer } from '.';

View file

@ -9,7 +9,8 @@ import { EuiCallOut, EuiFlexGrid, EuiFlexItem, EuiSpacer } from '@elastic/eui';
import React, { useEffect, useState } from 'react';
import { i18n } from '@kbn/i18n';
import moment from 'moment';
import { getTimeUnitLabel, TIME_UNITS } from '@kbn/triggers-actions-ui-plugin/public';
import type { TIME_UNITS } from '@kbn/triggers-actions-ui-plugin/public';
import { getTimeUnitLabel } from '@kbn/triggers-actions-ui-plugin/public';
interface MinimumWindowSize {
value: number;

View file

@ -7,13 +7,14 @@
import React from 'react';
import { i18n } from '@kbn/i18n';
import { EuiFormErrorText } from '@elastic/eui';
import { Query, fromKueryExpression } from '@kbn/es-query';
import type { Query } from '@kbn/es-query';
import { fromKueryExpression } from '@kbn/es-query';
import { useKibana } from '@kbn/kibana-react-plugin/public';
import { ApmPluginStartDeps } from '../../../plugin';
import type { ApmPluginStartDeps } from '../../../plugin';
import { useAdHocApmDataView } from '../../../hooks/use_adhoc_apm_data_view';
import { TransactionDurationRuleParams } from '../rule_types/transaction_duration_rule_type';
import { ErrorRateRuleParams } from '../rule_types/transaction_error_rate_rule_type';
import { ErrorCountRuleParams } from '../rule_types/error_count_rule_type';
import type { TransactionDurationRuleParams } from '../rule_types/transaction_duration_rule_type';
import type { ErrorRateRuleParams } from '../rule_types/transaction_error_rate_rule_type';
import type { ErrorCountRuleParams } from '../rule_types/error_count_rule_type';
export function ApmRuleUnifiedSearchBar({
placeholder,

View file

@ -5,12 +5,13 @@
* 2.0.
*/
import React, { FC, PropsWithChildren } from 'react';
import type { FC, PropsWithChildren } from 'react';
import React from 'react';
import { EuiLoadingChart } from '@elastic/eui';
import { EuiText } from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n-react';
import { i18n } from '@kbn/i18n';
import { Coordinate } from '../../../../../typings/timeseries';
import type { Coordinate } from '../../../../../typings/timeseries';
export const TIME_LABELS = {
s: i18n.translate('xpack.apm.alerts.timeLabels.seconds', {

View file

@ -5,6 +5,7 @@
* 2.0.
*/
import type { RectAnnotationDatum, TickFormatter } from '@elastic/charts';
import {
AnnotationDomainType,
Axis,
@ -13,22 +14,20 @@ import {
LineAnnotation,
Position,
RectAnnotation,
RectAnnotationDatum,
ScaleType,
Settings,
TickFormatter,
Tooltip,
niceTimeFormatter,
} from '@elastic/charts';
import { EuiSpacer, useEuiTheme } from '@elastic/eui';
import React, { useMemo } from 'react';
import { IUiSettingsClient } from '@kbn/core/public';
import { TimeUnitChar } from '@kbn/observability-plugin/common';
import type { IUiSettingsClient } from '@kbn/core/public';
import type { TimeUnitChar } from '@kbn/observability-plugin/common';
import { UI_SETTINGS } from '@kbn/data-plugin/public';
import moment from 'moment';
import { i18n } from '@kbn/i18n';
import { useElasticChartsTheme } from '@kbn/charts-theme';
import { Coordinate } from '../../../../../typings/timeseries';
import type { Coordinate } from '../../../../../typings/timeseries';
import { getTimeZone } from '../../../shared/charts/helper/timezone';
import { TimeLabelForData, TIME_LABELS, getDomain } from './chart_preview_helper';
import { ALERT_PREVIEW_BUCKET_SIZE } from '../../utils/helper';

View file

@ -5,8 +5,8 @@
* 2.0.
*/
import { Capabilities } from '@kbn/core/public';
import { ApmPluginSetupDeps } from '../../../plugin';
import type { Capabilities } from '@kbn/core/public';
import type { ApmPluginSetupDeps } from '../../../plugin';
import { getAlertingCapabilities } from './get_alerting_capabilities';
describe('getAlertingCapabilities', () => {

View file

@ -5,8 +5,8 @@
* 2.0.
*/
import { Capabilities } from '@kbn/core/public';
import { ApmPluginSetupDeps } from '../../../plugin';
import type { Capabilities } from '@kbn/core/public';
import type { ApmPluginSetupDeps } from '../../../plugin';
export const getAlertingCapabilities = (
plugins: ApmPluginSetupDeps,

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import { ApmRuleType } from '@kbn/rule-data-utils';
import type { ApmRuleType } from '@kbn/rule-data-utils';
import { RULE_TYPES_CONFIG } from '../../../../common/rules/apm_rule_types';
export function getInitialAlertValues(

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import { TIME_UNITS } from '@kbn/triggers-actions-ui-plugin/public';
import type { TIME_UNITS } from '@kbn/triggers-actions-ui-plugin/public';
import type { RuleTypeMetaData } from '@kbn/alerting-plugin/common';
import moment from 'moment';

View file

@ -8,16 +8,16 @@
import React, { useState, useMemo, useEffect, useCallback } from 'react';
import { useHistory } from 'react-router-dom';
import { ObservabilityAlertSearchBar } from '@kbn/observability-plugin/public';
import { AlertStatus } from '@kbn/observability-plugin/common/typings';
import type { AlertStatus } from '@kbn/observability-plugin/common/typings';
import { EuiPanel, EuiFlexItem, EuiFlexGroup } from '@elastic/eui';
import { BoolQuery } from '@kbn/es-query';
import type { BoolQuery } from '@kbn/es-query';
import { AlertConsumers } from '@kbn/rule-data-utils';
import { useKibana } from '@kbn/kibana-react-plugin/public';
import {
APM_ALERTING_CONSUMERS,
APM_ALERTING_RULE_TYPE_IDS,
} from '../../../../common/alerting/config/apm_alerting_feature_ids';
import { ApmPluginStartDeps } from '../../../plugin';
import type { ApmPluginStartDeps } from '../../../plugin';
import { useAnyOfApmParams } from '../../../hooks/use_apm_params';
import { SERVICE_NAME } from '../../../../common/es_fields/apm';
import { getEnvironmentKuery } from '../../../../common/environment_filter_values';

View file

@ -4,7 +4,7 @@
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import React from 'react';
import type React from 'react';
import { useApmPluginContext } from '../../../context/apm_plugin/use_apm_plugin_context';
import { useBreadcrumb } from '../../../context/breadcrumbs/use_breadcrumb';

View file

@ -8,12 +8,12 @@
import { EuiButtonIcon, EuiToolTip, useEuiTheme } from '@elastic/eui';
import React, { useCallback, useMemo, useState } from 'react';
import { i18n } from '@kbn/i18n';
import {
FieldStats,
import type {
FieldStatsServices,
FieldStatsProps,
FieldStatsState,
} from '@kbn/unified-field-list/src/components/field_stats';
import { FieldStats } from '@kbn/unified-field-list/src/components/field_stats';
import {
FieldPopover,
FieldPopoverHeader,
@ -26,7 +26,7 @@ import {
} from '@kbn/unified-field-list/src/components/field_stats';
import { EuiHorizontalRule, EuiText, EuiSpacer, EuiLoadingSpinner } from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n-react';
import * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
import { fromKueryExpression, toElasticsearchQuery } from '@kbn/es-query';
import numeral from '@elastic/numeral';
import { css } from '@emotion/react';

View file

@ -7,7 +7,8 @@
import React, { useCallback, useMemo, useState } from 'react';
import { debounce } from 'lodash';
import { EuiBasicTable, EuiBasicTableColumn, useEuiTheme } from '@elastic/eui';
import type { EuiBasicTableColumn } from '@elastic/eui';
import { EuiBasicTable, useEuiTheme } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import type { EuiTableSortingType } from '@elastic/eui/src/components/basic_table/table_types';
import type { Criteria } from '@elastic/eui/src/components/basic_table/basic_table';

View file

@ -9,8 +9,8 @@ import React, { useCallback, useEffect, useMemo, useState } from 'react';
import { useHistory } from 'react-router-dom';
import { orderBy } from 'lodash';
import type { EuiBasicTableColumn } from '@elastic/eui';
import {
EuiBasicTableColumn,
EuiFlexGroup,
EuiFlexItem,
EuiSpacer,
@ -30,7 +30,7 @@ import { useUiTracker } from '@kbn/observability-shared-plugin/public';
import { ProcessorEvent } from '@kbn/observability-plugin/common';
import { FieldStatsPopover } from './context_popover/field_stats_popover';
import { asPercent, asPreciseDecimal } from '../../../../common/utils/formatters';
import { FailedTransactionsCorrelation } from '../../../../common/correlations/failed_transactions_correlations/types';
import type { FailedTransactionsCorrelation } from '../../../../common/correlations/failed_transactions_correlations/types';
import { useApmPluginContext } from '../../../context/apm_plugin/use_apm_plugin_context';
import { useLocalStorage } from '../../../hooks/use_local_storage';
@ -45,7 +45,7 @@ import { DurationDistributionChart } from '../../shared/charts/duration_distribu
import { CorrelationsEmptyStatePrompt } from './empty_state_prompt';
import { CrossClusterSearchCompatibilityWarning } from './cross_cluster_search_warning';
import { CorrelationsProgressControls } from './progress_controls';
import { OnAddFilter } from './context_popover/field_stats_popover';
import type { OnAddFilter } from './context_popover/field_stats_popover';
import { useFailedTransactionsCorrelations } from './use_failed_transactions_correlations';
import { getTransactionDistributionChartData } from './get_transaction_distribution_chart_data';

View file

@ -8,9 +8,9 @@
import { i18n } from '@kbn/i18n';
import type { EuiThemeComputed } from '@elastic/eui';
import type { HistogramItem } from '../../../../common/correlations/types';
import { DurationDistributionChartData } from '../../shared/charts/duration_distribution_chart';
import { LatencyCorrelation } from '../../../../common/correlations/latency_correlations/types';
import { FailedTransactionsCorrelation } from '../../../../common/correlations/failed_transactions_correlations/types';
import type { DurationDistributionChartData } from '../../shared/charts/duration_distribution_chart';
import type { LatencyCorrelation } from '../../../../common/correlations/latency_correlations/types';
import type { FailedTransactionsCorrelation } from '../../../../common/correlations/failed_transactions_correlations/types';
export function getTransactionDistributionChartData({
euiTheme,

View file

@ -7,12 +7,13 @@
import { render, screen, waitFor } from '@testing-library/react';
import { createMemoryHistory } from 'history';
import React, { ReactNode } from 'react';
import type { ReactNode } from 'react';
import React from 'react';
import { of } from 'rxjs';
import { __IntlProvider as IntlProvider } from '@kbn/i18n-react';
import { CoreStart } from '@kbn/core/public';
import type { CoreStart } from '@kbn/core/public';
import { merge } from 'lodash';
import { dataPluginMock } from '@kbn/data-plugin/public/mocks';
import type { IKibanaSearchResponse } from '@kbn/search-types';
@ -20,7 +21,7 @@ import { EuiThemeProvider } from '@kbn/kibana-react-plugin/common';
import { createKibanaReactContext } from '@kbn/kibana-react-plugin/public';
import type { LatencyCorrelationsResponse } from '../../../../common/correlations/latency_correlations/types';
import { MockUrlParamsContextProvider } from '../../../context/url_params_context/mock_url_params_context_provider';
import { ApmPluginContextValue } from '../../../context/apm_plugin/apm_plugin_context';
import type { ApmPluginContextValue } from '../../../context/apm_plugin/apm_plugin_context';
import {
mockApmPluginContextValue,
MockApmPluginContextWrapper,

View file

@ -9,8 +9,8 @@ import React, { useCallback, useEffect, useMemo, useState } from 'react';
import { useHistory } from 'react-router-dom';
import { orderBy } from 'lodash';
import type { EuiBasicTableColumn } from '@elastic/eui';
import {
EuiBasicTableColumn,
EuiFlexGroup,
EuiFlexItem,
EuiSpacer,
@ -19,8 +19,8 @@ import {
EuiIconTip,
useEuiTheme,
} from '@elastic/eui';
import { Direction } from '@elastic/eui/src/services/sort/sort_direction';
import { EuiTableSortingType } from '@elastic/eui/src/components/basic_table/table_types';
import type { Direction } from '@elastic/eui/src/services/sort/sort_direction';
import type { EuiTableSortingType } from '@elastic/eui/src/components/basic_table/table_types';
import { i18n } from '@kbn/i18n';
@ -30,7 +30,7 @@ import { useUiTracker } from '@kbn/observability-shared-plugin/public';
import { ProcessorEvent } from '@kbn/observability-plugin/common';
import { FieldStatsPopover } from './context_popover/field_stats_popover';
import { asPreciseDecimal } from '../../../../common/utils/formatters';
import { LatencyCorrelation } from '../../../../common/correlations/latency_correlations/types';
import type { LatencyCorrelation } from '../../../../common/correlations/latency_correlations/types';
import { useApmPluginContext } from '../../../context/apm_plugin/use_apm_plugin_context';
import { FETCH_STATUS } from '../../../hooks/use_fetcher';
@ -45,7 +45,7 @@ import { getOverallHistogram } from './utils/get_overall_histogram';
import { CorrelationsEmptyStatePrompt } from './empty_state_prompt';
import { CrossClusterSearchCompatibilityWarning } from './cross_cluster_search_warning';
import { CorrelationsProgressControls } from './progress_controls';
import { OnAddFilter } from './context_popover/field_stats_popover';
import type { OnAddFilter } from './context_popover/field_stats_popover';
import { useLatencyCorrelations } from './use_latency_correlations';
import { getTransactionDistributionChartData } from './get_transaction_distribution_chart_data';
import { ChartTitleToolTip } from './chart_title_tool_tip';

View file

@ -5,13 +5,14 @@
* 2.0.
*/
import React, { PropsWithChildren } from 'react';
import type { PropsWithChildren } from 'react';
import React from 'react';
import { merge } from 'lodash';
import { createMemoryHistory } from 'history';
import { act, waitFor, renderHook } from '@testing-library/react';
import { ApmPluginContextValue } from '../../../context/apm_plugin/apm_plugin_context';
import type { ApmPluginContextValue } from '../../../context/apm_plugin/apm_plugin_context';
import {
mockApmPluginContextValue,
MockApmPluginContextWrapper,

View file

@ -24,11 +24,11 @@ import { LatencyDistributionChartType } from '../../../../common/latency_distrib
import { callApmApi } from '../../../services/rest/create_call_apm_api';
import type { CorrelationsProgress } from './utils/analysis_hook_utils';
import {
getInitialResponse,
getFailedTransactionsCorrelationsSortedByScore,
getReducer,
CorrelationsProgress,
} from './utils/analysis_hook_utils';
import { useFetchParams } from './use_fetch_params';

View file

@ -5,13 +5,14 @@
* 2.0.
*/
import React, { PropsWithChildren } from 'react';
import type { PropsWithChildren } from 'react';
import React from 'react';
import { merge } from 'lodash';
import { createMemoryHistory } from 'history';
import { act, waitFor, renderHook } from '@testing-library/react';
import { ApmPluginContextValue } from '../../../context/apm_plugin/apm_plugin_context';
import type { ApmPluginContextValue } from '../../../context/apm_plugin/apm_plugin_context';
import {
mockApmPluginContextValue,
MockApmPluginContextWrapper,

View file

@ -24,11 +24,11 @@ import { LatencyDistributionChartType } from '../../../../common/latency_distrib
import { callApmApi } from '../../../services/rest/create_call_apm_api';
import type { CorrelationsProgress } from './utils/analysis_hook_utils';
import {
getInitialResponse,
getLatencyCorrelationsSortedByCorrelation,
getReducer,
CorrelationsProgress,
} from './utils/analysis_hook_utils';
import { useFetchParams } from './use_fetch_params';

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import {
import type {
FailedTransactionsCorrelation,
FailedTransactionsCorrelationsImpactThreshold,
} from '../../../../../common/correlations/failed_transactions_correlations/types';

View file

@ -14,12 +14,11 @@ import { useApmParams } from '../../../../hooks/use_apm_params';
import { useBreakpoints } from '../../../../hooks/use_breakpoints';
import { FETCH_STATUS, useFetcher } from '../../../../hooks/use_fetcher';
import { useTimeRange } from '../../../../hooks/use_time_range';
import {
getSpanMetricColumns,
SpanMetricGroup,
} from '../../../shared/dependencies_table/get_span_metric_columns';
import type { SpanMetricGroup } from '../../../shared/dependencies_table/get_span_metric_columns';
import { getSpanMetricColumns } from '../../../shared/dependencies_table/get_span_metric_columns';
import { EmptyMessage } from '../../../shared/empty_message';
import { ITableColumn, ManagedTable } from '../../../shared/managed_table';
import type { ITableColumn } from '../../../shared/managed_table';
import { ManagedTable } from '../../../shared/managed_table';
import { getComparisonEnabled } from '../../../shared/time_comparison/get_comparison_enabled';
import { TruncateWithTooltip } from '../../../shared/truncate_with_tooltip';
import { DependencyOperationDetailLink } from '../../dependency_operation_detail_view/dependency_operation_detail_link';

View file

@ -6,9 +6,9 @@
*/
import React from 'react';
import { EuiLink } from '@elastic/eui';
import { TypeOf } from '@kbn/typed-react-router-config';
import type { TypeOf } from '@kbn/typed-react-router-config';
import { useApmRouter } from '../../../hooks/use_apm_router';
import { ApmRoutes } from '../../routing/apm_route_config';
import type { ApmRoutes } from '../../routing/apm_route_config';
type Query = TypeOf<ApmRoutes, '/dependencies/operation'>['query'];

View file

@ -13,7 +13,7 @@ import { useApmParams } from '../../../hooks/use_apm_params';
import { useFetcher } from '../../../hooks/use_fetcher';
import { useSampleChartSelection } from '../../../hooks/use_sample_chart_selection';
import { useTimeRange } from '../../../hooks/use_time_range';
import { DurationDistributionChartData } from '../../shared/charts/duration_distribution_chart';
import type { DurationDistributionChartData } from '../../shared/charts/duration_distribution_chart';
import { DurationDistributionChartWithScrubber } from '../../shared/charts/duration_distribution_chart_with_scrubber';
export function DependencyOperationDistributionChart() {

View file

@ -20,7 +20,7 @@ import { ResettingHeightRetainer } from '../../shared/height_retainer/resetting_
import { push, replace } from '../../shared/links/url_helpers';
import { useWaterfallFetcher } from '../transaction_details/use_waterfall_fetcher';
import { WaterfallWithSummary } from '../transaction_details/waterfall_with_summary';
import { TransactionTab } from '../transaction_details/waterfall_with_summary/transaction_tabs';
import type { TransactionTab } from '../transaction_details/waterfall_with_summary/transaction_tabs';
import { DependencyOperationDistributionChart } from './dependency_operation_distribution_chart';
import { DetailViewHeader } from './detail_view_header';
import { maybeRedirectToAvailableSpanSample } from './maybe_redirect_to_available_span_sample';

View file

@ -6,8 +6,8 @@
*/
import { range } from 'lodash';
import { maybeRedirectToAvailableSpanSample } from './maybe_redirect_to_available_span_sample';
import { replace as urlHelpersReplace } from '../../shared/links/url_helpers';
import { History } from 'history';
import type { replace as urlHelpersReplace } from '../../shared/links/url_helpers';
import type { History } from 'history';
import { FETCH_STATUS } from '../../../hooks/use_fetcher';
describe('maybeRedirectToAvailableSpanSample', () => {

View file

@ -5,9 +5,9 @@
* 2.0.
*/
import { History } from 'history';
import type { History } from 'history';
import { FETCH_STATUS } from '../../../hooks/use_fetcher';
import { replace as urlHelpersReplace } from '../../shared/links/url_helpers';
import type { replace as urlHelpersReplace } from '../../shared/links/url_helpers';
export function maybeRedirectToAvailableSpanSample({
spanFetchStatus,

View file

@ -5,14 +5,8 @@
* 2.0.
*/
import {
EuiBadge,
EuiBasicTable,
EuiBasicTableColumn,
EuiSpacer,
EuiText,
EuiToolTip,
} from '@elastic/eui';
import type { EuiBasicTableColumn } from '@elastic/eui';
import { EuiBadge, EuiBasicTable, EuiSpacer, EuiText, EuiToolTip } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { useKibana } from '@kbn/kibana-react-plugin/public';
import { orderBy } from 'lodash';
@ -21,7 +15,7 @@ import { asBigNumber, asInteger } from '../../../../common/utils/formatters';
import type { ApmEvent } from '../../../../server/routes/diagnostics/bundle/get_apm_events';
import { useAdHocApmDataView } from '../../../hooks/use_adhoc_apm_data_view';
import { useApmParams } from '../../../hooks/use_apm_params';
import { ApmPluginStartDeps } from '../../../plugin';
import type { ApmPluginStartDeps } from '../../../plugin';
import { SearchBar } from '../../shared/search_bar/search_bar';
import { useDiagnosticsContext } from './context/use_diagnostics';

View file

@ -8,7 +8,7 @@
import React, { useMemo, useState } from 'react';
import { useApmParams } from '../../../../hooks/use_apm_params';
import { useTimeRange } from '../../../../hooks/use_time_range';
import { APIReturnType } from '../../../../services/rest/create_call_apm_api';
import type { APIReturnType } from '../../../../services/rest/create_call_apm_api';
import { FETCH_STATUS, useFetcher } from '../../../../hooks/use_fetcher';
type DiagnosticsBundle = APIReturnType<'GET /internal/apm/diagnostics'>;

View file

@ -5,10 +5,11 @@
* 2.0.
*/
import { IndicesDataStream } from '@elastic/elasticsearch/lib/api/types';
import { EuiBadge, EuiBasicTable, EuiBasicTableColumn, EuiSpacer, EuiText } from '@elastic/eui';
import type { IndicesDataStream } from '@elastic/elasticsearch/lib/api/types';
import type { EuiBasicTableColumn } from '@elastic/eui';
import { EuiBadge, EuiBasicTable, EuiSpacer, EuiText } from '@elastic/eui';
import React from 'react';
import { APIReturnType } from '../../../services/rest/create_call_apm_api';
import type { APIReturnType } from '../../../services/rest/create_call_apm_api';
import { useDiagnosticsContext } from './context/use_diagnostics';
type DiagnosticsBundle = APIReturnType<'GET /internal/apm/diagnostics'>;

View file

@ -16,7 +16,7 @@ import {
EuiCallOut,
EuiSpacer,
} from '@elastic/eui';
import { APIReturnType } from '../../../services/rest/create_call_apm_api';
import type { APIReturnType } from '../../../services/rest/create_call_apm_api';
import { useDiagnosticsContext } from './context/use_diagnostics';
import { getIsIndexTemplateOk } from './summary_tab/index_templates_status';
import { getIsIndicesTabOk } from './summary_tab/indicies_status';

Some files were not shown because too many files have changed in this diff Show more