Pipeline Monitoring#
DevLake provides two complementary mechanisms for tracking pipeline execution: REST polling (pull) and webhook notifications (push). These cover the full lifecycle from pipeline creation through completion or failure.
REST Polling (Pull Model)#
The pipeline API exposes endpoints for querying status on demand:
| Endpoint | Handler | Purpose |
|---|---|---|
GET /pipelines | Index | List pipelines; filterable by status, pending, blueprint_id, label |
GET /pipelines/:pipelineId | Get | Fetch a single pipeline's current status and details |
POST /pipelines/:pipelineId/rerun | PostRerun | Rerun all failed tasks in a pipeline |
DELETE /pipelines/:pipelineId | Delete | Cancel a pending pipeline |
GET /pipelines/:pipelineId/logging.tar.gz | DownloadLogs | Download compressed logs for a pipeline |
Pipeline statuses used in polling responses are: TASK_CREATED, TASK_RUNNING, TASK_COMPLETED, TASK_FAILED, TASK_PARTIAL, TASK_CANCELLED, TASK_RERUN, TASK_RESUME. Status is computed by ComputePipelineStatus, which aggregates individual task outcomes:
TASK_COMPLETEDβ all tasks succeededTASK_FAILEDβ at least one task failed andSkipOnFail=falseTASK_PARTIALβSkipOnFail=truewith at least one success and one failure
Use the status query parameter on GET /pipelines to filter to a specific state (e.g., ?status=TASK_RUNNING).
Webhook Notifications (Push Model)#
DevLake fires an outbound HTTP POST to a configured endpoint on two pipeline lifecycle events:
- Pipeline started β triggered in
dequeuePipelinewhen a pipeline transitions from pending to running. - Pipeline finished β triggered at the end of
runPipelineafter the final status is persisted.
Both events call NotifyExternal, which resolves the notification service and invokes PipelineStatusChanged with a PipelineNotificationParam payload:
{
"ProjectName": "projectName",
"PipelineID": 39,
"BeganAt": "2024-09-05T15:08:00.389+08:00",
"FinishedAT": "2024-09-05T15:28:00.389+08:00",
"Status": "TASK_COMPLETED",
"CreatedAt": "2024-09-05T15:08:00.389+08:00",
"UpdatedAt": "2024-09-05T15:28:00.785+08:00"
}
ProjectName is empty when the pipeline is created directly via API rather than through a blueprint .
Configuration#
Set in .env :
NOTIFICATION_ENDPOINT=https://your-receiver.example.com/hook
NOTIFICATION_SECRET=your-secret
The service is initialized at startup in pipelineServiceInit: if NOTIFICATION_ENDPOINT is non-empty, a DefaultPipelineNotificationService is created .
Request Format & Signature Verification#
The notification is delivered as POST {NOTIFICATION_ENDPOINT}?nouce={id}-{random}&sign={sha256} .
The signature is computed as :
SHA256( requestBody + NOTIFICATION_SECRET + nouce )
Verify the sign query parameter against this formula to authenticate the sender. Leave NOTIFICATION_SECRET empty to skip verification.
Notification Service Architecture#
The notification subsystem uses a two-level interface :
PipelineNotificationServiceβ interface with a singlePipelineStatusChangedmethod.GetPipelineNotificationService()β returns a custom implementation if registered, then falls back toDefaultPipelineNotificationService, ornilif neither is configured.
To plug in a custom notifier (e.g., for Slack, PagerDuty), assign an implementation to customPipelineNotificationService. The built-in DefaultPipelineNotificationService persists each notification to the database before sending, recording the HTTP response code and body for auditability.
Key Source Files#
| File | Purpose |
|---|---|
backend/server/api/pipelines/pipelines.go | REST API handlers for pipeline CRUD and status queries |
backend/server/services/pipeline.go | Pipeline lifecycle, queue runner, NotifyExternal |
backend/server/services/pipeline_runner.go | Execution, status computation, final notification trigger |
backend/server/services/pipeline_notification.go | PipelineNotificationService interface and GetPipelineNotificationService |
backend/server/services/pipeline_notification_impl.go | Default webhook delivery with SHA-256 signature |
docs/DeveloperManuals/Notifications.md | Official configuration and signature verification guide |