Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
parity
Mirrored projects
jsonrpsee
Commits
5e01e6be
Commit
5e01e6be
authored
Jul 28, 2022
by
patrick
Browse files
add id to tracing span
parent
e7dc80d0
Changes
5
Hide whitespace changes
Inline
Side-by-side
client/http-client/src/client.rs
View file @
5e01e6be
...
...
@@ -189,7 +189,7 @@ impl ClientT for HttpClient {
let
guard
=
self
.id_manager
.next_request_id
()
?
;
let
id
=
guard
.inner
();
let
request
=
RequestSer
::
new
(
&
id
,
method
,
params
);
let
trace
=
RpcTracing
::
method_call
(
method
);
let
trace
=
RpcTracing
::
method_call
(
method
,
&
id
);
let
_enter
=
trace
.span
()
.enter
();
let
raw
=
serde_json
::
to_string
(
&
request
)
.map_err
(
Error
::
ParseError
)
?
;
...
...
core/src/client/async_client/mod.rs
View file @
5e01e6be
...
...
@@ -269,7 +269,7 @@ impl ClientT for Client {
let
(
send_back_tx
,
send_back_rx
)
=
oneshot
::
channel
();
let
guard
=
self
.id_manager
.next_request_id
()
?
;
let
id
=
guard
.inner
();
let
trace
=
RpcTracing
::
method_call
(
method
);
let
trace
=
RpcTracing
::
method_call
(
method
,
&
id
);
let
_enter
=
trace
.span
()
.enter
();
let
raw
=
serde_json
::
to_string
(
&
RequestSer
::
new
(
&
id
,
method
,
params
))
.map_err
(
Error
::
ParseError
)
?
;
...
...
@@ -363,10 +363,11 @@ impl SubscriptionClientT for Client {
let
guard
=
self
.id_manager
.next_request_ids
(
2
)
?
;
let
mut
ids
:
Vec
<
Id
>
=
guard
.inner
();
let
trace
=
RpcTracing
::
method_call
(
subscribe_method
);
let
id
=
ids
[
0
]
.clone
();
let
trace
=
RpcTracing
::
method_call
(
subscribe_method
,
&
id
);
let
_enter
=
trace
.span
()
.enter
();
let
id
=
ids
[
0
]
.clone
();
let
raw
=
serde_json
::
to_string
(
&
RequestSer
::
new
(
&
id
,
subscribe_method
,
params
))
.map_err
(
Error
::
ParseError
)
?
;
...
...
core/src/tracing.rs
View file @
5e01e6be
use
serde
::
Serialize
;
use
tracing
::
Level
;
use
jsonrpsee_types
::
Id
;
#[derive(Debug)]
/// Wrapper over [`tracing::Span`] to trace individual method calls, notifications and similar.
...
...
@@ -9,8 +10,8 @@ impl RpcTracing {
/// Create a `method_call` tracing target.
///
/// To enable this you need to call `RpcTracing::method_call("some_method").span().enable()`.
pub
fn
method_call
(
method
:
&
str
)
->
Self
{
Self
(
tracing
::
span!
(
tracing
::
Level
::
DEBUG
,
"method_call"
,
%
method
))
pub
fn
method_call
(
method
:
&
str
,
id
:
&
Id
)
->
Self
{
Self
(
tracing
::
span!
(
tracing
::
Level
::
DEBUG
,
"method_call"
,
%
method
,
id
=?
id
))
}
/// Create a `notification` tracing target.
...
...
http-server/src/server.rs
View file @
5e01e6be
...
...
@@ -685,7 +685,8 @@ async fn process_health_request<M: Middleware>(
request_start
:
M
::
Instant
,
max_log_length
:
u32
,
)
->
Result
<
hyper
::
Response
<
hyper
::
Body
>
,
HyperError
>
{
let
trace
=
RpcTracing
::
method_call
(
&
health_api
.method
);
let
id
=
Id
::
Number
(
100
);
let
trace
=
RpcTracing
::
method_call
(
&
health_api
.method
,
&
id
);
let
_enter
=
trace
.span
()
.enter
();
tx_log_from_str
(
"HTTP health API"
,
max_log_length
);
...
...
@@ -805,7 +806,7 @@ where
async
fn
process_single_request
<
M
:
Middleware
>
(
data
:
Vec
<
u8
>
,
call
:
CallData
<
'_
,
M
>
)
->
MethodResponse
{
if
let
Ok
(
req
)
=
serde_json
::
from_slice
::
<
Request
>
(
&
data
)
{
let
trace
=
RpcTracing
::
method_call
(
&
req
.method
);
let
trace
=
RpcTracing
::
method_call
(
&
req
.method
,
&
req
.id
);
let
_enter
=
trace
.span
()
.enter
();
rx_log_from_json
(
&
req
,
call
.max_log_length
);
...
...
ws-server/src/server.rs
View file @
5e01e6be
...
...
@@ -893,7 +893,7 @@ where
async
fn
process_single_request
<
M
:
Middleware
>
(
data
:
Vec
<
u8
>
,
call
:
CallData
<
'_
,
M
>
)
->
MethodResult
{
if
let
Ok
(
req
)
=
serde_json
::
from_slice
::
<
Request
>
(
&
data
)
{
let
trace
=
RpcTracing
::
method_call
(
&
req
.method
);
let
trace
=
RpcTracing
::
method_call
(
&
req
.method
,
&
req
.id
);
let
_enter
=
trace
.span
()
.enter
();
rx_log_from_json
(
&
req
,
call
.max_log_length
);
...
...
Paritytech CI
@paritytech-ci
mentioned in commit
ffb1fc41
·
Jul 29, 2022
mentioned in commit
ffb1fc41
mentioned in commit ffb1fc41911aea487fa31b75b77793f8745ea403
Toggle commit list
Paritytech CI
@paritytech-ci
mentioned in commit
3c416ac5
·
Jul 29, 2022
mentioned in commit
3c416ac5
mentioned in commit 3c416ac56fb2bb678a051afaf9940af3c3daf45d
Toggle commit list
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment