Skip to content

Commit

Permalink
8.0.4 (#221)
Browse files Browse the repository at this point in the history
* fix: undo clippy changes to trace::record calls
  • Loading branch information
aembke committed Feb 27, 2024
1 parent b070601 commit db2e909
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,7 @@
## 8.0.4

* Fix tracing span annotations.

## 8.0.3

* Box large futures to reduce stack usage.
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "fred"
version = "8.0.3"
version = "8.0.4"
authors = ["Alec Embke <aembke@gmail.com>"]
edition = "2021"
description = "An async Redis client built on Tokio."
Expand Down
3 changes: 2 additions & 1 deletion src/trace/enabled.rs
Expand Up @@ -53,7 +53,8 @@ pub fn set_network_span(inner: &Arc<RedisClientInner>, command: &mut RedisComman
}

pub fn record_response_size(span: &Span, frame: &Frame) {
span.record("res_size", protocol_utils::resp3_frame_size(frame));
#[allow(clippy::needless_borrows_for_generic_args)]
span.record("res_size", &protocol_utils::resp3_frame_size(frame));
}

pub fn create_command_span(inner: &Arc<RedisClientInner>) -> Span {
Expand Down
11 changes: 7 additions & 4 deletions src/utils.rs
Expand Up @@ -442,6 +442,8 @@ where

/// Send a command to the server, with tracing.
#[cfg(any(feature = "full-tracing", feature = "partial-tracing"))]
#[allow(clippy::needless_borrows_for_generic_args)]
// despite what clippy says, this^ actually matters for tracing `record` calls (at least it seems where `V: Copy`)
pub async fn request_response<C, F, R>(client: &C, func: F) -> Result<Resp3Frame, RedisError>
where
C: ClientLike,
Expand All @@ -458,18 +460,19 @@ where

let (mut command, rx, req_size) = {
let args_span = trace::create_args_span(cmd_span.id(), inner);
let _enter = args_span.enter();
#[allow(clippy::let_unit_value)]
let _guard = args_span.enter();
let (tx, rx) = oneshot_channel();

let mut command: RedisCommand = func()?.into();
command.response = ResponseKind::Respond(Some(tx));

let req_size = protocol_utils::args_size(command.args());
args_span.record("num_args", command.args().len());
args_span.record("num_args", &command.args().len());
(command, rx, req_size)
};
cmd_span.record("cmd", command.kind.to_str_debug());
cmd_span.record("req_size", req_size);
cmd_span.record("cmd", &command.kind.to_str_debug());
cmd_span.record("req_size", &req_size);

let queued_span = trace::create_queued_span(cmd_span.id(), inner);
let timed_out = command.timed_out.clone();
Expand Down

0 comments on commit db2e909

Please sign in to comment.