[Bug] Proxy gRPC telemetry maps invalid language metadata to INTERNAL
- Dominant language
- Java
- Stars
- 22.6k
- Forks
- 12k
- Avg merge
- 3d 1h
- Merged PRs (30d)
- 27
Description
### Runtime platform environment
All platforms; reproduced by a unit test on the current `develop` branch.
### RocketMQ version
`develop` at `e3458616d207ee636b1762f0f8dcf788a590d59d`.
### Describe the Bug
`ContextInitPipeline` copies the client-controlled gRPC `language` metadata into `ProxyContext` without validation. `ClientActivity` later calls `LanguageCode.valueOf(ctx.getLanguage())` while registering producer and consumer channels.
An unknown language therefore throws `IllegalArgumentException`. The telemetry exception handler converts it to gRPC `INTERNAL`, so malformed client input is reported as a server failure.
### Steps to Reproduce
1. Create a producer `Settings` telemetry command.
2. Set the context language to `UNKNOWN_LANGUAGE`.
3. Submit it to `ClientActivity.telemetry`.
4. Observe gRPC status `INTERNAL`.
### Expected Behavior
Invalid or missing language metadata is rejected as a client-input error (`INVALID_ARGUMENT`) before channel registration.
### Actual Behavior
The request receives `INTERNAL`.
### Proposed Fix
Centralize `LanguageCode` parsing in `ClientActivity`, convert invalid values to `GrpcProxyException` with a bad-request code, and add regression coverage for the telemetry path.
Contributor guide
Research direction
Start with ContextInitPipeline and ClientActivity.telemetry, then trace LanguageCode parsing and GrpcProxyException handling. Reproduce the UNKNOWN_LANGUAGE case in the existing unit-test setup and add regression coverage for invalid and missing language metadata. Done means malformed input returns INVALID_ARGUMENT before channel registration instead of INTERNAL.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- grpc, java
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 68/100