Yan-Daojiang has posted comments on this change. ( 
http://gerrit.cloudera.org:8080/24269 )

Change subject: KUDU-3690: Add filtering to /metrics_prometheus
......................................................................


Patch Set 1: Code-Review+1

(2 comments)

LGTM, just two nits.

http://gerrit.cloudera.org:8080/#/c/24269/1/src/kudu/server/default_path_handlers.cc
File src/kudu/server/default_path_handlers.cc:

http://gerrit.cloudera.org:8080/#/c/24269/1/src/kudu/server/default_path_handlers.cc@533
PS1, Line 533: MetricFilters& filters = opts.filters;
             :   filters.entity_types   = ParseArray(req.parsed_args, "types");
             :   filters.entity_ids     = ParseArray(req.parsed_args, "ids");
             :   filters.entity_attrs   = ParseArray(req.parsed_args, 
"attributes");
             :   filters.entity_metrics = ParseArray(req.parsed_args, 
"metrics");
             :   filters.entity_level   = FindWithDefault(req.parsed_args, 
"level",
             :                                            
FLAGS_metrics_default_level);
             :   if (filters.entity_attrs.size() % 2 != 0) {
             :     resp->status_code = HttpStatusCode::BadRequest;
             :     WARN_NOT_OK(Status::InvalidArgument(""), "The parameter of 
'attributes' is wrong");
             :     return;
             :   }
nit: The new filter-parsing block is an exact duplicate of the one in 
WriteMetricsAsJson above (5 lines of ParseArray + the entity_attrs.size() % 2 
check). Should we extract a small helper so the two handlers stay in lockstep 
going forward, and so a future fix only has to be made in one place.


http://gerrit.cloudera.org:8080/#/c/24269/1/src/kudu/util/metrics-test.cc
File src/kudu/util/metrics-test.cc:

http://gerrit.cloudera.org:8080/#/c/24269/1/src/kudu/util/metrics-test.cc@1626
PS1, Line 1626: // entity-labels format for readable assertions. 
PrometheusFilterByEntityLevel
              : // is the exception: it uses test_entity (not a known type) and 
therefore
              : // stays in legacy format.
              : // TODO(KUDU-3775): once BuildPrometheusLabels() handles 
arbitrary entity types,
              : // switch PrometheusFilterByEntityLevel to entity-labels format 
too.
              :
              : TEST_F(MetricsTest, PrometheusFilterByEntityLevel) {
              :   MetricRegistry registry;
nit: this test relies on the legacy Prometheus format because 
BuildPrometheusLabels() DCHECKs on unknown entity types like test_entity. The 
header comment mentions it, but the dependency isn't pinned in code. Should we 
add:

google::FlagSaver saver;
FLAGS_metrics_prometheus_use_entity_labels = false;



--
To view, visit http://gerrit.cloudera.org:8080/24269
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I5c0b23ae5c184bf9e33e453736cef5e7ce8ee2e1
Gerrit-Change-Number: 24269
Gerrit-PatchSet: 1
Gerrit-Owner: Marton Greber <[email protected]>
Gerrit-Reviewer: Alexey Serbin <[email protected]>
Gerrit-Reviewer: Gabriella Lotz <[email protected]>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Yan-Daojiang <[email protected]>
Gerrit-Comment-Date: Tue, 05 May 2026 08:30:16 +0000
Gerrit-HasComments: Yes

Reply via email to