File tree Expand file tree Collapse file tree 2 files changed +12
-12
lines changed
Expand file tree Collapse file tree 2 files changed +12
-12
lines changed Original file line number Diff line number Diff line change 11import RedisHelper from '../redisHelper' ;
2- import { composeTimeSeriesKey , getTimeSeriesSuffix } from '../utils/chartStorageKeys' ;
2+ import { composeProjectMetricsKey , getTimeSeriesSuffix } from '../utils/chartStorageKeys' ;
33
44/**
55 * Service for fetching chart data from Redis TimeSeries
@@ -35,9 +35,9 @@ export default class ChartDataService {
3535 throw new Error ( 'Redis client not connected' ) ;
3636 }
3737
38- // Determine suffix and compose key
39- const suffix = getTimeSeriesSuffix ( groupBy ) ;
40- const key = composeTimeSeriesKey ( suffix , projectId ) ;
38+ // Determine granularity and compose key
39+ const granularity = getTimeSeriesSuffix ( groupBy ) ;
40+ const key = composeProjectMetricsKey ( granularity , projectId ) ;
4141
4242 // Parse ISO date strings to milliseconds
4343 const start = new Date ( startDate ) . getTime ( ) ;
Original file line number Diff line number Diff line change 33 */
44
55/**
6- * Compose Redis TimeSeries key for project metrics
6+ * Compose Redis TimeSeries key for project-level metrics
77 *
8- * @param suffix - time granularity suffix (minutely, hourly, daily)
8+ * @param granularity - time granularity (minutely, hourly, daily)
99 * @param projectId - project ID
1010 * @param metricType - metric type (default: 'events-accepted')
11- * @returns Redis key string
11+ * @returns Redis key string in format: ts:project-{metricType}:{projectId}:{granularity}
1212 *
1313 * @example
14- * composeTimeSeriesKey ('hourly', '123abc')
14+ * composeProjectMetricsKey ('hourly', '123abc')
1515 * // => 'ts:project-events-accepted:123abc:hourly'
1616 *
1717 * @example
18- * composeTimeSeriesKey ('daily', '123abc', 'events-rate-limited')
18+ * composeProjectMetricsKey ('daily', '123abc', 'events-rate-limited')
1919 * // => 'ts:project-events-rate-limited:123abc:daily'
2020 */
21- export function composeTimeSeriesKey (
22- suffix : string ,
21+ export function composeProjectMetricsKey (
22+ granularity : string ,
2323 projectId : string ,
2424 metricType = 'events-accepted'
2525) : string {
26- return `ts:project-${ metricType } :${ projectId } :${ suffix } ` ;
26+ return `ts:project-${ metricType } :${ projectId } :${ granularity } ` ;
2727}
2828
2929/**
You can’t perform that action at this time.
0 commit comments