Skip to content

BCH-1153: Populate per-step metrics in workflow execution metrics resp#399

Open
saltpy-cs wants to merge 2 commits into
mainfrom
fix/BCH-1153
Open

BCH-1153: Populate per-step metrics in workflow execution metrics resp#399
saltpy-cs wants to merge 2 commits into
mainfrom
fix/BCH-1153

Conversation

@saltpy-cs
Copy link
Copy Markdown

The metrics endpoint only returned aggregate durations. The UI Step Performance table was always hidden because stepMetrics was never populated. Now each step execution contributes a StepMetric entry with its name, timestamps, and duration in minutes.

…ponse

The metrics endpoint only returned aggregate durations. The UI Step
Performance table was always hidden because stepMetrics was never
populated. Now each step execution contributes a StepMetric entry with
its name, timestamps, and duration in minutes.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@saltpy-cs saltpy-cs requested a review from gusfcarvalho May 20, 2026 16:29
@saltpy-cs saltpy-cs self-assigned this May 20, 2026
@saltpy-cs
Copy link
Copy Markdown
Author

Screenshot 2026-05-20 at 17 24 15

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the workflow execution metrics endpoint to include per-step timing details so the UI can populate the Step Performance table instead of only showing aggregate durations.

Changes:

  • Build and return per-step metrics (StepMetric) from step executions in GetExecutionMetrics.
  • Add a unit test asserting StepMetrics is populated.
  • Update Swagger artifacts to document the new per-step metrics array.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
internal/workflow/manager.go Adds StepMetric/StepMetrics and populates per-step timing data in GetExecutionMetrics.
internal/workflow/manager_test.go Adds a unit test validating per-step metrics are returned.
docs/swagger.yaml Documents the new step metrics field and schema in Swagger YAML.
docs/swagger.json Documents the new step metrics field and schema in Swagger JSON.
docs/docs.go Updates the embedded Swagger template with the new step metrics schema.
Comments suppressed due to low confidence (2)

internal/workflow/manager.go:382

  • StepMetric JSON field names use snake_case (e.g., started_at, step_definition_id), while the surrounding metrics schemas use lowerCamelCase (e.g., averageStepDuration, executionID). This introduces an inconsistent API surface and likely won’t match the UI expectation described in the PR (stepMetrics). Consider switching these tags to match the existing metrics naming (e.g., startedAt/completedAt, stepDefinitionID, durationMinutes).
// StepMetric holds per-step timing data for the metrics response
type StepMetric struct {
	StepDefinitionID uuid.UUID  `json:"step_definition_id"`
	StepName         string     `json:"step_name"`
	StartedAt        *time.Time `json:"started_at,omitempty"`
	CompletedAt      *time.Time `json:"completed_at,omitempty"`
	DurationMinutes  *float64   `json:"duration_minutes,omitempty"`
}

internal/workflow/manager.go:392

  • ExecutionMetrics now mixes untagged fields (which will marshal as "ExecutionID", "TotalSteps", etc.) with a tagged field ("step_metrics"). This leads to inconsistent JSON keys within the same response. Consider adding consistent json tags for all ExecutionMetrics fields and naming the new field consistently with the existing metrics properties (likely stepMetrics rather than step_metrics).
// ExecutionMetrics represents metrics for a workflow execution
type ExecutionMetrics struct {
	ExecutionID         uuid.UUID
	TotalSteps          int
	Duration            time.Duration
	AverageStepDuration time.Duration
	LongestStepDuration time.Duration
	StepMetrics         []StepMetric `json:"step_metrics"`
}

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/workflow/manager.go
Comment thread docs/swagger.yaml Outdated
Comment thread docs/swagger.json
Comment thread docs/docs.go
- Switch StepMetric json tags from snake_case to lowerCamelCase to match
  the surrounding ExecutionMetrics naming convention
- Add explicit lowerCamelCase json tags to all ExecutionMetrics fields
  for consistency; rename step_metrics to stepMetrics
- Initialize StepMetrics as empty slice so zero-step executions serialize
  as [] rather than null
- Regenerate swagger docs to reflect updated field names

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants