Commit ba3efd7
committed
Fix EXECUTE profiling metric by recording inside AnalyticsExecutionEngine
Move EXECUTE metric recording into AnalyticsExecutionEngine.execute(),
between the actual execution (planExecutor + row conversion) and the
listener.onResponse() call. This ensures the metric is written before
SimpleJsonResponseFormatter calls QueryProfiling.finish() to snapshot.
Previously context.measure() was used in RestUnifiedQueryAction, but
finish() was called inside the listener callback (synchronously) before
measure()'s finally block could write the metric, resulting in 0ms.
Add IT assertion that execute phase time_ms > 0 to catch this bug.
Signed-off-by: Kai Huang <kaihuang@amazon.com>
Signed-off-by: Kai Huang <ahkcs@amazon.com>1 parent ce4f6c5 commit ba3efd7
3 files changed
Lines changed: 20 additions & 16 deletions
File tree
- core/src/main/java/org/opensearch/sql/executor/analytics
- integ-test/src/test/java/org/opensearch/sql/ppl
- plugin/src/main/java/org/opensearch/sql/plugin/rest
Lines changed: 11 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
27 | 30 | | |
28 | 31 | | |
29 | 32 | | |
| |||
67 | 70 | | |
68 | 71 | | |
69 | 72 | | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
70 | 79 | | |
71 | 80 | | |
72 | 81 | | |
73 | 82 | | |
74 | 83 | | |
75 | 84 | | |
| 85 | + | |
| 86 | + | |
76 | 87 | | |
77 | 88 | | |
78 | 89 | | |
| |||
Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
131 | 131 | | |
132 | 132 | | |
133 | 133 | | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
134 | 141 | | |
135 | 142 | | |
136 | 143 | | |
| |||
Lines changed: 2 additions & 16 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
35 | 34 | | |
36 | 35 | | |
37 | 36 | | |
| |||
123 | 122 | | |
124 | 123 | | |
125 | 124 | | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
| 125 | + | |
134 | 126 | | |
135 | 127 | | |
136 | 128 | | |
| |||
148 | 140 | | |
149 | 141 | | |
150 | 142 | | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
| 143 | + | |
158 | 144 | | |
159 | 145 | | |
160 | 146 | | |
| |||
0 commit comments