Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

adjust preview configuration for more data #39

Merged
merged 1 commit into from
Feb 4, 2020
Merged

adjust preview configuration for more data #39

merged 1 commit into from
Feb 4, 2020

Conversation

wnbts
Copy link
Contributor

@wnbts wnbts commented Jan 30, 2020

Currently, for preview requests, up to 60 data points are sampled and up to 200 results are returned to the client to reduce latency from processing and network. To improve visualization for human eyes, the changes increase the number of samples to match the requested time range, the upper limit of samples, and the number of returned results to clients.

preview

@wnbts wnbts marked this pull request as ready for review January 30, 2020 20:07
@@ -317,7 +321,8 @@ public void getPreviewFeatures(AnomalyDetector detector, long startMilli, long e
long end = truncateToMinute(endMilli);
long bucketSize = ((IntervalTimeConfiguration) detector.getDetectionInterval()).toDuration().toMillis();
int numBuckets = (int) Math.floor((end - start) / (double) bucketSize);
int stride = (int) Math.max(1, Math.floor((double) numBuckets / maxPreviewSamples));
int numSamples = (int) Math.min(numBuckets * previewSampleRate, maxPreviewSamples);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion,
int numSamples = Math.max(1, (int) Math.min(numBuckets * previewSampleRate, maxPreviewSamples));
to avoid numSamples being 0.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed. Thank you!

Copy link
Contributor

@ylwu-amzn ylwu-amzn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for make this change

@wnbts wnbts merged commit fc2c568 into opendistro-for-elasticsearch:development Feb 4, 2020
@wnbts wnbts deleted the preview-sample branch September 11, 2020 01:51
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants