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

Ag/json rpc metrics #11222

Closed
wants to merge 12 commits into from
Closed

Ag/json rpc metrics #11222

wants to merge 12 commits into from

Conversation

alexghr
Copy link
Contributor

@alexghr alexghr commented Jan 14, 2025

This PR adds spans for json rpc server requests

@alexghr alexghr force-pushed the ag/track-block-building-helpers branch from 4456aed to b881440 Compare January 14, 2025 21:35
@alexghr alexghr force-pushed the ag/track-block-building-helpers branch 2 times, most recently from b64d50c to fa6aeeb Compare January 14, 2025 21:44
Base automatically changed from ag/track-block-building-helpers to master January 16, 2025 15:28
spalladino added a commit that referenced this pull request Jan 20, 2025
Uses otel's `propagate` API to push the current trace from the json rpc
client to server using http headers. Client is instrumented by wrapping
the `fetch` function so it creates a new span and creates the headers,
and the server is instrumented by injecting new middleware that captures
the headers and starts a new span for the scope of the request.

Fixes #11185 
Fixes #11223 

Cherry-picks work by @alexghr from #11222

### Example run

Note that `traceId` is the same in both processes.

Bot with pxe logs:
```
[20:08:54.763] INFO: pxe:service Sent transaction 0x125eb560f33f44a28b98f0f065197eed8a8557bcb1ab2659eb34e5be0b33a9b4 {"trace_id":"d1143080037e46c037dea7cbdf8e29d6","span_id":"236692ffb270ecb4","trace_flags":"01"}
[20:08:54.763] INFO: bot Sent tx with hash 0x125eb560f33f44a28b98f0f065197eed8a8557bcb1ab2659eb34e5be0b33a9b4 {"trace_id":"d1143080037e46c037dea7cbdf8e29d6","span_id":"236692ffb270ecb4","trace_flags":"01"}
```

Node logs:
```
[20:08:54.762] INFO: node Received tx 0x125eb560f33f44a28b98f0f065197eed8a8557bcb1ab2659eb34e5be0b33a9b4 {"txHash":"0x125eb560f33f44a28b98f0f065197eed8a8557bcb1ab2659eb34e5be0b33a9b4","trace_id":"d1143080037e46c037dea7cbdf8e29d6","span_id":"5d1b907122754832","trace_flags":"01"}
```

---------

Co-authored-by: Alex Gherghisan <[email protected]>
@alexghr
Copy link
Contributor Author

alexghr commented Jan 20, 2025

merged in #11325

@alexghr alexghr closed this Jan 20, 2025
@alexghr alexghr deleted the ag/json-rpc-metrics branch January 20, 2025 14:33
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.

1 participant