Skip to content

[Draft] Adds support for tracing JSON-RPC 2.0 requests#1976

Closed
4406arthur wants to merge 1 commit intografana:mainfrom
4406arthur:features/jsonrpc
Closed

[Draft] Adds support for tracing JSON-RPC 2.0 requests#1976
4406arthur wants to merge 1 commit intografana:mainfrom
4406arthur:features/jsonrpc

Conversation

@4406arthur
Copy link
Copy Markdown

Adds support for tracing JSON-RPC 2.0 requests.
This enables more detailed monitoring and analysis of JSON-RPC based applications.

currently still cannot turn JSONRPC request into the new event_type (still with eventType 1) while send a JSONRPC request
image

can debug with the docker-compose

docker-compose up -d

#send a test request
curl http://localhost:8899 -X POST -H "Content-Type: application/json" --data '{"method":"getSlot","id":1,"jsonrpc":"2.0"}'

PoC
Adds support for tracing JSON-RPC 2.0 requests.

This enables more detailed monitoring and analysis of JSON-RPC based
applications.
@4406arthur 4406arthur requested a review from a team as a code owner May 22, 2025 14:35
@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


arthurma seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@4406arthur
Copy link
Copy Markdown
Author

Hi @marctc

I need some guidance with this feature, please.
It seems that extending it is not straightforward since JSON-RPC is already categorized as an HTTP request type.

is there a better way to implement

@grcevski
Copy link
Copy Markdown
Contributor

I need some guidance with this feature, please. It seems that extending it is not straightforward since JSON-RPC is already categorized as an HTTP request type.

is there a better way to implement

Hi @4406arthur,

I think we should be able to make this happen with our existing HTTP instrumentation. We need 2 different approaches, one for Go and one for Non-Go. We can start with whichever you prefer.

  1. For non-Go, things are already there for you except we likely need to add an option to extend the captured buffer so we can more reliably get the payload. If you look at httpfltr_transform.go there are uses of event.Buf[:]. In there you should be able to get your payload and write code to extract the RPC method. We have something like this already in func (event *BPFHTTPInfo) method() string { or func (event *BPFHTTPInfo) hostFromBuf() (string, int) {. The buffer is 256 bytes total for now, so for simple testing you should be able to get going. Once we have that code I can help you with ways we can configure and extend the buffer with command line options etc.

  2. For Go we need to add code in the Go uprobes to capture the body in a separate field and then it's similar to 1.

Please let me know if you have more question.

@4406arthur
Copy link
Copy Markdown
Author

I need some guidance with this feature, please. It seems that extending it is not straightforward since JSON-RPC is already categorized as an HTTP request type.
is there a better way to implement

Hi @4406arthur,

I think we should be able to make this happen with our existing HTTP instrumentation. We need 2 different approaches, one for Go and one for Non-Go. We can start with whichever you prefer.

  1. For non-Go, things are already there for you except we likely need to add an option to extend the captured buffer so we can more reliably get the payload. If you look at httpfltr_transform.go there are uses of event.Buf[:]. In there you should be able to get your payload and write code to extract the RPC method. We have something like this already in func (event *BPFHTTPInfo) method() string { or func (event *BPFHTTPInfo) hostFromBuf() (string, int) {. The buffer is 256 bytes total for now, so for simple testing you should be able to get going. Once we have that code I can help you with ways we can configure and extend the buffer with command line options etc.
  2. For Go we need to add code in the Go uprobes to capture the body in a separate field and then it's similar to 1.

Please let me know if you have more question.

thx, lets go for 1 solution

@marctc
Copy link
Copy Markdown
Contributor

marctc commented Jun 24, 2025

The code that this PR is touching is moved to https://github.com/open-telemetry/opentelemetry-ebpf-instrumentation and Beyla vendors it, so this is code is not here anymore. Please re-open the PR in that repository if this still relevant. Thanks and sorry for the inconveniences.

@marctc marctc closed this Jun 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants