Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions source/use-cases/pre-aggregated-reports.txt
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ updates. Consider the following :py:func:`preallocate` function:
'page': page }
# Get monthly metadata
monthly_metadata = {
'date': daily_m['d'].replace(day=1),
'date': daily_metadata['date'].replace(day=1),
'site': site,
'page': page }

Expand Down Expand Up @@ -432,7 +432,7 @@ probability," you can limit redundant :py:func:`preallocate` calls.

def log_hit(db, dt_utc, site, page):
if random.random() < prob_preallocate:
preallocate(db, dt_utc + timedelta(days=1), site_page)
preallocate(db, dt_utc + timedelta(days=1), site, page)
# Update daily stats doc
...

Expand All @@ -458,7 +458,7 @@ resource (i.e. ``/index.html``) with minute-level granularity:

.. code-block:: pycon

>>>``db.stats.daily.find_one(
>>> db.stats.daily.find_one(
... {'metadata': {'date':dt, 'site':'site-1', 'page':'/index.html'}},
... { 'minute': 1 })

Expand All @@ -469,7 +469,7 @@ over the last day, with hour-level granularity:

>>> db.stats.daily.find_one(
... {'metadata': {'date':dt, 'site':'site-1', 'page':'/foo.gif'}},
... { 'hy': 1 })
... { 'hourly': 1 })

If you want a few days of hourly data, you can use a query in the
following form:
Expand Down