You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by he...@apache.org on 2022/11/04 06:40:47 UTC

[skywalking-php] branch master updated: Upgrade rust mini version to 1.65. (#30)

This is an automated email from the ASF dual-hosted git repository.

heyanlong 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 d3afbd4  Upgrade rust mini version to 1.65. (#30)
d3afbd4 is described below

commit d3afbd45ae6a8ae02ed732bc8a30e5479626e596
Author: jmjoy <jm...@apache.org>
AuthorDate: Fri Nov 4 14:40:41 2022 +0800

    Upgrade rust mini version to 1.65. (#30)
    
    * Upgrade rust mini version to 1.65.
---
 Cargo.lock     | 10 ----------
 Cargo.toml     |  3 +--
 src/execute.rs | 10 ++++++----
 src/module.rs  |  2 +-
 src/request.rs |  4 ++--
 5 files changed, 10 insertions(+), 19 deletions(-)

diff --git a/Cargo.lock b/Cargo.lock
index b18f2b7..1b08c5b 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -703,15 +703,6 @@ version = "0.4.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9"
 
-[[package]]
-name = "helper"
-version = "3.3.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7074fed15c2a220ef4e842419a5e6cf21f5fd6b83e82ee65d34e408434e1cb2b"
-dependencies = [
- "proc-macro2",
-]
-
 [[package]]
 name = "hermit-abi"
 version = "0.1.19"
@@ -1888,7 +1879,6 @@ dependencies = [
  "dashmap",
  "fastcgi-client",
  "futures-util",
- "helper",
  "hostname",
  "libc",
  "once_cell",
diff --git a/Cargo.toml b/Cargo.toml
index 2322115..79875cb 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -25,7 +25,7 @@ version = "0.2.0-dev"
 authors = ["Apache Software Foundation", "jmjoy <jm...@apache.org>", "Yanlong He <he...@apache.org>"]
 description = "Apache SkyWalking PHP Agent."
 edition = "2021"
-rust-version = "1.58"
+rust-version = "1.65"
 repository = "https://github.com/apache/skywalking-php"
 license = "Apache-2.0"
 readme = "README.md"
@@ -41,7 +41,6 @@ bincode = "1.3.3"
 chrono = "0.4.22"
 dashmap = "5.4.0"
 futures-util = "0.3.24"
-helper = "3.3.0"
 hostname = "0.3.1"
 libc = "0.2.132"
 once_cell = "1.14.0"
diff --git a/src/execute.rs b/src/execute.rs
index cd94342..06cb946 100644
--- a/src/execute.rs
+++ b/src/execute.rs
@@ -15,7 +15,6 @@
 
 use crate::{plugin::select_plugin, request::IS_SWOOLE, util::catch_unwind_anyhow};
 use anyhow::{bail, Context};
-use helper::try_option;
 use phper::{
     objects::ZObj,
     strings::ZStr,
@@ -295,8 +294,9 @@ fn infer_request_id(execute_data: &mut ExecuteData) -> Option<i64> {
 
     let mut prev_execute_data_ptr = execute_data.as_mut_ptr();
     loop {
-        let prev_execute_data =
-            unsafe { try_option!(ExecuteData::try_from_mut_ptr(prev_execute_data_ptr) ? None) };
+        let Some(prev_execute_data) = (unsafe { ExecuteData::try_from_mut_ptr(prev_execute_data_ptr) }) else {
+            return None;
+        };
         let func_name = prev_execute_data.func().get_function_name();
         if !func_name
             .map(|s| s == b"skywalking_hack_swoole_on_request_please_do_not_use")
@@ -305,7 +305,9 @@ fn infer_request_id(execute_data: &mut ExecuteData) -> Option<i64> {
             prev_execute_data_ptr = unsafe { (*prev_execute_data_ptr).prev_execute_data };
             continue;
         }
-        let request = try_option!(prev_execute_data.get_parameter(0).as_mut_z_obj() ? None);
+        let Some(request) = prev_execute_data.get_parameter(0).as_mut_z_obj() else {
+            return None;
+        };
         match request.get_mut_property("fd").as_long() {
             Some(fd) => return Some(fd),
             None => {
diff --git a/src/module.rs b/src/module.rs
index 5acc733..f5c3947 100644
--- a/src/module.rs
+++ b/src/module.rs
@@ -96,7 +96,7 @@ fn init_logger() {
         Ini::get::<String>(SKYWALKING_AGENT_LOG_LEVEL).unwrap_or_else(|| "OFF".to_string());
     let log_level = log_level.trim();
 
-    let log_file = Ini::get::<String>(SKYWALKING_AGENT_LOG_FILE).unwrap_or_else(|| "".to_string());
+    let log_file = Ini::get::<String>(SKYWALKING_AGENT_LOG_FILE).unwrap_or_default();
     let log_file = log_file.trim();
 
     if !log_file.is_empty() {
diff --git a/src/request.rs b/src/request.rs
index c6b3222..63d464e 100644
--- a/src/request.rs
+++ b/src/request.rs
@@ -253,8 +253,8 @@ fn create_request_context(
     };
     span.with_span_object_mut(|span| {
         span.component_id = COMPONENT_PHP_ID;
-        span.add_tag("url", &uri);
-        span.add_tag("http.method", &method);
+        span.add_tag("url", uri);
+        span.add_tag("http.method", method);
     });
 
     RequestContext::set_global(