Skip to content

Conversation

@ldmonster
Copy link
Collaborator

@ldmonster ldmonster commented Sep 19, 2025

Overview

Summary

This is a major architectural refactoring of the shell-operator that introduces:

🔧 Core Architecture Changes

1. Flexible Constructor Pattern

  • NEW: Options-based constructor with NewShellOperatorWithOptions()
  • BENEFIT: More testable, maintainable, and extensible initialization

2. Centralized Metrics Management

  • NEW: Comprehensive metrics package at metrics.go
  • MOVED: All metric constants from scattered files into single location
  • ADDED: Background metric updaters for live ticks and queue lengths

3. Task System Refactoring

  • MOVED: TaskResulttask.Result (moved to domain level)
  • NEW: Interface definitions for TaskQueue and TaskQueueSet
  • IMPROVED: Better encapsulation with private fields and getter methods
  • OPTIMIZED: Enhanced task queue compaction with object pooling

🔄 API Evolution

Old API:

// Rigid initialization
operator, err := shell_operator.Init(logger)

New API:

// Flexible, configurable initialization
operator, err := shell_operator.NewShellOperatorWithOptions(ctx,
    config.WithLogger(logger),
    config.WithMetricStorage(storage),
    config.WithHookMetricStorage(hookStorage),
)

What this PR does / why we need it

Special notes for your reviewer

Signed-off-by: Pavel Okhlopkov <[email protected]>
Signed-off-by: Pavel Okhlopkov <[email protected]>
Signed-off-by: Pavel Okhlopkov <[email protected]>
Signed-off-by: Pavel Okhlopkov <[email protected]>
Signed-off-by: Pavel Okhlopkov <[email protected]>
@ldmonster ldmonster self-assigned this Sep 19, 2025
@ldmonster ldmonster added enhancement New feature or request run/tests Run tests on full matrix of k8s versions labels Sep 19, 2025
@github-actions github-actions bot removed the run/tests Run tests on full matrix of k8s versions label Sep 19, 2025
Signed-off-by: Pavel Okhlopkov <[email protected]>
Signed-off-by: Pavel Okhlopkov <[email protected]>
Signed-off-by: Pavel Okhlopkov <[email protected]>
Signed-off-by: Pavel Okhlopkov <[email protected]>
Signed-off-by: Pavel Okhlopkov <[email protected]>
Signed-off-by: Pavel Okhlopkov <[email protected]>
@ldmonster ldmonster added the run/tests Run tests on full matrix of k8s versions label Sep 20, 2025
@github-actions github-actions bot removed the run/tests Run tests on full matrix of k8s versions label Sep 20, 2025
Signed-off-by: Pavel Okhlopkov <[email protected]>
Signed-off-by: Pavel Okhlopkov <[email protected]>
Signed-off-by: Pavel Okhlopkov <[email protected]>
@ldmonster ldmonster added the run/tests Run tests on full matrix of k8s versions label Sep 20, 2025
@github-actions github-actions bot removed the run/tests Run tests on full matrix of k8s versions label Sep 20, 2025
@ldmonster ldmonster changed the title [shell-operator] feat: add options to shell constructor [shell-operator] feat: move metrics to constant Sep 29, 2025
@ldmonster ldmonster changed the title [shell-operator] feat: move metrics to constant [shell-operator] feat: add options to shell constructor Sep 29, 2025
@ldmonster ldmonster marked this pull request as draft September 29, 2025 08:55
@ldmonster ldmonster marked this pull request as ready for review September 29, 2025 13:14
@ldmonster ldmonster marked this pull request as draft September 29, 2025 13:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants