Skip to content

Commit dfc0915

Browse files
committed
Also add metrics for the saved visualizations for the past 7 days
1 parent 3df908c commit dfc0915

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

x-pack/plugins/oss_telemetry/server/lib/tasks/visualizations/task_runner.test.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ describe('visualizationsTaskRunner', () => {
5656
spaces_max: 1,
5757
spaces_min: 1,
5858
total: 1,
59+
saved_7_days_total: 1,
5960
saved_30_days_total: 1,
6061
saved_90_days_total: 1,
6162
},
@@ -157,6 +158,7 @@ describe('visualizationsTaskRunner', () => {
157158
spaces_min: 1,
158159
spaces_max: 1,
159160
spaces_avg: 1,
161+
saved_7_days_total: 1,
160162
saved_30_days_total: 2,
161163
saved_90_days_total: 3,
162164
},
@@ -165,6 +167,7 @@ describe('visualizationsTaskRunner', () => {
165167
spaces_min: 1,
166168
spaces_max: 1,
167169
spaces_avg: 1,
170+
saved_7_days_total: 0,
168171
saved_30_days_total: 1,
169172
saved_90_days_total: 1,
170173
},
@@ -173,6 +176,7 @@ describe('visualizationsTaskRunner', () => {
173176
spaces_min: 2,
174177
spaces_max: 2,
175178
spaces_avg: 2,
179+
saved_7_days_total: 1,
176180
saved_30_days_total: 1,
177181
saved_90_days_total: 1,
178182
},
@@ -181,6 +185,7 @@ describe('visualizationsTaskRunner', () => {
181185
spaces_min: 2,
182186
spaces_max: 2,
183187
spaces_avg: 2,
188+
saved_7_days_total: 2,
184189
saved_30_days_total: 2,
185190
saved_90_days_total: 3,
186191
},

x-pack/plugins/oss_telemetry/server/lib/tasks/visualizations/task_runner.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ async function getStats(callCluster: APICaller, index: string) {
7575
spaces_min: _.min(spaceCounts),
7676
spaces_max: _.max(spaceCounts),
7777
spaces_avg: total / spaceCounts.length,
78+
saved_7_days_total: curr.filter((c) => c.past_days <= 7).length,
7879
saved_30_days_total: curr.filter((c) => c.past_days <= 30).length,
7980
saved_90_days_total: curr.filter((c) => c.past_days <= 90).length,
8081
};

0 commit comments

Comments
 (0)