feat(metrics): add runs by day and update returned types - #584
Merged
Conversation
Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev>
Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note to reviewer: There are a lot of changes in the generated code in
internal/data/ent. This is because I've enabled the modifier feature flag, to be able to group byDate(timestamp), and regenerated the bindings.This patch implements two things
1 - Adds a metrics count by day and state endpoint
This endpoint by default returns the number of runs grouped by day and status for the provided time window
{ "result": [ { "date": "2024-02-09", "metrics": { "count": 1, "status": "RUN_STATUS_SUCCEEDED" } }, { "date": "2024-02-10", "metrics": { "count": 1, "status": "RUN_STATUS_SUCCEEDED" } }, { "date": "2024-02-11", "metrics": { "count": 1, "status": "RUN_STATUS_SUCCEEDED" } }, { "date": "2024-02-12", "metrics": { "count": 3, "status": "RUN_STATUS_SUCCEEDED" } }, { "date": "2024-02-13", "metrics": { "count": 2, "status": "RUN_STATUS_SUCCEEDED" } }, { "date": "2024-02-14", "metrics": { "count": 3, "status": "RUN_STATUS_EXPIRED" } ...Optionally it can be filtered by workflow_id
2 - Strong type existing metrics endpoints
Strongly type the runner and state aggregation fields used in the metrics endpoint.
controlplane.v1.OrgMetricsService.Totals
controlplane.v1.OrgMetricsService.TopWorkflowsByRunsCount
cc/ @tknura
Closes #551