Observer API: Correlated observer callbacks for a single invocation
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- C
- Star
- 40.4k
- Fork
- 8.2k
- Merge trung bình
- 2 ngày 13 giờ
- Pull request đã merge (30 ngày)
- 96
Mô tả
Description
Note:
I’ve already asked and explained part of this in another issue , but this is a broader feature request with example use cases.
Brief:
Observer API replacing zend_execute_ex hook provides notable benefits and one caveat (as it seems to me): there is no stable, per-invocation identifier that can be seen consistently across all observer callbacks.
Observer API callbacks are much like event handlers fired at the certain point of the lifecycle of an invocation, but they do not provide a means of identification of the invocation.
By being able to identify the invocation, information gathered in different events can be easily linked together for a meaningful “observation”.
Request:
- Adding a temporary to
zend_execute_data(likeop_array.reserved[]but per invocation) to be used for identification as developer sees fit - Passing
zend_execute_data(or the temporary at least) to other callbacks likezend_observer_error_cb
Use case examples:
- Associating runtime metrics like
start time,end time,return value,exceptionstogether without having to retain them in memory until all infos are gathered. - Associating infos gathered by means other than Observer API (e.g. hooking specific
PDOfunctions, replacing otherzif_handlerhandlers) with infos from callbacks.
It’s true that some of the infos named in 1st example can be easily linked together by a simple stack structure or HashTable (as pointed out in the above linked issue) but some others require more complex rules AFAICT and unnecessary bookkeeping.
zend_execute_data is already per-invocation, so I think it is cleaner and more straightforward to use that instead of each extension building and maintaining its own mapping.
P.S.: Please forgive me if there’s anything wrong with my thinking or writing; I’m not that experienced.
Cc: @bwoebi @ndossche
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu bằng cách đọc các entry point của Observer API được nêu trong issue: zend_execute_ex, zend_observer_error_cb và zend_execute_data, cùng với cách sử dụng op_array.reserved[] và zif_handler. So sánh với phần thảo luận liên quan trong issue 20336. Được xem là hoàn thành khi thiết kế tương quan lời gọi và các yêu cầu về dữ liệu callback đã được thống nhất và triển khai với độ bao phủ phù hợp.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- c, php
- Lĩnh vực
- backend-api-design, compilers
- Loại issue
- Tính năng
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Cần làm rõ
- Mức phù hợp với người mới
- 25/100