Skip to content

Commit

Permalink
examples: tweak npm download counts to not emit warnings
Browse files Browse the repository at this point in the history
Some odd interactions with mismatched intervals started happening
when the new week began at 5pm today that caused nulls to be generated
from the moving window reducer that triggered warnings in the program
output.

Update the program so that we pass the interval along properly to the
trend sub and the views so there are no more warnings.
  • Loading branch information
demmer committed Mar 11, 2016
1 parent bce53df commit 0112cab
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions examples/core-juttle/npm_download_counts.juttle
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ sub rollup(interval) {
}

// Add a rolling average series
sub trend(window, label) {
(pass; reduce -every :1d: -over window value=Math.floor(avg(value)), name=label)
sub trend(interval, window, label) {
(pass; reduce -every interval -over window value=Math.floor(avg(value)), name=label)
}

sub chart(interval, label, row, col, color) {
Expand All @@ -42,11 +42,11 @@ sub chart(interval, label, row, col, color) {
title;
fetch
| (
rollup -interval :1d: | trend -window :28d: -label '28 day trend'
rollup -interval :1d: | trend -interval :1d: -window :28d: -label '28 day trend'
| chart -interval :1d: -label 'day' -row 1 -col 0 -color '#A4B946';

rollup -interval :1w: | trend -window :10w: -label '10 week trend'
| chart -interval :1d: -label 'week' -row 1 -col 1 -color '#79E0CB';
rollup -interval :1w: | trend -interval :1w: -window :10w: -label '10 week trend'
| chart -interval :1w: -label 'week' -row 1 -col 1 -color '#79E0CB';

rollup -interval :1M:
| chart -interval :1d: -label 'month' -row 2 -col 0 -color '#666E4C';
Expand Down

0 comments on commit 0112cab

Please sign in to comment.