Fix REST table metric statement type labels#17757
Merged
Merged
Conversation
6d05d1f to
71ee186
Compare
71ee186 to
50afa09
Compare
|
JackieTien97
approved these changes
May 25, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adjusts REST table v1 statement-latency metric labeling to avoid recording full table-model AST strings (high cardinality / potentially long query text) in performance_overview tags.
Changes:
- Record a stable metric
Tag.TYPEvalue (QUERY) for the REST table v1 query endpoint instead ofStatement#toString(). - Remove the REST table v1 non-query
EXECUTE_NON_QUERY_PLANlatency metric emission.
Comments suppressed due to low confidence (1)
external-service-impl/rest/src/main/java/org/apache/iotdb/rest/protocol/table/v1/impl/RestApiServiceImpl.java:239
executeNonQueryStatementno longer recordsperformance_overviewlatency (the previousaddStatementExecutionLatency(OperationType.EXECUTE_NON_QUERY_PLAN, …)timing block was removed). This is an observability regression: REST table v1 non-query calls will stop appearing in this metric while other REST implementations still emitEXECUTE_NON_QUERY_PLANtimers. Consider keeping the timer and switching the label to a stable, low-cardinality value (e.g., a constant likeStatementType.NULL.name()/"NON_QUERY", or a bounded mapping based onstatement.getClass()), instead of dropping it entirely.
} finally {
if (queryId != null) {
COORDINATOR.cleanupQueryExecution(queryId);
}
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Description
This PR avoids recording full table-model AST strings in REST table v1 query metric labels.
The REST table v1 query endpoint previously passed Statement#toString() as the type label to performance_overview, which could expose long query text such as Query{queryBody=...} and produce unstable/high-cardinality labels.
The change records QUERY for the query endpoint instead. For REST table v1 non-query, this PR removes the separate EXECUTE_NON_QUERY_PLAN metric recording to keep it aligned with the RPC SQL statement path, which does not use a separate SQL non-query metric interface.
I also checked other CommonUtils.addStatementExecutionLatency call sites and did not find remaining toString() usage for metric type labels.
Verification
./mvnw -pl external-service-impl/rest -am -DskipTests -DskipITs compile