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

RESTEasy Reactive client and server: make it trivial to dump HTTP traffic #22213

Open
FroMage opened this issue Dec 14, 2021 · 14 comments
Open
Labels
area/rest kind/enhancement New feature or request

Comments

@FroMage
Copy link
Member

FroMage commented Dec 14, 2021

Description

This mostly happens to me on the client, but I think it can also be useful for the server.

When using MP REST Client via RR Client, I'm doing a call via a proxy: someclient.someMethod() so I don't have access to the request/response and if something goes wrong and a header is missing, or an exception is thrown or whatever, it's not trivial at all to know why, because all this is hidden from the user.

I turned out to have an exceptional status code returned by my github client due to a missing header and I had to use a debugger or TCP inspector to see it, because RR was hiding that HTTP traffic from me.

I think we should add an option to dump all HTTP traffic with a property:

# Client and Server
quarkus.resteasy-reactive.dump-traffic=true
# Only server
quarkus.resteasy-reactive.server.dump-traffic=true
# Only client
quarkus.resteasy-reactive.client.dump-traffic=true

This would have saved me quite a few times.

Implementation ideas

No response

@FroMage FroMage added kind/enhancement New feature or request area/rest labels Dec 14, 2021
@quarkus-bot
Copy link

quarkus-bot bot commented Dec 14, 2021

/cc @geoand, @stuartwdouglas

@FroMage
Copy link
Member Author

FroMage commented Dec 14, 2021

This would have been particularly useful for OIDC to see what our extension was doing talking to the OIDC provider. But in this case it's using the Vert.x client I think. Perhaps it's not RR that should handle this but Vert.x, this way it works across the entire framework?

@geoand
Copy link
Contributor

geoand commented Dec 14, 2021

Perhaps it's not RR that should handle this but Vert.x, this way it works across the entire framework?

+1 on this - cc @cescoffier

@cescoffier
Copy link
Member

Yes, for the server at least we can do that at the vertx level (there is an existing route handler) For the client, it's a bit more complicated, but I agree that we should provide that feature.

How many times I got a 400 - Bad request without understanding what was passed and received?

@geoand
Copy link
Contributor

geoand commented Dec 14, 2021 via email

@michalszynkiewicz
Copy link
Member

@FroMage does #21286 go in this direction?

@FroMage
Copy link
Member Author

FroMage commented Dec 21, 2021

It does, but we could not find it, because it was not documented :(

So we need to document it.

Now I'm thinking we should have something in the DEV UI to make it easier to display.

@michalszynkiewicz
Copy link
Member

it wouldn't be that hard to add sth to dev ui, we can easily collect requests and responses and we know how to do websockets with dev ui...

I added a few words to the docs:
#22445

@FroMage
Copy link
Member Author

FroMage commented Jan 7, 2022

Ideally we could even solve this at the vert.x level, because OIDC uses the Vert.x HTTP client and I also want to dump this.

Either logging on the console, or one file per request, but something as useful as you get from the browser network console.

@geoand
Copy link
Contributor

geoand commented Jan 7, 2022

If I get around to introducing pcap dump support into Vertx, then this would be achieved easily

@FroMage
Copy link
Member Author

FroMage commented Jan 18, 2022

pcap would be nice, but a text file generated per request would be much simpler to use: target/logs/{datetime}-{server/host-if-client}-{method}-{uri}.log containing the dumped request/response with headers, like dev console does in browsers.
I mean, both solutions would be great:

quarkus.http.log=pcap
# for text files
quarkus.http.log=true

@geoand
Copy link
Contributor

geoand commented Jan 28, 2022

I came up with a patch in Vert.x (I also have something in Quarkus) to allow us to capture Vert.x based HTTP Server and Client traffic in a pcap file that can be opened with Wireshark and looks something like this:
Screenshot from 2022-01-28 16-51-38

@kostacasa
Copy link

kostacasa commented Mar 22, 2022

It's likely we'll want to enable trace logging in serverless environments that don't have a local filesystem. An environment variable that can instruct the server to dump the wire logs to console would be much more developer friendly. This is now possible for the client with the introduction of #21286 and it has proven to be useful on multiple occasions. We would really prefer something similar for the server portion that doesn't require downloading pcap dumps.

@geoand
Copy link
Contributor

geoand commented Mar 29, 2022

Vert.x will provide something similar hopefully in 4.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/rest kind/enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants