Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Workflow middlewares don't raise error on workflow execution failure

Đang mở
#309 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
35/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
ruby
Lĩnh vực
backend

Hướng nghiên cứu

Bắt đầu với worker.rb và metrics_workflow_middleware.rb để hiểu middleware của workflow được đăng ký như thế nào và các lỗi hiện đang được xử lý quanh yield ra sao. Theo dõi đường đi thực thi workflow gọi middleware và xác định cách có thể quan sát một lần thực thi thất bại tại đó. Được xem là hoàn tất khi middleware có thể phát ra workflow_failed cho các lần thực thi thất bại, đồng thời giữ workflow_completed cho các lần thực thi thành công.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

I'd like to emit the metric workflow_failed when the workflow execution fails (replicating metrics emitted by other SDKs). To achieve that, I registered a workflow middleware in my worker. In my middleware, I rescue errors and emit this metric.

The problem is that the workflow middleware doesn't raise an error when the workflow execution fails. AFAIK, there is no way of knowing if the workflow execution failed in the context of a workflow middleware. Conversely, in the activity middleware, errors are raised so it's possible to emit the metric activity_exectuion_failed. How can I emit the workflow_failed metrics when the workflow execution fails?

Setup:

worker.rb:

class Worker < Temporal::Worker
  def self.start
    worker = Temporal::Worker.new
    # configure...
    worker.add_workflow_middleware(MetricsWorkflowMiddleware)
    worker.start
  end
end

metrics_workflow_middleware.rb:

class MetricsWorkflowMiddleware
  def call(metadata)
    yield
    Statsd.increment('workflow_completed')
  rescue StandardError
    Statsd.increment('workflow_failed')
    raise
  end
end
Ngôn ngữ chính
Ruby
Star
287
Fork
113
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của coinbase/temporal-ruby

Tất cả issue của coinbase/temporal-ruby

Issue tương tự

Thêm issue về Ruby

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.