Skip to content

Commit

Permalink
Feature/translate monitoring server(part_2) (#25402)
Browse files Browse the repository at this point in the history
* Translate monitoring -> server -> metrics

* Add monitooring path to i18nrx.json file

* Fix issues

* Remove eslint rule disabling
  • Loading branch information
Nox911 authored and maryia-lapata committed Nov 23, 2018
1 parent f82d732 commit f19945a
Show file tree
Hide file tree
Showing 9 changed files with 1,704 additions and 719 deletions.
5 changes: 4 additions & 1 deletion x-pack/plugins/monitoring/server/lib/metrics/apm/classes.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import { ClusterMetric, Metric } from '../classes';
import { SMALL_FLOAT, LARGE_FLOAT } from '../../../../common/formatting';
import { i18n } from '@kbn/i18n';

export class ApmClusterMetric extends ClusterMetric {
constructor(opts) {
Expand Down Expand Up @@ -83,7 +84,9 @@ export class ApmEventsRateClusterMetric extends ApmClusterMetric {
derivative: true,
format: LARGE_FLOAT,
metricAgg: 'max',
units: '/m'
units: i18n.translate('xpack.monitoring.metrics.apm.perMinuteUnitLabel', {
defaultMessage: '/m'
})
});

this.aggs = {
Expand Down
356 changes: 263 additions & 93 deletions x-pack/plugins/monitoring/server/lib/metrics/apm/metrics.js

Large diffs are not rendered by default.

11 changes: 8 additions & 3 deletions x-pack/plugins/monitoring/server/lib/metrics/beats/classes.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ import {
LARGE_BYTES
} from '../../../../common/formatting';
import { NORMALIZED_DERIVATIVE_UNIT } from '../../../../common/constants';
import { i18n } from '@kbn/i18n';

const perSecondUnitLabel = i18n.translate('xpack.monitoring.metrics.beats.perSecondUnitLabel', {
defaultMessage: '/s'
});

export class BeatsClusterMetric extends ClusterMetric {
constructor(opts) {
Expand All @@ -36,7 +41,7 @@ export class BeatsEventsRateClusterMetric extends BeatsClusterMetric {
derivative: true,
format: LARGE_FLOAT,
metricAgg: 'max',
units: '/s'
units: perSecondUnitLabel
});

this.aggs = {
Expand Down Expand Up @@ -102,7 +107,7 @@ export class BeatsEventsRateMetric extends BeatsMetric {
...opts,
format: LARGE_FLOAT,
metricAgg: 'max',
units: '/s',
units: perSecondUnitLabel,
derivative: true
});
}
Expand All @@ -114,7 +119,7 @@ export class BeatsByteRateMetric extends BeatsMetric {
...opts,
format: LARGE_BYTES,
metricAgg: 'max',
units: '/s',
units: perSecondUnitLabel,
derivative: true
});
}
Expand Down
376 changes: 264 additions & 112 deletions x-pack/plugins/monitoring/server/lib/metrics/beats/metrics.js

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
SMALL_BYTES
} from '../../../../common/formatting';
import { NORMALIZED_DERIVATIVE_UNIT } from '../../../../common/constants';
import { i18n } from '@kbn/i18n';

export class ElasticsearchMetric extends Metric {
constructor(opts) {
Expand Down Expand Up @@ -70,7 +71,9 @@ export class LatencyMetric extends ElasticsearchMetric {
...opts,
format: LARGE_FLOAT,
metricAgg: 'sum', // NOTE: this is used for a pointless aggregation
units: 'ms'
units: i18n.translate('xpack.monitoring.metrics.es.msTimeUnitLabel', {
defaultMessage: 'ms'
})
});

this.checkRequiredParams({
Expand All @@ -85,7 +88,9 @@ export class LatencyMetric extends ElasticsearchMetric {
metricField = 'search.query';
} else {
throw new Error(
'Latency metric param must be a string equal to `index` or `query`'
i18n.translate('xpack.monitoring.metrics.es.latencyMetricParamErrorMessage', {
defaultMessage: 'Latency metric param must be a string equal to `index` or `query`'
})
);
}

Expand Down Expand Up @@ -139,7 +144,9 @@ export class RequestRateMetric extends ElasticsearchMetric {
derivative: true,
format: LARGE_FLOAT,
metricAgg: 'max',
units: '/s'
units: i18n.translate('xpack.monitoring.metrics.es.perSecondsUnitLabel', {
defaultMessage: '/s'
})
});
}
}
Expand Down Expand Up @@ -329,7 +336,9 @@ export class MillisecondsToSecondsMetric extends ElasticsearchMetric {
constructor(opts) {
super({
...opts,
units: 's',
units: i18n.translate('xpack.monitoring.metrics.es.secondsUnitLabel', {
defaultMessage: 's'
})
});

this.calculation = bucket => {
Expand Down
Loading

0 comments on commit f19945a

Please sign in to comment.