Copilot commented on code in PR #13506:
URL: https://github.com/apache/trafficserver/pull/13506#discussion_r3800438642
##########
include/shared/rpc/RPCRequests.h:
##########
@@ -117,6 +117,8 @@ struct ClientRequestNotification : JSONRPCRequest {
// handy definitions.
static const std::vector<int> CONFIG_REC_TYPES = {1, 16};
static const std::vector<int> METRIC_REC_TYPES = {2, 4, 32};
+// Same as METRIC_REC_TYPES, plus 64 (RECT_HIDDEN_METRIC, see RecDefs.h) to
also match hidden metrics.
+static const std::vector<int> METRIC_REC_TYPES_INCLUDE_HIDDEN = {2, 4, 32, 64};
Review Comment:
METRIC_REC_TYPES(_INCLUDE_HIDDEN) does not include RECT_PROCESS (1), but
RecLookupMatchingRecords synthesizes ts::Metrics-backed results with
rec_type=RECT_PROCESS. That combination makes JSONRPC filtering treat those
metrics as a REQUESTED_TYPE_MISMATCH and drop them. Include RECT_PROCESS in the
metric request type set so ts::Metrics-backed metrics (including
derived/per_server metrics) are returned consistently.
##########
src/records/RecCore.cc:
##########
@@ -612,6 +612,22 @@ RecLookupMatchingRecords(unsigned rec_type, const char
*match, void (*callback)(
});
}
+ if (rec_type & RECT_HIDDEN_METRIC) {
+ // Opt-in only: hidden metrics are never reachable through RECT_ALL, see
RecDefs.h.
+ for (auto &&[name, type, val] : ts::Metrics::hidden_instance()) {
+ if (regex.exec(name.data())) {
+ RecRecord tmp;
+
+ tmp.rec_type = RECT_PROCESS;
+
+ tmp.name = name.data();
Review Comment:
Hidden metrics are added only when RECT_HIDDEN_METRIC is requested, but the
pseudo-record is currently tagged as RECT_PROCESS. The JSONRPC handler filters
results by (requested_mask & record->rec_type), so this will be dropped as a
type mismatch even when hidden metrics were explicitly requested.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]