Proxy gRPC metric settings should tolerate invalid collector address

Open Beginner friendly
#10,788 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

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

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.

Description

Problem

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

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.
Dominant language
Java
Stars
22.6k
Forks
12k
Avg merge
3d 12h
Merged PRs (30d)
25

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from apache/rocketmq

All issues in apache/rocketmq

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.