-
Notifications
You must be signed in to change notification settings - Fork 266
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
Adding Correlation id to the logs #1906
Conversation
rskj-core/src/main/java/co/rsk/rpc/netty/Web3ResultHttpResponseHandler.java
Outdated
Show resolved
Hide resolved
rskj-core/src/main/java/co/rsk/rpc/netty/LogTracingFilterHandler.java
Outdated
Show resolved
Hide resolved
rskj-core/src/main/java/co/rsk/rpc/netty/LogTracingFilterHandler.java
Outdated
Show resolved
Hide resolved
36ffca8
to
2cab4ab
Compare
@asoto-iov , tests are failing. Please check |
pipeline:run |
@@ -0,0 +1,18 @@ | |||
package co.rsk.util; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc header is missing
class TraceUtilsTest{ | ||
|
||
@Test | ||
void testToId() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we should also cover other cases, eg. when the test
value is null, its length is less than 15 etc
Kudos, SonarCloud Quality Gate passed! |
pipeline:run |
3 similar comments
pipeline:run |
pipeline:run |
pipeline:run |
38fb03b
to
b742e78
Compare
RskMessage rskmessage = (RskMessage) msg; | ||
Message message = rskmessage.getMessage(); | ||
|
||
switch (message.getMessageType()) { |
Check warning
Code scanning / CodeQL
Missing enum case in switch
|
||
import static org.junit.jupiter.api.Assertions.*; | ||
|
||
class TraceUtilsTest { |
Check notice
Code scanning / CodeQL
Unused classes and interfaces
Kudos, SonarCloud Quality Gate passed! |
pipeline:run |
Adding correlation id's to the logs in order to have a better tracking.
To see the logs it would be helpful to set the following log levels:
web3 -> DEBUG
net -> TRACE
wire -> TRACE
messagehandler -> TRACE
Description
The idea is to create unique identifiers for each action and use it to relate the different logged data along the code.
This is a draft to test possible solutions in different areas/modules.
Motivation and Context
Now is hard and track different actions by checking the logs as similar actions are being executed in parallel by different threads.
How Has This Been Tested?
It doesn't have side effects in other areas.
[JSON-RPC]
To check it you can send any JSON-RPC request and check the trace.id value in the logs.
The trace id is being generated randomly but you can add a custom one by adding a custom header
X-TRACE-ID
in the request.curl --location --request POST 'http://localhost:4444' \ --header 'Content-Type: application/json' \ --header 'X-TRACE-ID: custom_header_value' \ --data-raw '{ "jsonrpc":"2.0", "method":"web3_clientVersion", "params":[], "id":1 }'
Types of changes
It is a new feature
Checklist: