Skip to content

Commit

Permalink
Fix tsc, i18n and use constants instead of strings for processor event
Browse files Browse the repository at this point in the history
  • Loading branch information
sorenlouv committed Sep 17, 2020
1 parent 0d61470 commit ee67276
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 27 deletions.
1 change: 0 additions & 1 deletion x-pack/plugins/apm/public/components/alerting/fields.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { EuiSelect, EuiExpression, EuiFieldNumber } from '@elastic/eui';
import React from 'react';
import { i18n } from '@kbn/i18n';
import { EuiSelectOption } from '@elastic/eui';
import { EuiFieldNumberProps } from '@elastic/eui';
import { getEnvironmentLabel } from '../../../common/environment_filter_values';
import { PopoverExpression } from './ServiceAlertTrigger/PopoverExpression';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import { schema } from '@kbn/config-schema';
import { Observable } from 'rxjs';
import { take } from 'rxjs/operators';
import { ProcessorEvent } from '../../../common/processor_event';
import { getEnvironmentUiFilterES } from '../helpers/convert_ui_filters/get_environment_ui_filter_es';
import { AlertType, ALERT_TYPES_CONFIG } from '../../../common/alert_types';
import {
Expand Down Expand Up @@ -81,7 +82,7 @@ export function registerErrorCountAlertType({
},
},
},
{ term: { [PROCESSOR_EVENT]: 'error' } },
{ term: { [PROCESSOR_EVENT]: ProcessorEvent.error } },
{ term: { [SERVICE_NAME]: alertParams.serviceName } },
...getEnvironmentUiFilterES(alertParams.environment),
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import { schema } from '@kbn/config-schema';
import { Observable } from 'rxjs';
import { take } from 'rxjs/operators';
import { ProcessorEvent } from '../../../common/processor_event';
import { AlertType, ALERT_TYPES_CONFIG } from '../../../common/alert_types';
import { ESSearchResponse } from '../../../typings/elasticsearch';
import {
Expand Down Expand Up @@ -86,7 +87,7 @@ export function registerTransactionDurationAlertType({
},
},
},
{ term: { [PROCESSOR_EVENT]: 'transaction' } },
{ term: { [PROCESSOR_EVENT]: ProcessorEvent.transaction } },
{ term: { [SERVICE_NAME]: alertParams.serviceName } },
{ term: { [TRANSACTION_TYPE]: alertParams.transactionType } },
...getEnvironmentUiFilterES(alertParams.environment),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import { schema } from '@kbn/config-schema';
import { Observable } from 'rxjs';
import { take } from 'rxjs/operators';
import { ProcessorEvent } from '../../../common/processor_event';
import { EventOutcome } from '../../../common/event_outcome';
import { AlertType, ALERT_TYPES_CONFIG } from '../../../common/alert_types';
import { ESSearchResponse } from '../../../typings/elasticsearch';
Expand Down Expand Up @@ -82,7 +83,7 @@ export function registerTransactionErrorRateAlertType({
},
},
},
{ term: { [PROCESSOR_EVENT]: 'transaction' } },
{ term: { [PROCESSOR_EVENT]: ProcessorEvent.transaction } },
{ term: { [SERVICE_NAME]: alertParams.serviceName } },
{ term: { [TRANSACTION_TYPE]: alertParams.transactionType } },
...getEnvironmentUiFilterES(alertParams.environment),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { Logger } from 'kibana/server';
import uuid from 'uuid/v4';
import { snakeCase } from 'lodash';
import Boom from 'boom';
import { ProcessorEvent } from '../../../common/processor_event';
import { ML_ERRORS } from '../../../common/anomaly_detection';
import { PromiseReturnType } from '../../../../observability/typings/common';
import { Setup } from '../helpers/setup_request';
Expand Down Expand Up @@ -79,7 +80,7 @@ async function createAnomalyDetectionJob({
query: {
bool: {
filter: [
{ term: { [PROCESSOR_EVENT]: 'transaction' } },
{ term: { [PROCESSOR_EVENT]: ProcessorEvent.transaction } },
{ exists: { field: TRANSACTION_DURATION } },
...getEnvironmentUiFilterES(environment),
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export const tasks: TelemetryTask[] = [
query: {
bool: {
filter: [
{ term: { [PROCESSOR_EVENT]: 'transaction' } },
{ term: { [PROCESSOR_EVENT]: ProcessorEvent.transaction } },
{ range: { '@timestamp': { gte: start, lt: end } } },
],
},
Expand Down Expand Up @@ -606,7 +606,10 @@ export const tasks: TelemetryTask[] = [
timeout,
query: {
bool: {
filter: [{ term: { [PROCESSOR_EVENT]: 'error' } }, range1d],
filter: [
{ term: { [PROCESSOR_EVENT]: ProcessorEvent.error } },
range1d,
],
},
},
aggs: {
Expand Down Expand Up @@ -640,7 +643,7 @@ export const tasks: TelemetryTask[] = [
query: {
bool: {
filter: [
{ term: { [PROCESSOR_EVENT]: 'transaction' } },
{ term: { [PROCESSOR_EVENT]: ProcessorEvent.transaction } },
range1d,
],
},
Expand Down Expand Up @@ -674,7 +677,7 @@ export const tasks: TelemetryTask[] = [
query: {
bool: {
filter: [
{ term: { [PROCESSOR_EVENT]: 'transaction' } },
{ term: { [PROCESSOR_EVENT]: ProcessorEvent.transaction } },
range1d,
],
must_not: {
Expand Down
9 changes: 0 additions & 9 deletions x-pack/plugins/translations/translations/ja-JP.json
Original file line number Diff line number Diff line change
Expand Up @@ -4676,9 +4676,6 @@
"xpack.apm.errorGroupDetails.relatedTransactionSample": "関連トランザクションサンプル",
"xpack.apm.errorGroupDetails.unhandledLabel": "未対応",
"xpack.apm.errorGroupDetails.viewOccurrencesInDiscoverButtonLabel": "ディスカバリで {occurrencesCount} 件の{occurrencesCount, plural, one {ドキュメント} other {ドキュメント}}を表示。",
"xpack.apm.errorRateAlertTrigger.environment": "環境",
"xpack.apm.errorRateAlertTrigger.errors": "エラー",
"xpack.apm.errorRateAlertTrigger.isAbove": "の下限は",
"xpack.apm.errorRateChart.avgLabel": "平均",
"xpack.apm.errorRateChart.rateLabel": "レート",
"xpack.apm.errorRateChart.title": "トランザクションエラー率",
Expand Down Expand Up @@ -4780,9 +4777,6 @@
"xpack.apm.propertiesTable.tabs.logStacktraceLabel": "スタックトレース",
"xpack.apm.propertiesTable.tabs.metadataLabel": "メタデータ",
"xpack.apm.propertiesTable.tabs.timelineLabel": "タイムライン",
"xpack.apm.registerErrorCountAlertType.variables.serviceName": "サービス名",
"xpack.apm.registerTransactionDurationAlertType.variables.serviceName": "サービス名",
"xpack.apm.registerTransactionDurationAlertType.variables.transactionType": "トランザクションタイプ",
"xpack.apm.rum.dashboard.backend": "バックエンド",
"xpack.apm.rum.dashboard.frontend": "フロントエンド",
"xpack.apm.rum.dashboard.overall.label": "全体",
Expand Down Expand Up @@ -5029,10 +5023,7 @@
"xpack.apm.transactionDurationAlert.aggregationType.99th": "99 パーセンタイル",
"xpack.apm.transactionDurationAlert.aggregationType.avg": "平均",
"xpack.apm.transactionDurationAlert.name": "トランザクション期間",
"xpack.apm.transactionDurationAlertTrigger.environment": "環境",
"xpack.apm.transactionDurationAlertTrigger.isAbove": "の下限は",
"xpack.apm.transactionDurationAlertTrigger.ms": "ms",
"xpack.apm.transactionDurationAlertTrigger.type": "タイプ",
"xpack.apm.transactionDurationAlertTrigger.when": "タイミング",
"xpack.apm.transactionDurationLabel": "期間",
"xpack.apm.transactions.chart.95thPercentileLabel": "95 パーセンタイル",
Expand Down
9 changes: 0 additions & 9 deletions x-pack/plugins/translations/translations/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -4677,9 +4677,6 @@
"xpack.apm.errorGroupDetails.relatedTransactionSample": "相关的事务样本",
"xpack.apm.errorGroupDetails.unhandledLabel": "未处理",
"xpack.apm.errorGroupDetails.viewOccurrencesInDiscoverButtonLabel": "在 Discover 查看 {occurrencesCount} 个 {occurrencesCount, plural, one {匹配项} other {匹配项}}。",
"xpack.apm.errorRateAlertTrigger.environment": "环境",
"xpack.apm.errorRateAlertTrigger.errors": "错误",
"xpack.apm.errorRateAlertTrigger.isAbove": "高于",
"xpack.apm.errorRateChart.avgLabel": "平均",
"xpack.apm.errorRateChart.rateLabel": "比率",
"xpack.apm.errorRateChart.title": "事务错误率",
Expand Down Expand Up @@ -4783,9 +4780,6 @@
"xpack.apm.propertiesTable.tabs.logStacktraceLabel": "日志堆栈跟踪",
"xpack.apm.propertiesTable.tabs.metadataLabel": "元数据",
"xpack.apm.propertiesTable.tabs.timelineLabel": "时间线",
"xpack.apm.registerErrorCountAlertType.variables.serviceName": "服务名称",
"xpack.apm.registerTransactionDurationAlertType.variables.serviceName": "服务名称",
"xpack.apm.registerTransactionDurationAlertType.variables.transactionType": "事务类型",
"xpack.apm.rum.dashboard.backend": "后端",
"xpack.apm.rum.dashboard.frontend": "前端",
"xpack.apm.rum.dashboard.overall.label": "总体",
Expand Down Expand Up @@ -5032,10 +5026,7 @@
"xpack.apm.transactionDurationAlert.aggregationType.99th": "第 99 个百分位",
"xpack.apm.transactionDurationAlert.aggregationType.avg": "平均值",
"xpack.apm.transactionDurationAlert.name": "事务持续时间",
"xpack.apm.transactionDurationAlertTrigger.environment": "环境",
"xpack.apm.transactionDurationAlertTrigger.isAbove": "高于",
"xpack.apm.transactionDurationAlertTrigger.ms": "ms",
"xpack.apm.transactionDurationAlertTrigger.type": "类型",
"xpack.apm.transactionDurationAlertTrigger.when": "当",
"xpack.apm.transactionDurationLabel": "持续时间",
"xpack.apm.transactions.chart.95thPercentileLabel": "第 95 个百分位",
Expand Down

0 comments on commit ee67276

Please sign in to comment.