Add Redis telemetry store, split workload spec/status, and introduce state-store metrics#21
Add Redis telemetry store, split workload spec/status, and introduce state-store metrics#21miladhzzzz wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ec66c23d71
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if statusResp != nil && len(statusResp.Kvs) > 0 { | ||
| _ = json.Unmarshal(statusResp.Kvs[0].Value, &st) | ||
| } | ||
| workload := models.Workload{ID: spec.ID, Name: spec.Name, Type: spec.Type, RevisionID: spec.RevisionID, Image: spec.Image, Command: spec.Command, CommandList: spec.CommandList, Compose: spec.Compose, ComposeYAML: spec.ComposeYAML, ProjectName: spec.ProjectName, GitRepo: spec.GitRepo, GitBranch: spec.GitBranch, GitToken: spec.GitToken, EnvVars: spec.EnvVars, Resources: spec.Resources, DesiredState: spec.DesiredState, Labels: spec.Labels, LocalPath: spec.LocalPath, Ports: spec.Ports, Volumes: spec.Volumes, Network: spec.Network, RestartPolicy: spec.RestartPolicy, VM: spec.VM, AssignedNode: st.AssignedNode, NodeID: st.NodeID, Status: st.Status, Logs: st.Logs, Metadata: st.Metadata, Retry: st.Retry, StatusInfo: st.StatusInfo} |
There was a problem hiding this comment.
Preserve CreatedAt when rebuilding split workloads
When reading a workload from the new split spec/status keys, the reconstruction copies most spec fields but never assigns spec.CreatedAt back to models.Workload.CreatedAt. After any scheduler restart or cache refresh, workloads loaded through this path have a zero creation timestamp, so workloadView omits CreatedAt and callers lose the creation time even though it was written into the spec projection.
Useful? React with 👍 / 👎.
Motivation
specandstatuspersistence to allow independent updates and easier projection.Description
REDIS_ADDR,REDIS_PASSWORD,REDIS_DB,REDIS_RECONCILE_TTL,REDIS_EVENT_TTL,REDIS_EVENT_MAX_ENTRIES) ininternal/configandgo.mod/go.sumupdates to includegithub.com/redis/go-redis/v9and other transitive modules.internal/scheduler/redis_store.go, with fallback to etcd when Redis is unavailable, and functions to write reconciliation telemetry and event histories.workloads-spec/andworkloads-status/prefixes by addingworkload_projection.go, refactoringsaveWorkloadto persist spec and status separately, and updating keys/paths instate_store.goand other scheduler methods (e.g.GetWorkloads,GetWorkloadByID,DeleteWorkloadWithContext).state_store_writes_totaland helperIncStateStoreWriteininternal/metricsand incremented it forspec,status,retry,assignment,reconciliation, andeventwrite paths.NewScheduler, close Redis inClose, avoid unnecessary writes inUpdateWorkloadStatus, skip empty log writes inUpdateWorkloadLogs, and avoid persisting unchanged metadata inUpdateWorkloadMetadata.NoActionresults.Testing
Codex Task