apache / apache/rocketmq

Proxy gRPC metric settings should tolerate invalid collector address

Open Beginner friendly
#10,788 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
22.6k
Forks
12k
Avg merge
3d 1h
Merged PRs (30d)
27

Description

## Problem

`GrpcClientSettingsManager.mergeMetric(...)` parses the configured metric collector address with a raw split:

```java
String[] split = metricCollectorAddress.split(":");
String host = split[0];
int port = Integer.parseInt(split[1]);
```

When `metricCollectorMode=on` but `metricCollectorAddress` is blank or malformed, the settings merge path can throw `ArrayIndexOutOfBoundsException` or `NumberFormatException`. That can break gRPC client settings generation instead of returning a controlled metric setting.

## Expected behavior

Proxy should not fail client settings merge because of an invalid optional metric collector address. It should validate the address, log a clear warning, and disable metric collection for that settings response when the address cannot be parsed.

## Scope

Track 2 / Proxy gRPC client diagnostics and robustness. This only hardens metric endpoint parsing in gRPC client settings and should not change valid `host:port` handling.

## Evidence

- `proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/common/GrpcClientSettingsManager.java`
- `mergeMetric(...)` reads `metricCollectorAddress.split(":")` and indexes `split[1]` without validation.

Contributor guide

Open the contributing guide

Research direction

Start in proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/common/GrpcClientSettingsManager.java and inspect GrpcClientSettingsManager.mergeMetric(...), especially the metricCollectorAddress parsing. Verify behavior for blank or malformed addresses, confirm that a clear warning is logged and metric collection is disabled without breaking settings generation, and preserve valid host:port handling.

Written by the indexing model from the issue text.

Assessment

Tech stack
grpc, java
Domain
api, backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
76/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.