Skip to content

Proxy gRPC metric settings should tolerate invalid collector address #10788

Description

@Aias00

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions