Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade dependencies. #86

Merged
merged 2 commits into from
Aug 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
878 changes: 368 additions & 510 deletions Cargo.lock

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,29 +36,29 @@ name = "skywalking_agent"
crate-type = ["lib", "cdylib"]

[dependencies]
anyhow = { version = "1.0.71", features = ["backtrace"] }
anyhow = { version = "1.0.72", features = ["backtrace"] }
bincode = "1.3.3"
dashmap = "5.4.0"
dashmap = "5.5.0"
futures-util = "0.3.28"
hostname = "0.3.1"
libc = "0.2.144"
once_cell = "1.17.1"
libc = "0.2.147"
once_cell = "1.18.0"
phper = "0.12.0"
prost = "0.11.9"
serde_json = { version = "1.0.96", features = ["preserve_order"] }
skywalking = { version = "0.7.0", features = ["management"] }
serde_json = { version = "1.0.104", features = ["preserve_order"] }
skywalking = { version = "0.8.0", features = ["management"] }
systemstat = "0.2.3"
thiserror = "1.0.40"
tokio = { version = "1.28.1", features = ["full"] }
thiserror = "1.0.44"
tokio = { version = "1.29.1", features = ["full"] }
tokio-stream = "0.1.14"
tonic = { version = "0.8.3", features = ["tls"] }
tracing = { version = "0.1.37", features = ["attributes"] }
tracing-subscriber = "0.3.17"
url = "2.3.1"
url = "2.4.0"

[dev-dependencies]
axum = "0.6.18"
fastcgi-client = "0.8.0"
axum = "0.6.19"
fastcgi-client = "0.9.0"
reqwest = { version = "0.11.18", features = ["trust-dns", "json", "stream"] }

[build-dependencies]
Expand Down
274 changes: 133 additions & 141 deletions dist-material/LICENSE

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions scripts/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ license = "Apache-2.0"
publish = false

[dependencies]
anyhow = "1.0.71"
chrono = { version = "0.4.24", default-features = false, features = ["std"] }
clap = { version = "4.3.0", features = ["derive"] }
serde = { version = "1.0.163", features = ["derive"] }
tera = "1.18.1"
anyhow = "1.0.72"
chrono = { version = "0.4.26", default-features = false, features = ["std"] }
clap = { version = "4.3.19", features = ["derive"] }
serde = { version = "1.0.180", features = ["derive"] }
tera = "1.19.0"
tracing = "0.1.37"
tracing-subscriber = "0.3.17"
2 changes: 1 addition & 1 deletion src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use dashmap::DashMap;
use once_cell::sync::Lazy;
use skywalking::trace::{
propagation::encoder::encode_propagation,
span::{AbstractSpan, Span},
span::{HandleSpanObject, Span},
trace_context::TracingContext,
};

Expand Down
6 changes: 3 additions & 3 deletions src/plugin/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ mod plugin_swoole;
use crate::execute::{AfterExecuteHook, BeforeExecuteHook};
use once_cell::sync::Lazy;
use phper::{eg, objects::ZObj};
use skywalking::trace::span::AbstractSpan;
use skywalking::trace::span::HandleSpanObject;
use std::{collections::HashMap, ops::Deref, sync::Mutex};
use tracing::error;

Expand Down Expand Up @@ -109,10 +109,10 @@ fn select_plugin(class_name: Option<&str>, function_name: &str) -> Option<&'stat
selected_plugin.map(AsRef::as_ref)
}

fn log_exception(span: &mut impl AbstractSpan) -> Option<&mut ZObj> {
fn log_exception(span: &mut impl HandleSpanObject) -> Option<&mut ZObj> {
let mut ex = unsafe { ZObj::try_from_mut_ptr(eg!(exception)) };
if let Some(ex) = ex.as_mut() {
let mut span_object = span.span_object_mut();
let span_object = span.span_object_mut();
span_object.is_error = true;

let mut logs = Vec::new();
Expand Down
4 changes: 2 additions & 2 deletions src/plugin/plugin_amqplib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ use phper::{
};
use skywalking::{
proto::v3::SpanLayer,
trace::span::{AbstractSpan, Span},
trace::span::{HandleSpanObject, Span},
};

#[derive(Default, Clone)]
Expand Down Expand Up @@ -135,7 +135,7 @@ impl AmqplibPlugin {
Ok(ctx.create_exit_span(&format!("{}->{}", class_name, function_name), peer))
})?;

let mut span_object = span.span_object_mut();
let span_object = span.span_object_mut();
span_object.set_span_layer(SpanLayer::Mq);
span_object.component_id = COMPONENT_AMQP_PRODUCER_ID;
span_object.add_tag(TAG_MQ_BROKER, peer);
Expand Down
12 changes: 5 additions & 7 deletions src/plugin/plugin_curl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ use phper::{
};
use skywalking::{
proto::v3::SpanLayer,
trace::span::{AbstractSpan, AsyncSpan, Span},
trace::span::{AsyncSpan, HandleSpanObject, Span},
};
use std::{cell::RefCell, collections::HashMap, os::raw::c_long};
use tracing::{debug, warn};
Expand Down Expand Up @@ -424,15 +424,15 @@ impl CurlPlugin {
Ok(ctx.create_exit_span(info.url.path(), &info.peer))
})?;

let mut span_object = span.span_object_mut();
let span_object = span.span_object_mut();
span_object.set_span_layer(SpanLayer::Http);
span_object.component_id = COMPONENT_PHP_CURL_ID;
span_object.add_tag("url", &info.raw_url);

Ok(span)
}

fn finish_exit_span(span: &mut impl AbstractSpan, ch: &ZVal) -> crate::Result<()> {
fn finish_exit_span(span: &mut impl HandleSpanObject, ch: &ZVal) -> crate::Result<()> {
let result = call("curl_getinfo", &mut [ch.clone()])?;
let response = result.as_z_arr().context("response in not arr")?;
let http_code = response
Expand All @@ -447,13 +447,11 @@ impl CurlPlugin {
.as_z_str()
.context("curl_error is not string")?
.to_str()?;
let mut span_object = span.span_object_mut();
let span_object = span.span_object_mut();
span_object.is_error = true;
span_object.add_log(vec![("CURL_ERROR", curl_error)]);
} else if http_code >= 400 {
span.span_object_mut().is_error = true;
} else {
span.span_object_mut().is_error = false;
span.span_object_mut().is_error = http_code >= 400;
}

log_exception(span);
Expand Down
8 changes: 4 additions & 4 deletions src/plugin/plugin_memcached.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ use phper::{
};
use skywalking::{
proto::v3::SpanLayer,
trace::span::{AbstractSpan, Span},
trace::span::{HandleSpanObject, Span},
};
use tracing::{debug, instrument, warn};

Expand Down Expand Up @@ -340,15 +340,15 @@ fn after_hook(
Ok(())
}

fn create_exit_span<'a>(
fn create_exit_span(
request_id: Option<i64>, class_name: &str, function_name: &str, remote_peer: &str,
tag_info: &TagInfo<'a>, key: Option<&str>,
tag_info: &TagInfo<'_>, key: Option<&str>,
) -> anyhow::Result<Span> {
RequestContext::try_with_global_ctx(request_id, |ctx| {
let mut span =
ctx.create_exit_span(&format!("{}->{}", class_name, function_name), remote_peer);

let mut span_object = span.span_object_mut();
let span_object = span.span_object_mut();
span_object.set_span_layer(SpanLayer::Cache);
span_object.component_id = COMPONENT_PHP_MEMCACHED_ID;
span_object.add_tag(TAG_CACHE_TYPE, "memcache");
Expand Down
4 changes: 2 additions & 2 deletions src/plugin/plugin_mongodb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use phper::{
};
use skywalking::{
proto::v3::SpanLayer,
trace::span::{AbstractSpan, Span},
trace::span::{HandleSpanObject, Span},
};
use std::any::Any;
use tracing::{debug, error};
Expand Down Expand Up @@ -121,7 +121,7 @@ fn before_manager_crud_hook(
Ok(ctx.create_exit_span(&format!("{}->{}", MANAGER_CLASS_NAME, function_name), ""))
})?;

let mut span_object = span.span_object_mut();
let span_object = span.span_object_mut();
span_object.set_span_layer(SpanLayer::Database);
span_object.component_id = COMPONENT_MONGODB_ID;
span_object.add_tag(TAG_DB_TYPE, "MongoDB");
Expand Down
4 changes: 2 additions & 2 deletions src/plugin/plugin_mysqli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use once_cell::sync::Lazy;
use phper::{objects::ZObj, sys};
use skywalking::{
proto::v3::SpanLayer,
trace::span::{AbstractSpan, Span},
trace::span::{HandleSpanObject, Span},
};
use tracing::debug;

Expand Down Expand Up @@ -147,7 +147,7 @@ fn create_mysqli_exit_span(
&format!("{}:{}", info.hostname, info.port),
);

let mut span_object = span.span_object_mut();
let span_object = span.span_object_mut();
span_object.set_span_layer(SpanLayer::Database);
span_object.component_id = COMPONENT_PHP_MYSQLI_ID;
span_object.add_tag("db.type", "mysql");
Expand Down
6 changes: 3 additions & 3 deletions src/plugin/plugin_pdo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ use phper::{
};
use skywalking::{
proto::v3::SpanLayer,
trace::span::{AbstractSpan, Span},
trace::span::{HandleSpanObject, Span},
};
use std::{any::Any, str::FromStr};
use tracing::{debug, warn};
Expand Down Expand Up @@ -241,7 +241,7 @@ fn after_hook_when_false(this: &mut ZObj, span: &mut Span) -> crate::Result<()>
};
let error = get_error_info_item(info, 2)?.expect_z_str()?.to_str()?;

let mut span_object = span.span_object_mut();
let span_object = span.span_object_mut();
span_object.is_error = true;
span_object.add_log([("SQLSTATE", state), ("Error Code", code), ("Error", error)]);

Expand Down Expand Up @@ -272,7 +272,7 @@ fn create_exit_span_with_dsn(
let mut span =
ctx.create_exit_span(&format!("{}->{}", class_name, function_name), &dsn.peer);

let mut span_object = span.span_object_mut();
let span_object = span.span_object_mut();
span_object.set_span_layer(SpanLayer::Database);
span_object.component_id = COMPONENT_PHP_PDO_ID;
span_object.add_tag(TAG_DB_TYPE, &dsn.db_type);
Expand Down
4 changes: 2 additions & 2 deletions src/plugin/plugin_predis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use once_cell::sync::Lazy;
use phper::{eg, functions::call, values::ZVal};
use skywalking::{
proto::v3::SpanLayer,
trace::span::{AbstractSpan, Span},
trace::span::{HandleSpanObject, Span},
};
use std::collections::HashSet;
use tracing::debug;
Expand Down Expand Up @@ -229,7 +229,7 @@ impl PredisPlugin {
))
})?;

let mut span_object = span.span_object_mut();
let span_object = span.span_object_mut();
span_object.set_span_layer(SpanLayer::Cache);
span_object.component_id = COMPONENT_PHP_PREDIS_ID;
span_object.add_tag(TAG_CACHE_TYPE, "redis");
Expand Down
6 changes: 3 additions & 3 deletions src/plugin/plugin_redis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ use phper::{
};
use skywalking::{
proto::v3::SpanLayer,
trace::span::{AbstractSpan, Span},
trace::span::{HandleSpanObject, Span},
};
use std::{any::Any, collections::HashMap};
use tracing::{debug, warn};
Expand Down Expand Up @@ -259,7 +259,7 @@ impl RedisPlugin {
Ok(ctx.create_exit_span(&format!("{}->{}", class_name, function_name), &addr))
})?;

let mut span_object = span.span_object_mut();
let span_object = span.span_object_mut();
span_object.set_span_layer(SpanLayer::Cache);
span_object.component_id = COMPONENT_PHP_REDIS_ID;
span_object.add_tag(TAG_CACHE_TYPE, "redis");
Expand Down Expand Up @@ -304,7 +304,7 @@ impl RedisPlugin {
Ok(ctx.create_exit_span(&format!("{}->{}", class_name, function_name), &peer))
})?;

let mut span_object = span.span_object_mut();
let span_object = span.span_object_mut();
span_object.set_span_layer(SpanLayer::Cache);
span_object.component_id = COMPONENT_PHP_REDIS_ID;
span_object.add_tag(TAG_CACHE_TYPE, "redis");
Expand Down
4 changes: 2 additions & 2 deletions src/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use anyhow::{anyhow, Context};
use dashmap::DashMap;
use once_cell::sync::Lazy;
use phper::{arrays::ZArr, eg, pg, sg, sys, values::ZVal};
use skywalking::trace::{propagation::decoder::decode_propagation, span::AbstractSpan, tracer};
use skywalking::trace::{propagation::decoder::decode_propagation, span::HandleSpanObject, tracer};
use std::{
panic::AssertUnwindSafe,
ptr::null_mut,
Expand Down Expand Up @@ -300,7 +300,7 @@ fn create_request_context(
None => ctx.create_entry_span(&operation_name),
};

let mut span_object = span.span_object_mut();
let span_object = span.span_object_mut();
span_object.component_id = COMPONENT_PHP_ID;
span_object.add_tag("url", url.to_string());
span_object.add_tag("http.method", method);
Expand Down
5 changes: 1 addition & 4 deletions src/worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,7 @@ use once_cell::sync::Lazy;
use phper::ini::ini_get;
use skywalking::{
management::{instance::Properties, manager::Manager},
reporter::{
grpc::{CollectItemConsume, GrpcReporter},
CollectItem,
},
reporter::{grpc::GrpcReporter, CollectItem, CollectItemConsume},
};
use std::{
cmp::Ordering, error::Error, ffi::CStr, fs, io, marker::PhantomData, num::NonZeroUsize,
Expand Down
Loading