runtime usage service#960
Conversation
There was a problem hiding this comment.
Pull request overview
Implements a “runtime usage” pipeline end-to-end: persists daily aggregated runtime usage per flow/namespace, exposes it via GraphQL connections (with date filtering), and accepts updates via a new gRPC RuntimeUsage service.
Changes:
- Add
daily_runtime_usagespersistence (migration, model, associations) and a gRPC update service/handler to record/increment usage. - Expose daily runtime usage via GraphQL (
Namespace.dailyRuntimeUsages,Flow.dailyRuntimeUsages) plus aDatescalar and new GraphQL type. - Add request/service/type specs and generate GraphQL docs for the new schema surface and error code.
Reviewed changes
Copilot reviewed 33 out of 33 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| spec/services/runtimes/grpc/runtime_usage_update_service_spec.rb | Unit coverage for usage update service behavior and validation. |
| spec/requests/grpc/sagittarius/runtime_usage_service_spec.rb | gRPC request spec for RuntimeUsageService update behavior. |
| spec/requests/graphql/query/namespace_runtime_usages_query_spec.rb | GraphQL query coverage for namespace-level usage retrieval and filters. |
| spec/requests/graphql/query/flow_runtime_usages_query_spec.rb | GraphQL query coverage for flow-level usage retrieval and date filtering. |
| spec/graphql/types/namespace_type_spec.rb | Updates Namespace type field expectations to include dailyRuntimeUsages. |
| spec/graphql/types/flow_type_spec.rb | Adds Flow type spec including dailyRuntimeUsages. |
| spec/graphql/types/date_type_spec.rb | Adds tests for the new Types::DateType scalar coercion. |
| spec/graphql/types/daily_runtime_usage_type_spec.rb | Adds GraphQL type coverage for DailyRuntimeUsage. |
| spec/factories/daily_runtime_usages.rb | Factory for DailyRuntimeUsage records. |
| extensions/cloud/spec/graphql/types/cloud/types/namespace_type_spec.rb | Updates Cloud extension Namespace type field expectations. |
| docs/graphql/scalar/float.md | Adds/records Float scalar documentation entry. |
| docs/graphql/scalar/date.md | Adds Date scalar documentation entry. |
| docs/graphql/scalar/dailyruntimeusageid.md | Adds scalar doc entry for DailyRuntimeUsageID. |
| docs/graphql/object/namespace.md | Documents Namespace.dailyRuntimeUsages field and arguments. |
| docs/graphql/object/flow.md | Documents Flow.dailyRuntimeUsages field and arguments. |
| docs/graphql/object/dailyruntimeusageedge.md | Adds connection edge documentation for daily runtime usage. |
| docs/graphql/object/dailyruntimeusageconnection.md | Adds connection documentation for daily runtime usage. |
| docs/graphql/object/dailyruntimeusage.md | Adds object documentation for daily runtime usage. |
| docs/graphql/enum/errorcodeenum.md | Documents the new INVALID_RUNTIME_USAGE error code. |
| db/structure.sql | Reflects the new daily_runtime_usages table and indexes. |
| db/schema_migrations/20260510081622 | Adds checksum file for the new migration per repo convention. |
| db/migrate/20260510081622_create_daily_runtime_usage.rb | Migration creating daily_runtime_usages table and FK behavior. |
| app/services/runtimes/grpc/runtime_usage_update_service.rb | Implements the transactional upsert/increment logic for daily usage. |
| app/services/error_code.rb | Registers invalid_runtime_usage error code. |
| app/models/namespace.rb | Adds has_many :daily_runtime_usages association. |
| app/models/flow.rb | Adds has_many :daily_runtime_usages association. |
| app/models/daily_runtime_usage.rb | New model for daily runtime usage with validations and relations. |
| app/grpc/runtime_usage_handler.rb | New gRPC handler wiring RuntimeUsageService update to the new service. |
| app/graphql/types/namespace_type.rb | Adds daily_runtime_usages connection field and resolver with filters. |
| app/graphql/types/namespace_project_type.rb | Fixes project flow lookup to use GlobalID model_id with find_by. |
| app/graphql/types/flow_type.rb | Adds daily_runtime_usages connection field and resolver with date filters. |
| app/graphql/types/date_type.rb | Adds custom Date scalar (ISO8601) for GraphQL. |
| app/graphql/types/daily_runtime_usage_type.rb | Adds GraphQL object type for DailyRuntimeUsage with auth subject. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
GitLab Pipeline ActionGeneral informationLink to pipeline: https://gitlab.com/code0-tech/development/sagittarius/-/pipelines/2554246960 Status: Failed Job summariesrspec: [cloud]Coverage report available at https://code0-tech.gitlab.io/-/development/sagittarius/-/jobs/14551116376/artifacts/tmp/coverage/index.html rspec: [ee]Coverage report available at https://code0-tech.gitlab.io/-/development/sagittarius/-/jobs/14551116375/artifacts/tmp/coverage/index.html rspec: [ce]Coverage report available at https://code0-tech.gitlab.io/-/development/sagittarius/-/jobs/14551116374/artifacts/tmp/coverage/index.html rubocop855 files inspected, no offenses detected |
9c2d421 to
2bf9dfc
Compare
|
@Taucher2003 needs to fix the docs gen |
Resolves: #779