buger / goreplay

GoReplay is an open-source tool for capturing and replaying live HTTP traffic into a test environment in order to continuously test your system with real data. It can be used to increase confidence in code deployments, configuration changes and infrastructure changes.
https://goreplay.org
Other
18.46k stars 9 forks source link

java middleware with kafka out(json-format) miss req_boy #1199

Open 1528992118 opened 1 year ago

1528992118 commented 1 year ago

I am having a problem with goreplay version 1.3.2. When I used java middleware as a custom filter and exported to kafka, I found that the req_body was missing and I added a custom http header to the original message. here is the modified message after using java middleware

2 93941f900af407140afc1266 1686069659605231722 92821
HTTP/1.1 200 OK
transfer-encoding: chunked
X-TraceId: 840f302dbe741ea1
X-SpanId: 840f302dbe741ea1
Content-Type: application/json;charset=UTF-8
Date: Tue, 06 Jun 2023 16:40:59 GMT
X-Tenant-Id: 864f7539264b4c48993b997850737fc2

1b
{"data":[],"errorCode":"0"}
0

🐵🙈🙉

The http header X-Tenant-Id above is my custom addition,here are the messages in Kakfa

{
    "Req_URL": "",
    "Req_Type": "2",
    "Req_ID": "93941f900af407140afc1266",
    "Req_Ts": "1686069659605231722",
    "Req_Method": "HTTP/1.1",
    "Req_Headers": {
        "Content-Type": "application/json",
        "Date": "Tue, 06 Jun 2023 16:40:59 GMT",
        "Transfer-Encoding": "chunked",
        "X-Spanid": "840f302dbe741ea1",
        "X-Tenant-Id": "864f7539264b4c48993b997850737fc2",
        "X-Traceid": "840f302dbe741ea1"
    }
}

my Launch Script

./gor --input-raw :8080 --input-raw-track-response --middleware "java -jar goreplay-java.jar" --output-kafka-json-format --output-kafka-host 'ccf-uat-9-kafka-0.ccf-uat-9-kafka-headless.ccf-uat-9.svc.cluster.local:9092,ccf-uat-9-kafka-1.ccf-uat-9-kafka-headless.ccf-uat-9.svc.cluster.local:9092,ccf-uat-9-kafka-2.ccf-uat-9-kafka-headless.ccf-uat-9.svc.cluster.local:9092' --output-kafka-topic 'uat_gor'

Is this a bug or does goreplay do a checksum that doesn't allow modification of the original message? Thanks