Datadog monitors telemetry ingestion for customer accounts. Write a PostgreSQL query that calculates each active account's daily telemetry ingestion rate and its rolling 7-day average from January 1 through January 7, 2024.
Requirements
- Include every active account for every date in the reporting period, including accounts with no telemetry.
- Aggregate multiple telemetry records for the same account and date into one daily ingestion rate. Treat missing or
NULL ingestion rates as zero.
- Use a window function partitioned by account and ordered by date to calculate the average across the current date and up to the six preceding calendar dates.
- Return account name, date, daily ingestion rate, and the rolling average, rounded to two decimal places. Order by account name and date.