This is an automated email from the ASF dual-hosted git repository.
jmjoy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/skywalking-php.git
The following commit(s) were added to refs/heads/master by this push:
new 0a401c2 Enable zend observer by default for PHP 8+ (#138)
0a401c2 is described below
commit 0a401c2850e8ae01314d2d474e3fa3586f8bc537
Author: jmjoy <[email protected]>
AuthorDate: Wed Mar 11 15:32:45 2026 +0800
Enable zend observer by default for PHP 8+ (#138)
---
.github/workflows/rust.yml | 28 +---------------------------
docs/en/configuration/ini-settings.md | 2 +-
docs/en/configuration/zend-observer.md | 3 ++-
src/lib.rs | 2 +-
tests/common/mod.rs | 2 +-
5 files changed, 6 insertions(+), 31 deletions(-)
diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml
index c6b840b..56532c4 100644
--- a/.github/workflows/rust.yml
+++ b/.github/workflows/rust.yml
@@ -57,55 +57,33 @@ jobs:
# Many composer dependencies need PHP 7.2+
- php_version: "7.2"
swoole_version: "4.6.7"
- enable_zend_observer: "Off"
cargo_features: ""
- php_version: "7.3"
swoole_version: "4.7.1"
- enable_zend_observer: "Off"
cargo_features: ""
- php_version: "7.4"
swoole_version: "4.8.10"
- enable_zend_observer: "Off"
cargo_features: ""
- php_version: "8.0"
swoole_version: "5.0.0"
- enable_zend_observer: "Off"
- cargo_features: ""
- - php_version: "8.0"
- swoole_version: "5.0.0"
- enable_zend_observer: "On"
cargo_features: ""
- php_version: "8.1"
swoole_version: "5.1.1"
- enable_zend_observer: "Off"
- cargo_features: ""
- - php_version: "8.1"
- swoole_version: "5.1.1"
- enable_zend_observer: "On"
- cargo_features: ""
- - php_version: "8.2"
- swoole_version: "5.1.1"
- enable_zend_observer: "Off"
cargo_features: ""
- php_version: "8.2"
swoole_version: "5.1.1"
- enable_zend_observer: "On"
cargo_features: ""
- php_version: "8.2"
swoole_version: "5.1.1"
- enable_zend_observer: "On"
cargo_features: "--features kafka-reporter"
- php_version: "8.3"
swoole_version: "5.1.1"
- enable_zend_observer: "Off"
cargo_features: ""
- php_version: "8.4"
swoole_version: "5.1.1"
- enable_zend_observer: "Off"
cargo_features: ""
- php_version: "8.5"
- swoole_version: "6.1.4"
- enable_zend_observer: "Off"
+ swoole_version: "6.2.0"
cargo_features: ""
runs-on: ${{ matrix.os }}
@@ -201,8 +179,6 @@ jobs:
id: cargo-test-step
run: |
cargo test --release --workspace ${{ matrix.flag.cargo_features }}
- env:
- ENABLE_ZEND_OBSERVER: ${{ matrix.flag.enable_zend_observer }}
continue-on-error: true
# Rebuild the mixture when cargo test failed.
@@ -222,8 +198,6 @@ jobs:
if: steps.cargo-test-step.outcome != 'success'
run: |
cargo test --release --workspace
- env:
- ENABLE_ZEND_OBSERVER: ${{ matrix.flag.enable_zend_observer }}
- name: View logs
if: always()
diff --git a/docs/en/configuration/ini-settings.md
b/docs/en/configuration/ini-settings.md
index fbd9c5c..214677e 100644
--- a/docs/en/configuration/ini-settings.md
+++ b/docs/en/configuration/ini-settings.md
@@ -19,7 +19,7 @@ This is the configuration list supported in `php.ini`.
| skywalking_agent.ssl_cert_chain_path | The certificate file.
Enable mTLS when `ssl_key_path` and `ssl_cert_chain_path` exist. Only available
when `reporter_type` is `grpc`.
|
|
| skywalking_agent.heartbeat_period | Agent heartbeat report
period. Unit, second.
| 30
|
| skywalking_agent.properties_report_period_factor | The agent sends the
instance properties to the backend every heartbeat_period *
properties_report_period_factor seconds.
| 10 |
-| skywalking_agent.enable_zend_observer | Whether to use `zend
observer` instead of `zend_execute_ex` to hook the functions, this feature is
only available for PHP8+.
| Off
|
+| skywalking_agent.enable_zend_observer | Whether to use `zend
observer` instead of `zend_execute_ex` to hook the functions, this feature is
only available for PHP8+.
| On
|
| skywalking_agent.reporter_type | Reporter type, optional
values are `grpc`, `kafka` and `standalone`.
| grpc
|
| skywalking_agent.kafka_bootstrap_servers | A list of host/port pairs
to use for connect to the Kafka cluster. Only available when `reporter_type` is
`kafka`.
|
|
| skywalking_agent.kafka_producer_config | Configure Kafka Producer
configuration in JSON format `{"key": "value}`. Only available when
`reporter_type` is `kafka`.
| {}
|
diff --git a/docs/en/configuration/zend-observer.md
b/docs/en/configuration/zend-observer.md
index c6deeb8..1027b34 100644
--- a/docs/en/configuration/zend-observer.md
+++ b/docs/en/configuration/zend-observer.md
@@ -2,7 +2,7 @@
> Refer to:
> <https://www.datadoghq.com/blog/engineering/php-8-observability-baked-right-in/#the-observability-landscape-before-php-8>
-By default, skywalking-php hooks the `zend_execute_internal` and
`zend_execute_ex` functions to implement auto instrumentation.
+On PHP 7, skywalking-php hooks the `zend_execute_internal` and
`zend_execute_ex` functions to implement auto instrumentation.
But there are some drawbacks:
@@ -28,5 +28,6 @@ opcache.jit = tracing
[skywalking_agent]
extension = skywalking_agent.so
; Switch to use zend observer api to implement auto instrumentation.
+; Default is On for PHP 8+.
skywalking_agent.enable_zend_observer = On
```
diff --git a/src/lib.rs b/src/lib.rs
index 228f48e..1c6736f 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -187,7 +187,7 @@ pub fn get_module() -> Module {
10i64,
Policy::System,
);
- module.add_ini(SKYWALKING_AGENT_ENABLE_ZEND_OBSERVER, false,
Policy::System);
+ module.add_ini(SKYWALKING_AGENT_ENABLE_ZEND_OBSERVER, true,
Policy::System);
module.add_ini(
SKYWALKING_AGENT_REPORTER_TYPE,
"grpc".to_string(),
diff --git a/tests/common/mod.rs b/tests/common/mod.rs
index cea4285..8083027 100644
--- a/tests/common/mod.rs
+++ b/tests/common/mod.rs
@@ -70,7 +70,7 @@ pub const EXT: &str = if cfg!(target_os = "linux") {
};
pub static ENABLE_ZEND_OBSERVER: Lazy<String> =
- Lazy::new(|| env::var("ENABLE_ZEND_OBSERVER").unwrap_or_else(|_|
"Off".to_owned()));
+ Lazy::new(|| env::var("ENABLE_ZEND_OBSERVER").unwrap_or_else(|_|
"On".to_owned()));
pub static HTTP_CLIENT: Lazy<reqwest::Client> =
Lazy::new(reqwest::Client::new);