Skip to content

Commit 1fe3d01

Browse files
committed
Update redisKeys.ts
1 parent 14134f9 commit 1fe3d01

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/utils/redisKeys.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,23 @@
77
*
88
* @param suffix - time granularity suffix (minutely, hourly, daily)
99
* @param projectId - project ID
10+
* @param metricType - metric type (default: 'events-accepted')
1011
* @returns Redis key string
1112
*
1213
* @example
1314
* composeTimeSeriesKey('hourly', '123abc')
14-
* // => 'ts:events:123abc:hourly'
15+
* // => 'ts:project-events-accepted:123abc:hourly'
16+
*
17+
* @example
18+
* composeTimeSeriesKey('daily', '123abc', 'events-rate-limited')
19+
* // => 'ts:project-events-rate-limited:123abc:daily'
1520
*/
1621
export function composeTimeSeriesKey(
1722
suffix: string,
18-
projectId: string
23+
projectId: string,
24+
metricType = 'events-accepted'
1925
): string {
20-
return `ts:events:${projectId}:${suffix}`;
26+
return `ts:project-${metricType}:${projectId}:${suffix}`;
2127
}
2228

2329
/**

0 commit comments

Comments
 (0)