Skip to content
This repository has been archived by the owner on Mar 31, 2024. It is now read-only.

Commit

Permalink
[Logs UI] Remove scaling and pre-aggregation in datafeed (elastic#44268)
Browse files Browse the repository at this point in the history
This simplifies the datafeed configuration by removing the date histogram aggregation and the bucket script, that scaled the document count. It also adjusts the chart's y axis label accordingly.

Additionally it adds a `job_revision` metadata item to the job config that we can use to detect outdated job configs in the future in order to prompt the user to reinstall new jobs.
  • Loading branch information
weltenwort authored Aug 28, 2019
1 parent 0d7ae43 commit c72a22e
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 58 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,35 +51,7 @@ export const callSetupMlModuleAPI = async (
},
},
],
datafeedOverrides: [
{
job_id: 'log-entry-rate',
aggregations: {
buckets: {
date_histogram: {
field: timeField,
fixed_interval: `${bucketSpan}ms`,
},
aggregations: {
[timeField]: {
max: {
field: `${timeField}`,
},
},
doc_count_per_minute: {
bucket_script: {
script: {
params: {
bucket_span_in_ms: bucketSpan,
},
},
},
},
},
},
},
},
],
datafeedOverrides: [],
})
),
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export const ChartView = ({ data, timeRange }: Props) => {
<Axis
id={getAxisId('values')}
title={i18n.translate('xpack.infra.logs.analysis.logRateSectionYaxisTitle', {
defaultMessage: 'Log entries per minute',
defaultMessage: 'Log entries per 15 minutes',
})}
position="left"
tickFormat={value => Number(value).toFixed(0)}
Expand Down Expand Up @@ -128,7 +128,7 @@ export const ChartView = ({ data, timeRange }: Props) => {
<LineSeries
id={lineSpecId}
name={i18n.translate('xpack.infra.logs.analysis.logRateSectionLineSeriesName', {
defaultMessage: 'Log entries (avg)',
defaultMessage: 'Log entries per 15 minutes (avg)',
})}
xScaleType="time"
yScaleType="linear"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,28 +1,4 @@
{
"job_id": "JOB_ID",
"indexes": ["INDEX_PATTERN_NAME"],
"aggregations": {
"buckets": {
"date_histogram": {
"field": "@timestamp",
"fixed_interval": "900000ms"
},
"aggregations": {
"doc_count_per_minute": {
"bucket_script": {
"buckets_path": {
"doc_count": "_count"
},
"script": {
"lang": "painless",
"params": {
"bucket_span_in_ms": 900000
},
"source": "60 * 1000 * params.doc_count / params.bucket_span_in_ms"
}
}
}
}
}
}
"indexes": ["INDEX_PATTERN_NAME"]
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"groups": ["logs-ui"],
"analysis_config": {
"bucket_span": "15m",
"summary_count_field_name": "doc_count_per_minute",
"detectors": [
{
"detector_description": "count",
Expand All @@ -25,6 +24,7 @@
"enabled": true
},
"custom_settings": {
"created_by": "ml-module-logs-ui-analysis"
"created_by": "ml-module-logs-ui-analysis",
"job_revision": 1
}
}

0 comments on commit c72a22e

Please sign in to comment.