[i18n] Translations for Monitoring: Logstash (#24897)

* Translate Monitoring logstash

* Fix a typo

* Update unit tests
This commit is contained in:
Maryia Lapata 2018-11-13 17:56:02 +03:00 committed by GitHub
parent 56dc78df20
commit 7a31758061
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
25 changed files with 411 additions and 129 deletions

View file

@ -17,6 +17,7 @@
"xpack.grokDebugger": "x-pack/plugins/grokdebugger",
"xpack.idxMgmt": "x-pack/plugins/index_management",
"xpack.licenseMgmt": "x-pack/plugins/license_management",
"xpack.monitoring": "x-pack/plugins/monitoring",
"xpack.rollupJobs": "x-pack/plugins/rollup",
"xpack.searchProfiler": "x-pack/plugins/searchprofiler",
"xpack.security": "x-pack/plugins/security",

View file

@ -7,8 +7,9 @@
import React from 'react';
import { SummaryStatus } from '../../summary_status';
import { formatMetric } from '../../../lib/format_number';
import { injectI18n } from '@kbn/i18n/react';
export function ClusterStatus({ stats }) {
function ClusterStatusUi({ stats, intl }) {
const {
node_count: nodeCount,
avg_memory_used: avgMemoryUsed,
@ -19,22 +20,30 @@ export function ClusterStatus({ stats }) {
const metrics = [
{
label: 'Nodes',
label: intl.formatMessage({
id: 'xpack.monitoring.logstash.clusterStatus.nodesLabel', defaultMessage: 'Nodes'
}),
value: nodeCount,
dataTestSubj: 'node_count'
},
{
label: 'Memory',
label: intl.formatMessage({
id: 'xpack.monitoring.logstash.clusterStatus.memoryLabel', defaultMessage: 'Memory'
}),
value: formatMetric(avgMemoryUsed, 'byte') + ' / ' + formatMetric(avgMemory, 'byte'),
dataTestSubj: 'memory_used'
},
{
label: 'Events Received',
label: intl.formatMessage({
id: 'xpack.monitoring.logstash.clusterStatus.eventsReceivedLabel', defaultMessage: 'Events Received'
}),
value: formatMetric(eventsInTotal, '0.[0]a'),
dataTestSubj: 'events_in_total'
},
{
label: 'Events Emitted',
label: intl.formatMessage({
id: 'xpack.monitoring.logstash.clusterStatus.eventsEmittedLabel', defaultMessage: 'Events Emitted'
}),
value: formatMetric(eventsOutTotal, '0.[0]a'),
dataTestSubj: 'events_out_total'
}
@ -47,3 +56,5 @@ export function ClusterStatus({ stats }) {
/>
);
}
export const ClusterStatus = injectI18n(ClusterStatusUi);

View file

@ -7,8 +7,9 @@
import React from 'react';
import { SummaryStatus } from '../../summary_status';
import { formatMetric } from '../../../lib/format_number';
import { injectI18n } from '@kbn/i18n/react';
export function DetailStatus({ stats }) {
function DetailStatusUi({ stats, intl }) {
const {
http_address: httpAddress,
events,
@ -25,27 +26,37 @@ export function DetailStatus({ stats }) {
dataTestSubj: 'httpAddress'
},
{
label: 'Events Received',
label: intl.formatMessage({
id: 'xpack.monitoring.logstash.detailStatus.eventsReceivedLabel', defaultMessage: 'Events Received'
}),
value: formatMetric(events.in, '0.[0]a'),
dataTestSubj: 'eventsIn'
},
{
label: 'Events Emitted',
label: intl.formatMessage({
id: 'xpack.monitoring.logstash.detailStatus.eventsEmittedLabel', defaultMessage: 'Events Emitted'
}),
value: formatMetric(events.out, '0.[0]a'),
dataTestSubj: 'eventsOut'
},
{
label: 'Config Reloads',
label: intl.formatMessage({
id: 'xpack.monitoring.logstash.detailStatus.configReloadsLabel', defaultMessage: 'Config Reloads'
}),
value: reloads.successes,
dataTestSubj: 'numReloads'
},
{
label: 'Pipeline Workers',
label: intl.formatMessage({
id: 'xpack.monitoring.logstash.detailStatus.pipelineWorkersLabel', defaultMessage: 'Pipeline Workers'
}),
value: pipeline.workers,
dataTestSubj: 'pipelineWorkers'
},
{
label: 'Batch Size',
label: intl.formatMessage({
id: 'xpack.monitoring.logstash.detailStatus.batchSizeLabel', defaultMessage: 'Batch Size'
}),
value: pipeline.batch_size,
dataTestSubj: 'pipelineBatchSize'
}
@ -53,12 +64,16 @@ export function DetailStatus({ stats }) {
const lastMetrics = [
{
label: 'Version',
label: intl.formatMessage({
id: 'xpack.monitoring.logstash.detailStatus.versionLabel', defaultMessage: 'Version'
}),
value: version,
dataTestSubj: 'version'
},
{
label: 'Uptime',
label: intl.formatMessage({
id: 'xpack.monitoring.logstash.detailStatus.uptimeLabel', defaultMessage: 'Uptime'
}),
value: formatMetric(uptime, 'time_since'),
dataTestSubj: 'uptime'
}
@ -68,7 +83,9 @@ export function DetailStatus({ stats }) {
const metrics = [...firstMetrics];
if (queueType) {
metrics.push({
label: 'Queue Type',
label: intl.formatMessage({
id: 'xpack.monitoring.logstash.detailStatus.queueTypeLabel', defaultMessage: 'Queue Type'
}),
value: queueType,
dataTestSubj: 'queueType'
});
@ -82,3 +99,5 @@ export function DetailStatus({ stats }) {
/>
);
}
export const DetailStatus = injectI18n(DetailStatusUi);

View file

@ -52,7 +52,11 @@ exports[`DetailDrawer component If vertices shows basic info and no stats for if
>
<div>
<p>
This is a conditional statement in your pipeline.
<FormattedMessage
defaultMessage="This is a conditional statement in your pipeline."
id="xpack.monitoring.logstash.pipeline.detailDrawer.conditionalStatementDescription"
values={Object {}}
/>
</p>
<EuiCodeBlock>
if ([type] == "apache_log") {
@ -64,7 +68,11 @@ exports[`DetailDrawer component If vertices shows basic info and no stats for if
/>
</div>
<p>
There are currently no metrics to show for this if condition.
<FormattedMessage
defaultMessage="There are currently no metrics to show for this if condition."
id="xpack.monitoring.logstash.pipeline.detailDrawer.noMetricsForIfDescription"
values={Object {}}
/>
</p>
</EuiText>
</EuiFlyoutBody>
@ -123,9 +131,15 @@ exports[`DetailDrawer component Plugin vertices Plugin does not have explicit ID
>
<div>
<p>
This
plugin
does not have an ID explicitly specified. Specifying an ID allows you to track differences across pipeline changes. You can explicitly specify an ID for this plugin like so:
<FormattedMessage
defaultMessage="This {vertexType} does not have an ID explicitly specified. Specifying an ID allows you to track differences across pipeline changes. You can explicitly specify an ID for this plugin like so:"
id="xpack.monitoring.logstash.pipeline.detailDrawer.specifyVertexIdDescription"
values={
Object {
"vertexType": "plugin",
}
}
/>
</p>
<EuiCodeBlock>
@ -148,7 +162,11 @@ exports[`DetailDrawer component Plugin vertices Plugin does not have explicit ID
align="left"
textOnly={true}
>
Events Latency
<FormattedMessage
defaultMessage="Events Latency"
id="xpack.monitoring.logstash.pipeline.detailDrawer.eventsLatencyLabel"
values={Object {}}
/>
</EuiTableRowCell>
<EuiTableRowCell
align="left"
@ -202,7 +220,11 @@ exports[`DetailDrawer component Plugin vertices Plugin does not have explicit ID
align="left"
textOnly={true}
>
Events Emitted Rate
<FormattedMessage
defaultMessage="Events Emitted Rate"
id="xpack.monitoring.logstash.pipeline.detailDrawer.eventsEmittedRateLabel"
values={Object {}}
/>
</EuiTableRowCell>
<EuiTableRowCell
align="left"
@ -256,7 +278,11 @@ exports[`DetailDrawer component Plugin vertices Plugin does not have explicit ID
align="left"
textOnly={true}
>
Events Received
<FormattedMessage
defaultMessage="Events Received"
id="xpack.monitoring.logstash.pipeline.detailDrawer.eventsReceivedLabel"
values={Object {}}
/>
</EuiTableRowCell>
<EuiTableRowCell
align="left"
@ -310,7 +336,11 @@ exports[`DetailDrawer component Plugin vertices Plugin does not have explicit ID
align="left"
textOnly={true}
>
Events Emitted
<FormattedMessage
defaultMessage="Events Emitted"
id="xpack.monitoring.logstash.pipeline.detailDrawer.eventsEmittedLabel"
values={Object {}}
/>
</EuiTableRowCell>
<EuiTableRowCell
align="left"
@ -415,16 +445,21 @@ exports[`DetailDrawer component Plugin vertices Plugin has explicit ID shows bas
size="m"
>
<p>
This
plugin
's ID is
<EuiBadge
color="default"
iconSide="left"
>
parse_apache_logline
</EuiBadge>
.
<FormattedMessage
defaultMessage="This {vertexType}'s ID is {vertexId}."
id="xpack.monitoring.logstash.pipeline.detailDrawer.vertexIdDescription"
values={
Object {
"vertexId": <EuiBadge
color="default"
iconSide="left"
>
parse_apache_logline
</EuiBadge>,
"vertexType": "plugin",
}
}
/>
</p>
<EuiTable
responsive={true}
@ -437,7 +472,11 @@ exports[`DetailDrawer component Plugin vertices Plugin has explicit ID shows bas
align="left"
textOnly={true}
>
Events Latency
<FormattedMessage
defaultMessage="Events Latency"
id="xpack.monitoring.logstash.pipeline.detailDrawer.eventsLatencyLabel"
values={Object {}}
/>
</EuiTableRowCell>
<EuiTableRowCell
align="left"
@ -491,7 +530,11 @@ exports[`DetailDrawer component Plugin vertices Plugin has explicit ID shows bas
align="left"
textOnly={true}
>
Events Emitted Rate
<FormattedMessage
defaultMessage="Events Emitted Rate"
id="xpack.monitoring.logstash.pipeline.detailDrawer.eventsEmittedRateLabel"
values={Object {}}
/>
</EuiTableRowCell>
<EuiTableRowCell
align="left"
@ -545,7 +588,11 @@ exports[`DetailDrawer component Plugin vertices Plugin has explicit ID shows bas
align="left"
textOnly={true}
>
Events Received
<FormattedMessage
defaultMessage="Events Received"
id="xpack.monitoring.logstash.pipeline.detailDrawer.eventsReceivedLabel"
values={Object {}}
/>
</EuiTableRowCell>
<EuiTableRowCell
align="left"
@ -599,7 +646,11 @@ exports[`DetailDrawer component Plugin vertices Plugin has explicit ID shows bas
align="left"
textOnly={true}
>
Events Emitted
<FormattedMessage
defaultMessage="Events Emitted"
id="xpack.monitoring.logstash.pipeline.detailDrawer.eventsEmittedLabel"
values={Object {}}
/>
</EuiTableRowCell>
<EuiTableRowCell
align="left"
@ -704,10 +755,18 @@ exports[`DetailDrawer component Queue vertices shows basic info and no stats for
size="m"
>
<p>
This is an internal structure used by Logstash to buffer events between inputs and the rest of the pipeline.
<FormattedMessage
defaultMessage="This is an internal structure used by Logstash to buffer events between inputs and the rest of the pipeline."
id="xpack.monitoring.logstash.pipeline.detailDrawer.structureDescription"
values={Object {}}
/>
</p>
<p>
There are currently no metrics to show for the queue.
<FormattedMessage
defaultMessage="There are currently no metrics to show for the queue."
id="xpack.monitoring.logstash.pipeline.detailDrawer.noMetricsForQueueDescription"
values={Object {}}
/>
</p>
</EuiText>
</EuiFlyoutBody>

View file

@ -14,7 +14,11 @@ exports[`Queue component renders default elements 1`] = `
grow={true}
size="m"
>
Queue metrics not available
<FormattedMessage
defaultMessage="Queue metrics not available"
id="xpack.monitoring.logstash.pipeline.queue.noMetricsDescription"
values={Object {}}
/>
</EuiText>
</div>
`;

View file

@ -94,7 +94,7 @@ exports[`Statement component renders a PluginStatement component for plugin mode
<div
className="monPipelineViewer__spaceContainer"
/>
<PluginStatement
<InjectIntl(PluginStatementUi)
onShowVertexDetails={[MockFunction]}
statement={
PluginStatement {

View file

@ -6,7 +6,7 @@
import React from 'react';
import { PipelineViewer } from '../pipeline_viewer';
import { shallow } from 'enzyme';
import { shallowWithIntl } from '../../../../../../../../test_utils/enzyme_helpers.js';
import { get } from 'lodash';
describe('PipelineViewer component', () => {
@ -44,11 +44,11 @@ describe('PipelineViewer component', () => {
},
};
component = <PipelineViewer pipeline={pipeline} />;
component = <PipelineViewer.WrappedComponent pipeline={pipeline} />;
});
it('passes expected props', () => {
const renderedComponent = shallow(component);
const renderedComponent = shallowWithIntl(component);
expect(renderedComponent).toMatchSnapshot();
});
@ -56,7 +56,7 @@ describe('PipelineViewer component', () => {
it('changes selected vertex', () => {
const vertex = { id: 'stdin' };
const instance = shallow(component).instance();
const instance = shallowWithIntl(component).instance();
instance.onShowVertexDetails(vertex);
expect(get(instance, 'state.detailDrawer.vertex')).toBe(vertex);
@ -65,7 +65,7 @@ describe('PipelineViewer component', () => {
it('toggles selected vertex on second pass', () => {
const vertex = { id: 'stdin' };
const instance = shallow(component).instance();
const instance = shallowWithIntl(component).instance();
instance.onShowVertexDetails(vertex);
instance.onShowVertexDetails(vertex);
@ -75,7 +75,7 @@ describe('PipelineViewer component', () => {
it('renders DetailDrawer when selected vertex is not null', () => {
const vertex = { id: 'stdin' };
const wrapper = shallow(component);
const wrapper = shallowWithIntl(component);
const instance = wrapper.instance();
instance.onShowVertexDetails(vertex);
wrapper.update();

View file

@ -6,7 +6,7 @@
import React from 'react';
import { PluginStatement } from '../plugin_statement';
import { shallow } from 'enzyme';
import { shallowWithIntl } from '../../../../../../../../test_utils/enzyme_helpers.js';
import { EuiButtonEmpty, EuiBadge } from '@elastic/eui';
@ -49,7 +49,7 @@ describe('PluginStatement component', () => {
};
});
const render = props => shallow(<PluginStatement {...props} />);
const render = props => shallowWithIntl(<PluginStatement.WrappedComponent {...props} />);
it('renders input metrics and explicit id fields', () => {
expect(render(props)).toMatchSnapshot();

View file

@ -25,6 +25,7 @@ import {
} from '@elastic/eui';
import { Sparkline } from '../../../sparkline';
import { formatMetric } from '../../../../lib/format_number';
import { FormattedMessage } from '@kbn/i18n/react';
function renderIcon(vertex) {
return (
@ -46,7 +47,12 @@ function renderPluginBasicStats(vertex, timeseriesTooltipXValueFormatter) {
? null
: (
<EuiTableRow key="events_latency">
<EuiTableRowCell>Events Latency</EuiTableRowCell>
<EuiTableRowCell>
<FormattedMessage
id="xpack.monitoring.logstash.pipeline.detailDrawer.eventsLatencyLabel"
defaultMessage="Events Latency"
/>
</EuiTableRowCell>
<EuiTableRowCell>
<div className="lspvDetailDrawerSparklineContainer">
<Sparkline
@ -69,7 +75,12 @@ function renderPluginBasicStats(vertex, timeseriesTooltipXValueFormatter) {
const eventsOutRateValueFormatter = (value) => formatMetric(value, '0.[0]a', 'e/s');
const eventsOutRateRow = (
<EuiTableRow key="events_out_rate">
<EuiTableRowCell>Events Emitted Rate</EuiTableRowCell>
<EuiTableRowCell>
<FormattedMessage
id="xpack.monitoring.logstash.pipeline.detailDrawer.eventsEmittedRateLabel"
defaultMessage="Events Emitted Rate"
/>
</EuiTableRowCell>
<EuiTableRowCell>
<div className="lspvDetailDrawerSparklineContainer">
<Sparkline
@ -99,7 +110,12 @@ function renderPluginBasicStats(vertex, timeseriesTooltipXValueFormatter) {
? null
: (
<EuiTableRow key="events_in">
<EuiTableRowCell>Events Received</EuiTableRowCell>
<EuiTableRowCell>
<FormattedMessage
id="xpack.monitoring.logstash.pipeline.detailDrawer.eventsReceivedLabel"
defaultMessage="Events Received"
/>
</EuiTableRowCell>
<EuiTableRowCell>
<div className="lspvDetailDrawerSparklineContainer">
<Sparkline
@ -126,7 +142,12 @@ function renderPluginBasicStats(vertex, timeseriesTooltipXValueFormatter) {
: null;
const eventsOutRow = (
<EuiTableRow key="events_out">
<EuiTableRowCell>Events Emitted</EuiTableRowCell>
<EuiTableRowCell>
<FormattedMessage
id="xpack.monitoring.logstash.pipeline.detailDrawer.eventsEmittedLabel"
defaultMessage="Events Emitted"
/>
</EuiTableRowCell>
<EuiTableRowCell>
<div className="lspvDetailDrawerSparklineContainer">
<Sparkline
@ -160,13 +181,23 @@ function renderPluginBasicStats(vertex, timeseriesTooltipXValueFormatter) {
function renderIfBasicStats(_vertex) {
return (
<p>There are currently no metrics to show for this if condition.</p>
<p>
<FormattedMessage
id="xpack.monitoring.logstash.pipeline.detailDrawer.noMetricsForIfDescription"
defaultMessage="There are currently no metrics to show for this if condition."
/>
</p>
);
}
function renderQueueBasicStats(_vertex) {
return (
<p>There are currently no metrics to show for the queue.</p>
<p>
<FormattedMessage
id="xpack.monitoring.logstash.pipeline.detailDrawer.noMetricsForQueueDescription"
defaultMessage="There are currently no metrics to show for the queue."
/>
</p>
);
}
@ -187,15 +218,25 @@ function renderBasicStats(vertex, timeseriesTooltipXValueFormatter) {
function renderPluginBasicInfo(vertex) {
if (vertex.hasExplicitId) {
return (
<p>This {vertex.typeString}&#39;s ID is <EuiBadge>{ vertex.id }</EuiBadge>.</p>
<p>
<FormattedMessage
id="xpack.monitoring.logstash.pipeline.detailDrawer.vertexIdDescription"
defaultMessage="This {vertexType}&#39;s ID is {vertexId}."
values={{ vertexType: vertex.typeString, vertexId: (<EuiBadge>{ vertex.id }</EuiBadge>) }}
/>
</p>
);
}
return (
<div>
<p>
This {vertex.typeString} does not have an ID explicitly specified. Specifying an ID allows you to track differences
across pipeline changes. You can explicitly specify an ID for this plugin like so:
<FormattedMessage
id="xpack.monitoring.logstash.pipeline.detailDrawer.specifyVertexIdDescription"
defaultMessage="This {vertexType} does not have an ID explicitly specified. Specifying an ID allows you to track differences
across pipeline changes. You can explicitly specify an ID for this plugin like so:"
values={{ vertexType: vertex.typeString }}
/>
</p>
<EuiCodeBlock>
{vertex.name} {`{
@ -215,7 +256,10 @@ function renderIfBasicInfo(vertex) {
return (
<div>
<p>
This is a conditional statement in your pipeline.
<FormattedMessage
id="xpack.monitoring.logstash.pipeline.detailDrawer.conditionalStatementDescription"
defaultMessage="This is a conditional statement in your pipeline."
/>
</p>
<EuiCodeBlock>{ ifCode }</EuiCodeBlock>
<EuiSpacer />
@ -226,8 +270,11 @@ function renderIfBasicInfo(vertex) {
function renderQueueBasicInfo(_vertex) {
return (
<p>
This is an internal structure used by Logstash to buffer events between
inputs and the rest of the pipeline.
<FormattedMessage
id="xpack.monitoring.logstash.pipeline.detailDrawer.structureDescription"
defaultMessage="This is an internal structure used by Logstash to buffer events between
inputs and the rest of the pipeline."
/>
</p>
);
}

View file

@ -9,6 +9,7 @@ import PropTypes from 'prop-types';
import { DetailDrawer } from './detail_drawer';
import { Queue } from './queue';
import { StatementSection } from './statement_section';
import { injectI18n } from '@kbn/i18n/react';
import {
EuiSpacer,
EuiPage,
@ -16,7 +17,7 @@ import {
EuiPageBody,
} from '@elastic/eui';
export class PipelineViewer extends React.Component {
class PipelineViewerUi extends React.Component {
constructor() {
super();
this.state = {
@ -68,6 +69,7 @@ export class PipelineViewer extends React.Component {
outputs,
queue
} = this.props.pipeline;
const { intl } = this.props;
return (
<EuiPage>
@ -75,7 +77,7 @@ export class PipelineViewer extends React.Component {
<EuiPageContent verticalPosition="center" horizontalPosition="center" className="monPipelineViewer">
<StatementSection
iconType="logstashInput"
headingText="Inputs"
headingText={intl.formatMessage({ id: 'xpack.monitoring.logstash.pipelineViewer.inputsTitle', defaultMessage: 'Inputs' })}
elements={inputs}
onShowVertexDetails={this.onShowVertexDetails}
detailVertex={this.state.detailDrawer.vertex}
@ -85,7 +87,7 @@ export class PipelineViewer extends React.Component {
<EuiSpacer />
<StatementSection
iconType="logstashFilter"
headingText="Filters"
headingText={intl.formatMessage({ id: 'xpack.monitoring.logstash.pipelineViewer.filtersTitle', defaultMessage: 'Filters' })}
elements={filters}
onShowVertexDetails={this.onShowVertexDetails}
detailVertex={this.state.detailDrawer.vertex}
@ -93,7 +95,7 @@ export class PipelineViewer extends React.Component {
<EuiSpacer />
<StatementSection
iconType="logstashOutput"
headingText="Outputs"
headingText={intl.formatMessage({ id: 'xpack.monitoring.logstash.pipelineViewer.outputsTitle', defaultMessage: 'Outputs' })}
elements={outputs}
onShowVertexDetails={this.onShowVertexDetails}
detailVertex={this.state.detailDrawer.vertex}
@ -106,7 +108,7 @@ export class PipelineViewer extends React.Component {
}
}
PipelineViewer.propTypes = {
PipelineViewerUi.propTypes = {
pipeline: PropTypes.shape({
inputs: PropTypes.array.isRequired,
filters: PropTypes.array.isRequired,
@ -114,3 +116,5 @@ PipelineViewer.propTypes = {
queue: PropTypes.object.isRequired,
}).isRequired
};
export const PipelineViewer = injectI18n(PipelineViewerUi);

View file

@ -14,6 +14,7 @@ import {
} from '@elastic/eui';
import { formatMetric } from '../../../../lib/format_number';
import { Metric } from './metric';
import { injectI18n } from '@kbn/i18n/react';
function getInputStatementMetrics({ latestEventsPerSecond }) {
return [
@ -64,9 +65,10 @@ function renderPluginStatementMetrics(pluginType, vertex) {
: getProcessorStatementMetrics(vertex);
}
export function PluginStatement({
function PluginStatementUi({
statement: { hasExplicitId, id, name, pluginType, vertex },
onShowVertexDetails,
intl,
}) {
const statementMetrics = renderPluginStatementMetrics(pluginType, vertex);
const onNameButtonClick = () => {
@ -99,7 +101,9 @@ export function PluginStatement({
<EuiFlexItem grow={false}>
<EuiBadge
onClick={onNameButtonClick}
onClickAriaLabel="View details"
onClickAriaLabel={intl.formatMessage({
id: 'xpack.monitoring.logstash.pipelineStatement.viewDetailsAriaLabel', defaultMessage: 'View details'
})}
>
{id}
</EuiBadge>
@ -116,7 +120,7 @@ export function PluginStatement({
);
}
PluginStatement.propTypes = {
PluginStatementUi.propTypes = {
onShowVertexDetails: PropTypes.func.isRequired,
statement: PropTypes.shape({
hasExplicitId: PropTypes.bool.isRequired,
@ -130,3 +134,5 @@ PluginStatement.propTypes = {
}).isRequired,
}).isRequired,
};
export const PluginStatement = injectI18n(PluginStatementUi);

View file

@ -7,6 +7,7 @@
import React from 'react';
import { StatementListHeading } from './statement_list_heading';
import { EuiSpacer, EuiText } from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';
export function Queue() {
return (
@ -14,7 +15,10 @@ export function Queue() {
<StatementListHeading iconType="logstashQueue" title="Queue" />
<EuiSpacer size="s" />
<EuiText className="monPipelineViewer__queueMessage">
Queue metrics not available
<FormattedMessage
id="xpack.monitoring.logstash.pipeline.queue.noMetricsDescription"
defaultMessage="Queue metrics not available"
/>
</EuiText>
</div>
);

View file

@ -8,6 +8,7 @@ import React from 'react';
import { render } from 'react-dom';
import { uiModules } from 'ui/modules';
import { ClusterStatus } from 'plugins/monitoring/components/logstash/cluster_status';
import { I18nProvider } from '@kbn/i18n/react';
const uiModule = uiModules.get('monitoring/directives', []);
uiModule.directive('monitoringClusterStatusLogstash', () => {
@ -18,7 +19,7 @@ uiModule.directive('monitoringClusterStatusLogstash', () => {
},
link(scope, $el) {
scope.$watch('status', status => {
render(<ClusterStatus stats={status} />, $el[0]);
render(<I18nProvider><ClusterStatus stats={status} /></I18nProvider>, $el[0]);
});
}
};

View file

@ -21,16 +21,54 @@ import {
formatNumber,
formatPercentageUsage
} from '../../../lib/format_number';
import { i18n } from '@kbn/i18n';
import { FormattedMessage, I18nProvider } from '@kbn/i18n/react';
const filterFields = [ 'logstash.name', 'logstash.host', 'logstash.http_address' ];
const columns = [
{ title: 'Name', sortKey: 'logstash.name', sortOrder: SORT_ASCENDING },
{ title: 'CPU Usage', sortKey: 'process.cpu.percent' },
{ title: 'Load Average', sortKey: 'os.cpu.load_average.1m', },
{ title: 'JVM Heap Used', sortKey: 'jvm.mem.heap_used_percent' },
{ title: 'Events Ingested', sortKey: 'events.out' },
{ title: 'Config Reloads' },
{ title: 'Version', sortKey: 'logstash.version' }
{
title: i18n.translate('xpack.monitoring.logstash.nodes.nameTitle', {
defaultMessage: 'Name'
}),
sortKey: 'logstash.name',
sortOrder: SORT_ASCENDING
},
{
title: i18n.translate('xpack.monitoring.logstash.nodes.cpuUsageTitle', {
defaultMessage: 'CPU Usage'
}),
sortKey: 'process.cpu.percent'
},
{
title: i18n.translate('xpack.monitoring.logstash.nodes.loadAverageTitle', {
defaultMessage: 'Load Average'
}),
sortKey: 'os.cpu.load_average.1m',
},
{
title: i18n.translate('xpack.monitoring.logstash.nodes.jvmHeapUsedTitle', {
defaultMessage: '{javaVirtualMachine} Heap Used',
values: { javaVirtualMachine: 'JVM' }
}),
sortKey: 'jvm.mem.heap_used_percent'
},
{
title: i18n.translate('xpack.monitoring.logstash.nodes.eventsIngestedTitle', {
defaultMessage: 'Events Ingested'
}),
sortKey: 'events.out'
},
{
title: i18n.translate('xpack.monitoring.logstash.nodes.configReloadsTitle', {
defaultMessage: 'Config Reloads'
})
},
{
title: i18n.translate('xpack.monitoring.logstash.nodes.versionTitle', {
defaultMessage: 'Version'
}),
sortKey: 'logstash.version'
}
];
const nodeRowFactory = (scope, kbnUrl) => {
const goToNode = uuid => {
@ -73,8 +111,20 @@ const nodeRowFactory = (scope, kbnUrl) => {
</div>
</KuiTableRowCell>
<KuiTableRowCell>
<div className="monTableCell__splitNumber">{ props.reloads.successes } successes</div>
<div className="monTableCell__splitNumber">{ props.reloads.failures } failures</div>
<div className="monTableCell__splitNumber">
<FormattedMessage
id="xpack.monitoring.logstash.nodes.configReloadsSuccessCountLabel"
defaultMessage="{reloadsSuccesses} successes"
values={{ reloadsSuccesses: props.reloads.successes }}
/>
</div>
<div className="monTableCell__splitNumber">
<FormattedMessage
id="xpack.monitoring.logstash.nodes.configReloadsFailuresCountLabel"
defaultMessage="{reloadsFailures} failures"
values={{ reloadsFailures: props.reloads.failures }}
/>
</div>
</KuiTableRowCell>
<KuiTableRowCell>
<div className="monTableCell__version">
@ -87,7 +137,7 @@ const nodeRowFactory = (scope, kbnUrl) => {
};
const uiModule = uiModules.get('monitoring/directives', []);
uiModule.directive('monitoringLogstashNodeListing', kbnUrl => {
uiModule.directive('monitoringLogstashNodeListing', (kbnUrl, i18n) => {
return {
restrict: 'E',
scope: {
@ -101,20 +151,23 @@ uiModule.directive('monitoringLogstashNodeListing', kbnUrl => {
link: function (scope, $el) {
scope.$watch('nodes', (nodes = []) => {
const filterNodesPlaceholder = i18n('xpack.monitoring.logstash.filterNodesPlaceholder', { defaultMessage: 'Filter Nodes…' });
const nodesTable = (
<MonitoringTable
className="logstashNodesTable"
rows={nodes}
pageIndex={scope.pageIndex}
filterText={scope.filterText}
sortKey={scope.sortKey}
sortOrder={scope.sortOrder}
onNewState={scope.onNewState}
placeholder="Filter Nodes..."
filterFields={filterFields}
columns={columns}
rowComponent={nodeRowFactory(scope, kbnUrl)}
/>
<I18nProvider>
<MonitoringTable
className="logstashNodesTable"
rows={nodes}
pageIndex={scope.pageIndex}
filterText={scope.filterText}
sortKey={scope.sortKey}
sortOrder={scope.sortOrder}
onNewState={scope.onNewState}
placeholder={filterNodesPlaceholder}
filterFields={filterFields}
columns={columns}
rowComponent={nodeRowFactory(scope, kbnUrl)}
/>
</I18nProvider>
);
render(nodesTable, $el[0]);
});

View file

@ -8,6 +8,7 @@ import React from 'react';
import { render } from 'react-dom';
import { uiModules } from 'ui/modules';
import { DetailStatus } from 'plugins/monitoring/components/logstash/detail_status';
import { I18nProvider } from '@kbn/i18n/react';
const uiModule = uiModules.get('monitoring/directives', []);
uiModule.directive('monitoringLogstashNodeSummary', () => {
@ -18,7 +19,7 @@ uiModule.directive('monitoringLogstashNodeSummary', () => {
},
link(scope, $el) {
scope.$watch('logstash', logstash => {
render(<DetailStatus stats={logstash} />, $el[0]);
render(<I18nProvider><DetailStatus stats={logstash} /></I18nProvider>, $el[0]);
});
}
};

View file

@ -24,12 +24,29 @@ import { Sparkline } from 'plugins/monitoring/components/sparkline';
import { SORT_ASCENDING } from '../../../../common/constants';
import { formatMetric } from '../../../lib/format_number';
import { timefilter } from 'ui/timefilter';
import { i18n } from '@kbn/i18n';
const filterFields = [ 'id' ];
const columns = [
{ title: 'ID', sortKey: 'id', sortOrder: SORT_ASCENDING },
{ title: 'Events Emitted Rate', sortKey: 'latestThroughput' },
{ title: 'Number of Nodes', sortKey: 'latestNodesCount', }
{
title: i18n.translate('xpack.monitoring.logstash.pipelines.idTitle', {
defaultMessage: 'ID'
}),
sortKey: 'id',
sortOrder: SORT_ASCENDING
},
{
title: i18n.translate('xpack.monitoring.logstash.pipelines.eventsEmittedRateTitle', {
defaultMessage: 'Events Emitted Rate'
}),
sortKey: 'latestThroughput'
},
{
title: i18n.translate('xpack.monitoring.logstash.pipelines.numberOfNodesTitle', {
defaultMessage: 'Number of Nodes'
}),
sortKey: 'latestNodesCount',
}
];
const pipelineRowFactory = (onPipelineClick, onBrush, tooltipXValueFormatter, tooltipYValueFormatter) => {
@ -104,7 +121,7 @@ const pipelineRowFactory = (onPipelineClick, onBrush, tooltipXValueFormatter, to
};
const uiModule = uiModules.get('monitoring/directives', []);
uiModule.directive('monitoringLogstashPipelineListing', ($injector) => {
uiModule.directive('monitoringLogstashPipelineListing', ($injector, i18n) => {
const kbnUrl = $injector.get('kbnUrl');
const config = $injector.get('config');
@ -150,6 +167,10 @@ uiModule.directive('monitoringLogstashPipelineListing', ($injector) => {
return;
}
const filterPipelinesPlaceholder = i18n('xpack.monitoring.logstash.filterPipelinesPlaceholder', {
defaultMessage: 'Filter Pipelines…'
});
const pipelinesTable = (
<MonitoringTable
className="logstashPipelinesTable"
@ -159,7 +180,7 @@ uiModule.directive('monitoringLogstashPipelineListing', ($injector) => {
sortKey={scope.sortKey}
sortOrder={scope.sortOrder}
onNewState={scope.onNewState}
placeholder="Filter Pipelines..."
placeholder={filterPipelinesPlaceholder}
filterFields={filterFields}
columns={columns}
rowComponent={pipelineRowFactory(onPipelineClick, onBrush, tooltipXValueFormatter, tooltipYValueFormatter)}

View file

@ -12,6 +12,7 @@ import { PipelineViewer } from 'plugins/monitoring/components/logstash/pipeline_
import { Pipeline } from 'plugins/monitoring/components/logstash/pipeline_viewer/models/pipeline';
import { List } from 'plugins/monitoring/components/logstash/pipeline_viewer/models/list';
import { PipelineState } from 'plugins/monitoring/components/logstash/pipeline_viewer/models/pipeline_state';
import { I18nProvider } from '@kbn/i18n/react';
const uiModule = uiModules.get('monitoring/directives', []);
uiModule.directive('monitoringLogstashPipelineViewer', $injector => {
@ -33,12 +34,14 @@ uiModule.directive('monitoringLogstashPipelineViewer', $injector => {
pipelineState.update(updatedPipeline);
render(
<PipelineViewer
pipeline={List.fromPipeline(
Pipeline.fromPipelineGraph(pipelineState.config.graph)
)}
timeseriesTooltipXValueFormatter={timeseriesTooltipXValueFormatter}
/>,
<I18nProvider>
<PipelineViewer
pipeline={List.fromPipeline(
Pipeline.fromPipelineGraph(pipelineState.config.graph)
)}
timeseriesTooltipXValueFormatter={timeseriesTooltipXValueFormatter}
/>
</I18nProvider>,
$el[0]
);
});

View file

@ -46,7 +46,7 @@ uiRoutes.when('/logstash/node/:uuid/advanced', {
},
pageData: getPageData
},
controller($injector, $scope) {
controller($injector, $scope, i18n) {
timefilter.enableTimeRangeSelector();
timefilter.enableAutoRefreshSelector();
@ -56,7 +56,13 @@ uiRoutes.when('/logstash/node/:uuid/advanced', {
$scope.pageData = $route.current.locals.pageData;
const title = $injector.get('title');
title($scope.cluster, `Logstash - ${$scope.pageData.nodeSummary.name} - Advanced`);
const routeTitle = i18n('xpack.monitoring.logstash.node.advanced.routeTitle', {
defaultMessage: 'Logstash - {nodeName} - Advanced',
values: {
nodeName: $scope.pageData.nodeSummary.name
}
});
title($scope.cluster, routeTitle);
const $executor = $injector.get('$executor');
$executor.register({

View file

@ -46,7 +46,7 @@ uiRoutes.when('/logstash/node/:uuid', {
},
pageData: getPageData
},
controller($injector, $scope) {
controller($injector, $scope, i18n) {
timefilter.enableTimeRangeSelector();
timefilter.enableAutoRefreshSelector();
@ -56,7 +56,13 @@ uiRoutes.when('/logstash/node/:uuid', {
$scope.pageData = $route.current.locals.pageData;
const title = $injector.get('title');
title($scope.cluster, `Logstash - ${$scope.pageData.nodeSummary.name}`);
const routeTitle = i18n('xpack.monitoring.logstash.node.routeTitle', {
defaultMessage: 'Logstash - {nodeName}',
values: {
nodeName: $scope.pageData.nodeSummary.name
}
});
title($scope.cluster, routeTitle);
const $executor = $injector.get('$executor');
$executor.register({

View file

@ -42,12 +42,18 @@ const getPageData = ($injector) => {
});
};
function makeUpgradeMessage(logstashVersion) {
function makeUpgradeMessage(logstashVersion, i18n) {
if (isPipelineMonitoringSupportedInVersion(logstashVersion)) {
return null;
}
return `Pipeline monitoring is only available in Logstash version 6.0.0 or higher. This node is running version ${logstashVersion}.`;
return i18n('xpack.monitoring.logstash.node.pipelines.notAvailableDescription', {
defaultMessage:
'Pipeline monitoring is only available in Logstash version 6.0.0 or higher. This node is running version {logstashVersion}.',
values: {
logstashVersion
}
});
}
uiRoutes
@ -60,7 +66,7 @@ uiRoutes
},
pageData: getPageData
},
controller($injector, $scope) {
controller($injector, $scope, i18n) {
const $route = $injector.get('$route');
const globalState = $injector.get('globalState');
const title = $injector.get('title');
@ -69,11 +75,17 @@ uiRoutes
$scope.cluster = find($route.current.locals.clusters, { cluster_uuid: globalState.cluster_uuid });
$scope.pageData = $route.current.locals.pageData;
$scope.upgradeMessage = makeUpgradeMessage($scope.pageData.nodeSummary.version);
$scope.upgradeMessage = makeUpgradeMessage($scope.pageData.nodeSummary.version, i18n);
timefilter.enableTimeRangeSelector();
timefilter.enableAutoRefreshSelector();
title($scope.cluster, `Logstash - ${$scope.pageData.nodeSummary.name} - Pipelines`);
const routeTitle = i18n('xpack.monitoring.logstash.node.pipelines.routeTitle', {
defaultMessage: 'Logstash - {nodeName} - Pipelines',
values: {
nodeName: $scope.pageData.nodeSummary.name
}
});
title($scope.cluster, routeTitle);
$executor.register({
execute: () => getPageData($injector),

View file

@ -1,7 +1,12 @@
<monitoring-main product="logstash" name="nodes">
<monitoring-cluster-status-logstash status="lsNodes.data.clusterStatus"></monitoring-cluster-status-logstash>
<div class="page-row">
<h3 class="kuiScreenReaderOnly">Logstash Nodes</h3>
<h3
class="kuiScreenReaderOnly"
i18n-id="xpack.monitoring.logstash.nodesTitle"
i18n-default-message="Logstash Nodes"
>
</h3>
<monitoring-logstash-node-listing
page-index="lsNodes.pageIndex"
filter-text="lsNodes.filterText"

View file

@ -23,9 +23,11 @@ uiRoutes.when('/logstash/nodes', {
controllerAs: 'lsNodes',
controller: class LsNodesList extends MonitoringViewBaseTableController {
constructor($injector, $scope) {
constructor($injector, $scope, i18n) {
super({
title: 'Logstash - Nodes',
title: i18n('xpack.monitoring.logstash.nodes.routeTitle', {
defaultMessage: 'Logstash - Nodes'
}),
storageKey: 'logstash.nodes',
getPageData,
$scope,

View file

@ -44,7 +44,7 @@ uiRoutes.when('/logstash', {
},
pageData: getPageData
},
controller($injector, $scope) {
controller($injector, $scope, i18n) {
timefilter.enableTimeRangeSelector();
timefilter.enableAutoRefreshSelector();
@ -54,7 +54,9 @@ uiRoutes.when('/logstash', {
$scope.pageData = $route.current.locals.pageData;
const title = $injector.get('title');
title($scope.cluster, 'Logstash');
title($scope.cluster, i18n('xpack.monitoring.logstash.overview.routeTitle', {
defaultMessage: 'Logstash'
}));
const $executor = $injector.get('$executor');
$executor.register({

View file

@ -15,6 +15,7 @@ import { CALCULATE_DURATION_SINCE } from '../../../../common/constants';
import { formatTimestampToDuration } from '../../../../common/format_timestamp_to_duration';
import template from './index.html';
import { timefilter } from 'ui/timefilter';
import { i18n } from '@kbn/i18n';
function getPageData($injector) {
const $route = $injector.get('$route');
@ -41,8 +42,16 @@ function getPageData($injector) {
return {
...version,
relativeFirstSeen: `${relativeFirstSeen} ago`,
relativeLastSeen: isLastSeenCloseToNow ? 'now' : `until ${relativeLastSeen} ago`
relativeFirstSeen: i18n.translate('xpack.monitoring.logstash.pipeline.relativeFirstSeenAgoLabel', {
defaultMessage: '{relativeFirstSeen} ago', values: { relativeFirstSeen }
}),
relativeLastSeen: isLastSeenCloseToNow ?
i18n.translate('xpack.monitoring.logstash.pipeline.relativeLastSeenNowLabel', {
defaultMessage: 'now'
})
: i18n.translate('xpack.monitoring.logstash.pipeline.relativeLastSeenAgoLabel', {
defaultMessage: 'until {relativeLastSeen} ago', values: { relativeLastSeen }
})
};
});
@ -63,7 +72,7 @@ uiRoutes.when('/logstash/pipelines/:id/:hash?', {
},
pageData: getPageData
},
controller($injector, $scope) {
controller($injector, $scope, i18n) {
const $route = $injector.get('$route');
const $executor = $injector.get('$executor');
const globalState = $injector.get('globalState');
@ -78,7 +87,9 @@ uiRoutes.when('/logstash/pipelines/:id/:hash?', {
}
setClusters($route.current.locals.clusters);
$scope.pageData = $route.current.locals.pageData;
title($scope.cluster, `Logstash - Pipeline`);
title($scope.cluster, i18n('xpack.monitoring.logstash.pipeline.routeTitle', {
defaultMessage: 'Logstash - Pipeline'
}));
$executor.register({
execute: () => getPageData($injector),

View file

@ -40,14 +40,16 @@ const getPageData = ($injector) => {
});
};
function makeUpgradeMessage(logstashVersions) {
function makeUpgradeMessage(logstashVersions, i18n) {
if (!Array.isArray(logstashVersions)
|| (logstashVersions.length === 0)
|| logstashVersions.some(isPipelineMonitoringSupportedInVersion)) {
return null;
}
return 'Pipeline monitoring is only available in Logstash version 6.0.0 or higher.';
return i18n('xpack.monitoring.logstash.pipelines.notAvalibleDescription', {
defaultMessage: 'Pipeline monitoring is only available in Logstash version 6.0.0 or higher.'
});
}
uiRoutes
@ -60,7 +62,7 @@ uiRoutes
},
pageData: getPageData
},
controller($injector, $scope) {
controller($injector, $scope, i18n) {
const $route = $injector.get('$route');
const globalState = $injector.get('globalState');
const title = $injector.get('title');
@ -69,11 +71,13 @@ uiRoutes
$scope.cluster = find($route.current.locals.clusters, { cluster_uuid: globalState.cluster_uuid });
$scope.pageData = $route.current.locals.pageData;
$scope.upgradeMessage = makeUpgradeMessage($scope.pageData.clusterStatus.versions);
$scope.upgradeMessage = makeUpgradeMessage($scope.pageData.clusterStatus.versions, i18n);
timefilter.enableTimeRangeSelector();
timefilter.enableAutoRefreshSelector();
title($scope.cluster, 'Logstash Pipelines');
title($scope.cluster, i18n('xpack.monitoring.logstash.pipelines.routeTitle', {
defaultMessage: 'Logstash Pipelines'
}));
$executor.register({
execute: () => getPageData($injector),