-
Notifications
You must be signed in to change notification settings - Fork 8.6k
[TSVB] Math params._interval is incorrect when using entire timerange mode #100775
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
6c245d3
[TSVB] Math params._interval is incorrect when using entire timerange…
alexwizp 800e665
fix jest
alexwizp b110d02
Merge branch 'master' into 100615
kibanamachine 9922d44
rename get -> overwrite
alexwizp 74288d5
apply fix for "bucket script"
alexwizp 2ceeb47
Merge remote-tracking branch 'upstream/master' into 100615
alexwizp 5ef6b20
Update date_histogram.js
alexwizp File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -86,7 +86,6 @@ describe('dateHistogram(req, panel, series)', () => { | |
| }, | ||
| }, | ||
| meta: { | ||
| bucketSize: 10, | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| intervalString: '10s', | ||
| timeField: '@timestamp', | ||
| seriesId: 'test', | ||
|
|
@@ -128,7 +127,6 @@ describe('dateHistogram(req, panel, series)', () => { | |
| }, | ||
| }, | ||
| meta: { | ||
| bucketSize: 10, | ||
| intervalString: '10s', | ||
| timeField: '@timestamp', | ||
| seriesId: 'test', | ||
|
|
@@ -173,7 +171,6 @@ describe('dateHistogram(req, panel, series)', () => { | |
| }, | ||
| }, | ||
| meta: { | ||
| bucketSize: 20, | ||
| intervalString: '20s', | ||
| timeField: 'timestamp', | ||
| seriesId: 'test', | ||
|
|
@@ -185,8 +182,11 @@ describe('dateHistogram(req, panel, series)', () => { | |
| }); | ||
|
|
||
| describe('dateHistogram for entire time range mode', () => { | ||
| test('should ignore entire range mode for timeseries', async () => { | ||
| beforeEach(() => { | ||
| panel.time_range_mode = 'entire_time_range'; | ||
| }); | ||
|
|
||
| test('should ignore entire range mode for timeseries', async () => { | ||
| panel.type = 'timeseries'; | ||
|
|
||
| const next = (doc) => doc; | ||
|
|
@@ -204,9 +204,36 @@ describe('dateHistogram(req, panel, series)', () => { | |
| expect(doc.aggs.test.aggs.timeseries.date_histogram).toBeDefined(); | ||
| }); | ||
|
|
||
| test('should returns valid date histogram for entire range mode', async () => { | ||
| panel.time_range_mode = 'entire_time_range'; | ||
| test('should set meta values', async () => { | ||
| // set 15 minutes (=== 900000ms) interval; | ||
| req.body.timerange = { | ||
| min: '2021-01-01T00:00:00Z', | ||
| max: '2021-01-01T00:15:00Z', | ||
| }; | ||
|
|
||
| const next = (doc) => doc; | ||
| const doc = await dateHistogram( | ||
| req, | ||
| panel, | ||
| series, | ||
| config, | ||
| indexPattern, | ||
| capabilities, | ||
| uiSettings | ||
| )(next)({}); | ||
|
|
||
| expect(doc.aggs.test.meta).toMatchInlineSnapshot(` | ||
| Object { | ||
| "index": undefined, | ||
| "intervalString": "900000ms", | ||
| "panelId": "panelId", | ||
| "seriesId": "test", | ||
| "timeField": "@timestamp", | ||
| } | ||
| `); | ||
| }); | ||
|
|
||
| test('should returns valid date histogram for entire range mode', async () => { | ||
| const next = (doc) => doc; | ||
| const doc = await dateHistogram( | ||
| req, | ||
|
|
@@ -232,8 +259,7 @@ describe('dateHistogram(req, panel, series)', () => { | |
| meta: { | ||
| timeField: '@timestamp', | ||
| seriesId: 'test', | ||
| bucketSize: 10, | ||
| intervalString: '10s', | ||
| intervalString: '3600000ms', | ||
| panelId: 'panelId', | ||
| }, | ||
| }, | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
according to the documentation there should be a string value here, not the size of the bucket
https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-pipeline-derivative-aggregation.html#_units