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

Add a match on RPC method during request and response processing #2

Open
Romero027 opened this issue Apr 1, 2024 · 2 comments
Open
Assignees

Comments

@Romero027
Copy link
Member

As title. An edge can have multiple RPC methods so we need to call the correct decoder based on the method name.

We can extract the method name from gRPC header (:path) and I added the extraction logic. We need to add codegen logic for the match. (Also, we might want to analyze the proto to know the list of methods first)

@Romero027 Romero027 self-assigned this Apr 1, 2024
@Romero027
Copy link
Member Author

grpc headers:

│ 2024-01-09T01:19:14.300241Z    warning    envoy wasm external/envoy/source/extensions/common/wasm/context.cc:1174    wasm log logging-client logging-client vm.sentinel.logging-client: Got 12 HTTP headers in #2.    thread=39                                                                                                                                          │
│ 2024-01-09T01:19:14.300356Z    warning    envoy wasm external/envoy/source/extensions/common/wasm/context.cc:1174    wasm log logging-client logging-client vm.sentinel.logging-client: #2 -> :method: POST    thread=39                                                                                                                                                 │
│ 2024-01-09T01:19:14.300366Z    warning    envoy wasm external/envoy/source/extensions/common/wasm/context.cc:1174    wasm log logging-client logging-client vm.sentinel.logging-client: #2 -> :scheme: http    thread=39                                                                                                                                                 │
│ 2024-01-09T01:19:14.300371Z    warning    envoy wasm external/envoy/source/extensions/common/wasm/context.cc:1174    wasm log logging-client logging-client vm.sentinel.logging-client: #2 -> :path: /ping_pb.PingService/PingEcho    thread=39                                                                                                                          │
│ 2024-01-09T01:19:14.300376Z    warning    envoy wasm external/envoy/source/extensions/common/wasm/context.cc:1174    wasm log logging-client logging-client vm.sentinel.logging-client: #2 -> :authority: ping:8081    thread=39                                                                                                                                         │
│ 2024-01-09T01:19:14.300381Z    warning    envoy wasm external/envoy/source/extensions/common/wasm/context.cc:1174    wasm log logging-client logging-client vm.sentinel.logging-client: #2 -> content-type: application/grpc    thread=39                                                                                                                                │
│ 2024-01-09T01:19:14.300385Z    warning    envoy wasm external/envoy/source/extensions/common/wasm/context.cc:1174    wasm log logging-client logging-client vm.sentinel.logging-client: #2 -> user-agent: grpc-go/1.53.0    thread=39                                                                                                                                    │
│ 2024-01-09T01:19:14.300390Z    warning    envoy wasm external/envoy/source/extensions/common/wasm/context.cc:1174    wasm log logging-client logging-client vm.sentinel.logging-client: #2 -> te: trailers    thread=39                                                                                                                                                  │
│ 2024-01-09T01:19:14.300395Z    warning    envoy wasm external/envoy/source/extensions/common/wasm/context.cc:1174    wasm log logging-client logging-client vm.sentinel.logging-client: #2 -> x-forwarded-proto: http    thread=39                                                                                                                                       │
│ 2024-01-09T01:19:14.300399Z    warning    envoy wasm external/envoy/source/extensions/common/wasm/context.cc:1174    wasm log logging-client logging-client vm.sentinel.logging-client: #2 -> x-request-id: 0f7a752f-1ed2-4340-a4dc-55222212d0a8    thread=39                                                                                                            │
│ 2024-01-09T01:19:14.300404Z    warning    envoy wasm external/envoy/source/extensions/common/wasm/context.cc:1174    wasm log logging-client logging-client vm.sentinel.logging-client: #2 -> x-envoy-decorator-operation: ping.default.svc.cluster.local:8081/*    thread=39                                                                                            │
│ 2024-01-09T01:19:14.300410Z    warning    envoy wasm external/envoy/source/extensions/common/wasm/context.cc:1174    wasm log logging-client logging-client vm.sentinel.logging-client: #2 -> x-envoy-peer-metadata-id: sidecar~10.244.0.76~frontend-86d5bd5cb5-wkdsn.default~default.svc.cluster.local    thread=39                                                     │
│ 2024-01-09T01:19:14.300415Z    warning    envoy wasm external/envoy/source/extensions/common/wasm/context.cc:1174    wasm log logging-client logging-client vm.sentinel.logging-client: #2 -> x-envoy-peer-metadata: ChwKDkFQUF9DT05UQUlORVJTEgoaCGZyb250ZW5kChoKCkNMVVNURVJfSUQSDBoKS3ViZXJuZXRlcwodCgxJTlNUQU5DRV9JUFMSDRoLMTAuMjQ0LjAuNzYKGQoNSVNUSU9fVkVSU0lPThIIGgY │
│ 2024-01-09T01:19:14.300971Z    warning    envoy wasm external/envoy/source/extensions/common/wasm/context.cc:1174    wasm log logging-client logging-client vm.sentinel.logging-client: executing on_http_request_body    thread=39                                                                                                                                      │
│ 2024-01-09T01:19:14.300986Z    warning    envoy wasm external/envoy/source/extensions/common/wasm/context.cc:1174    wasm log logging-client logging-client vm.sentinel.logging-client: Context id #2 and path is PingEcho.    thread=39                                                                                                                                 │
│ 2024-01-09T01:19:14.300999Z    warning    envoy wasm external/envoy/source/extensions/common/wasm/context.cc:1174    wasm log logging-client logging-client vm.sentinel.logging-client: body.len(): 5    thread=39                                                                                                                                                       │
│ 2024-01-09T01:19:14.301006Z    warning    envoy wasm external/envoy/source/extensions/common/wasm/context.cc:1174    wasm log logging-client logging-client vm.sentinel.logging-client: body : redis    thread=39                                                                                                                                                        │
│ 2024-01-09T01:19:14.306952Z    warning    envoy wasm external/envoy/source/extensions/common/wasm/context.cc:1174    wasm log logging-client logging-client vm.sentinel.logging-client: executing on_http_response_headers    thread=39                                                                                                                                  │
│ 2024-01-09T01:19:14.306980Z    warning    envoy wasm external/envoy/source/extensions/common/wasm/context.cc:1174    wasm log logging-client logging-client vm.sentinel.logging-client: #2 -> :status: 200    thread=39                                                                                                                                                  │
│ 2024-01-09T01:19:14.306986Z    warning    envoy wasm external/envoy/source/extensions/common/wasm/context.cc:1174    wasm log logging-client logging-client vm.sentinel.logging-client: #2 -> content-type: application/grpc    thread=39                                                                                                                                │
│ 2024-01-09T01:19:14.306991Z    warning    envoy wasm external/envoy/source/extensions/common/wasm/context.cc:1174    wasm log logging-client logging-client vm.sentinel.logging-client: #2 -> x-envoy-upstream-service-time: 5    thread=39                                                                                                                              │
│ 2024-01-09T01:19:14.306995Z    warning    envoy wasm external/envoy/source/extensions/common/wasm/context.cc:1174    wasm log logging-client logging-client vm.sentinel.logging-client: #2 -> x-envoy-peer-metadata-id: sidecar~10.244.0.64~ping-79f769db4f-wwn6n.default~default.svc.cluster.local    thread=39                                                         │
│ 2024-01-09T01:19:14.307001Z    warning    envoy wasm external/envoy/source/extensions/common/wasm/context.cc:1174    wasm log logging-client logging-client vm.sentinel.logging-client: #2 -> x-envoy-peer-metadata: ChgKDkFQUF9DT05UQUlORVJTEgYaBHBpbmcKGgoKQ0xVU1RFUl9JRBIMGgpLdWJlcm5ldGVzCh0KDElOU1RBTkNFX0lQUxINGgsxMC4yNDQuMC42NAoZCg1JU1RJT19WRVJTSU9OEggaBjEuMjA │
│ 2024-01-09T01:19:14.307006Z    warning    envoy wasm external/envoy/source/extensions/common/wasm/context.cc:1174    wasm log logging-client logging-client vm.sentinel.logging-client: #2 -> date: Tue, 09 Jan 2024 01:19:13 GMT    thread=39                                                                                                                           │
│ 2024-01-09T01:19:14.307011Z    warning    envoy wasm external/envoy/source/extensions/common/wasm/context.cc:1174    wasm log logging-client logging-client vm.sentinel.logging-client: #2 -> server: istio-envoy    thread=39                                                                                                                                           │
│ 2024-01-09T01:19:14.307195Z    warning    envoy wasm external/envoy/source/extensions/common/wasm/context.cc:1174    wasm log logging-client logging-client vm.sentinel.logging-client: executing on_http_response_body    thread=39

@Romero027
Copy link
Member Author

The method name can be stored as a field in the struct and will be preserved, just as context ids.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant