Repository navigation
[API-142] Power api metrics from api_metrics_* tables - #572
Conversation
| Name: metric.Name, | ||
| Count: metric.Count, | ||
| result := []AppMetric{} | ||
| for rows.Next() { |
There was a problem hiding this comment.
Any reason you're preferring the manual iteration/scan here or is it just what the AI chose?
There was a problem hiding this comment.
yaaa, ill use collectrows good call
| {"year", "year", 100}, | ||
| } | ||
|
|
||
| for _, tt := range tests { |
There was a problem hiding this comment.
ooooo generated test cases let's go
| } | ||
|
|
||
| type GetMetricsRoutesQueryParams struct { | ||
| BucketSize string `query:"bucket_size" default:"day"` |
There was a problem hiding this comment.
oneof validation on this?
| // Exclude current incomplete week | ||
| dateRangeClause = dateRangeClause + " AND date_trunc('week', date) < date_trunc('week', CURRENT_DATE)" | ||
| case "month": | ||
| bucketClause = "date_trunc('month', date)::date::text AS bucket" |
| } | ||
|
|
||
| type GetMetricsRoutesTrailingRouteParams struct { | ||
| TimeRange string `params:"time_range" default:"month"` |
There was a problem hiding this comment.
optional nit: validation/oneof
| {"all_time_day", "all_time", "day"}, | ||
| {"year_month", "year", "month"}, | ||
| {"month_day", "month", "day"}, | ||
| {"week_day", "week", "day"}, |
There was a problem hiding this comment.
Do we need any tests for invalid combinations here? Are there invalid combinations?
There was a problem hiding this comment.
yeah I guess "week_month" works, but makes almost no sense... however, i doesn't actually error. it just gives you what you want - a weeks' worth of data bucketed to the nearest month
Remove old queries + usage of old discovery node tables
Manually wrote migrations to bring over old data from existing aggregate_* tables
Tested via running protocol dashboard against local api server
