Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/popular-items-admire.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"chainlink": patch
---

#internal add metric for workflow execution start
26 changes: 19 additions & 7 deletions core/services/workflows/monitoring/monitoring.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,17 @@ type EngineMetrics struct {
engineHeartbeatCounter metric.Int64Counter
engineHeartbeatGauge metric.Int64Gauge

workflowCompletedDurationSeconds metric.Int64Histogram
workflowEarlyExitDurationSeconds metric.Int64Histogram
workflowErrorDurationSeconds metric.Int64Histogram
workflowTimeoutDurationSeconds metric.Int64Histogram
workflowStepDurationSeconds metric.Int64Histogram
workflowCompletedDurationSeconds metric.Int64Histogram
workflowEarlyExitDurationSeconds metric.Int64Histogram
workflowErrorDurationSeconds metric.Int64Histogram
workflowTimeoutDurationSeconds metric.Int64Histogram
workflowStepDurationSeconds metric.Int64Histogram
capabilityExecutionDurationSeconds metric.Int64Histogram
workflowMissingMeteringReport metric.Int64Counter
workflowMeteringMode metric.Int64Gauge
workflowMissingMeteringReport metric.Int64Counter
workflowMeteringMode metric.Int64Gauge

workflowExecutionFailedCounter metric.Int64Counter
workflowExecutionStartedCounter metric.Int64Counter
workflowExecutionSucceededCounter metric.Int64Counter

getSecretsDuration metric.Int64Histogram
Expand Down Expand Up @@ -136,6 +138,11 @@ func InitMonitoringResources() (em *EngineMetrics, err error) {
return nil, fmt.Errorf("failed to register workflow trigger event queue full counter: %w", err)
}

em.workflowExecutionStartedCounter, err = beholder.GetMeter().Int64Counter("platform_engine_workflow_execution_started_count")
if err != nil {
return nil, fmt.Errorf("failed to register workflow execution started counter: %w", err)
}

em.workflowExecutionFailedCounter, err = beholder.GetMeter().Int64Counter("platform_engine_workflow_execution_failed_count")
if err != nil {
return nil, fmt.Errorf("failed to register workflow execution failed counter: %w", err)
Expand Down Expand Up @@ -432,3 +439,8 @@ func (c WorkflowsMetricLabeler) IncrementWorkflowExecutionSucceededCounter(ctx c
otelLabels := beholder.OtelAttributes(c.Labels).AsStringAttributes()
c.em.workflowExecutionSucceededCounter.Add(ctx, 1, metric.WithAttributes(otelLabels...))
}

func (c WorkflowsMetricLabeler) IncrementWorkflowExecutionStartedCounter(ctx context.Context) {
otelLabels := beholder.OtelAttributes(c.Labels).AsStringAttributes()
c.em.workflowExecutionStartedCounter.Add(ctx, 1, metric.WithAttributes(otelLabels...))
}
1 change: 1 addition & 0 deletions core/services/workflows/v2/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,7 @@ func (e *Engine) startExecution(ctx context.Context, wrappedTriggerEvent enqueue
startTime := e.cfg.Clock.Now()
executionLogger.Infow("Workflow execution starting ...")
_ = events.EmitExecutionStartedEvent(ctx, e.loggerLabels, triggerEvent.ID, executionID)
e.metrics.With("workflowID", e.cfg.WorkflowID, "workflowName", e.cfg.WorkflowName.String()).IncrementWorkflowExecutionStartedCounter(ctx)
var executionStatus string // store.StatusStarted

var timeProvider TimeProvider = &types.LocalTimeProvider{}
Expand Down
Loading