Commit d7412c9
[9.2] [Discover][Unified Traces] Improve Unified Traces API call latencies (elastic#240285) (elastic#240329)
# Backport
This will backport the following commits from `main` to `9.2`:
- [[Discover][Unified Traces] Improve Unified Traces API call latencies
(elastic#240285)](elastic#240285)
<!--- Backport version: 9.6.6 -->
### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)
<!--BACKPORT [{"author":{"name":"Gonçalo Rica Pais da
Silva","email":"[email protected]"},"sourceCommit":{"committedDate":"2025-10-23T15:32:15Z","message":"[Discover][Unified
Traces] Improve Unified Traces API call latencies (elastic#240285)\n\n##
Summary\n\nIn some of the Unified Trace API calls, there are various
async calls\nbeing made sequentially when they could in fact be made
concurrently.\nThis PR fixes that by making these small improvements to
make various\ncalls concurrent where possible and thus avoiding the
added latency.\n\nThese changes were benchmarked and for the unified
trace call, it has\nthe following profile: the first time is the elapsed
time for getting\nthe APM and Logs clients, and the second time is the
total time elapsed\nwith the full response
returned:\n\nBEFORE:\n```\nclients: 648.295ms\nresponse:
1.165s\n\nclients: 653.911ms\nresponse: 1.166s\n\nclients:
649.343ms\nresponse: 1.328s\n```\n\nAFTER:\n```\nclients:
335.631ms\nresponse: 836.463ms\n\nclients: 332.548ms\nresponse:
669.448ms\n\nclients: 325.188ms\nresponse: 820.929ms\n```\n\n## How to
test\n\n- Go to Discover page in Observability mode, select a trace
index in\neither classic or ES|QL mode\n- Going to a trace overview, the
focused trace waterfall and the full\ntrace waterfall views should not
regress in functionality or
error\nunexpectedly.","sha":"ca9eb7c8fc8e5a01bf8601573b3da66bb821307c","branchLabelMapping":{"^v9.3.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:obs-ux-infra_services","backport:version","v9.2.0","v9.3.0","v9.1.6","v8.19.6","v9.0.9"],"title":"[Discover][Unified
Traces] Improve Unified Traces API call
latencies","number":240285,"url":"https://github.com/elastic/kibana/pull/240285","mergeCommit":{"message":"[Discover][Unified
Traces] Improve Unified Traces API call latencies (elastic#240285)\n\n##
Summary\n\nIn some of the Unified Trace API calls, there are various
async calls\nbeing made sequentially when they could in fact be made
concurrently.\nThis PR fixes that by making these small improvements to
make various\ncalls concurrent where possible and thus avoiding the
added latency.\n\nThese changes were benchmarked and for the unified
trace call, it has\nthe following profile: the first time is the elapsed
time for getting\nthe APM and Logs clients, and the second time is the
total time elapsed\nwith the full response
returned:\n\nBEFORE:\n```\nclients: 648.295ms\nresponse:
1.165s\n\nclients: 653.911ms\nresponse: 1.166s\n\nclients:
649.343ms\nresponse: 1.328s\n```\n\nAFTER:\n```\nclients:
335.631ms\nresponse: 836.463ms\n\nclients: 332.548ms\nresponse:
669.448ms\n\nclients: 325.188ms\nresponse: 820.929ms\n```\n\n## How to
test\n\n- Go to Discover page in Observability mode, select a trace
index in\neither classic or ES|QL mode\n- Going to a trace overview, the
focused trace waterfall and the full\ntrace waterfall views should not
regress in functionality or
error\nunexpectedly.","sha":"ca9eb7c8fc8e5a01bf8601573b3da66bb821307c"}},"sourceBranch":"main","suggestedTargetBranches":["9.2","9.1","8.19","9.0"],"targetPullRequestStates":[{"branch":"9.2","label":"v9.2.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.3.0","branchLabelMappingKey":"^v9.3.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/240285","number":240285,"mergeCommit":{"message":"[Discover][Unified
Traces] Improve Unified Traces API call latencies (elastic#240285)\n\n##
Summary\n\nIn some of the Unified Trace API calls, there are various
async calls\nbeing made sequentially when they could in fact be made
concurrently.\nThis PR fixes that by making these small improvements to
make various\ncalls concurrent where possible and thus avoiding the
added latency.\n\nThese changes were benchmarked and for the unified
trace call, it has\nthe following profile: the first time is the elapsed
time for getting\nthe APM and Logs clients, and the second time is the
total time elapsed\nwith the full response
returned:\n\nBEFORE:\n```\nclients: 648.295ms\nresponse:
1.165s\n\nclients: 653.911ms\nresponse: 1.166s\n\nclients:
649.343ms\nresponse: 1.328s\n```\n\nAFTER:\n```\nclients:
335.631ms\nresponse: 836.463ms\n\nclients: 332.548ms\nresponse:
669.448ms\n\nclients: 325.188ms\nresponse: 820.929ms\n```\n\n## How to
test\n\n- Go to Discover page in Observability mode, select a trace
index in\neither classic or ES|QL mode\n- Going to a trace overview, the
focused trace waterfall and the full\ntrace waterfall views should not
regress in functionality or
error\nunexpectedly.","sha":"ca9eb7c8fc8e5a01bf8601573b3da66bb821307c"}},{"branch":"9.1","label":"v9.1.6","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.19","label":"v8.19.6","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"9.0","label":"v9.0.9","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->
Co-authored-by: Gonçalo Rica Pais da Silva <[email protected]>1 parent 2bd81f2 commit d7412c9
File tree
2 files changed
+67
-59
lines changed- x-pack/solutions/observability/plugins/apm/server/routes/traces
2 files changed
+67
-59
lines changedLines changed: 52 additions & 34 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | | - | |
| 36 | + | |
37 | 37 | | |
| 38 | + | |
38 | 39 | | |
39 | 40 | | |
40 | 41 | | |
| |||
85 | 86 | | |
86 | 87 | | |
87 | 88 | | |
| 89 | + | |
88 | 90 | | |
89 | 91 | | |
90 | 92 | | |
91 | 93 | | |
92 | 94 | | |
93 | | - | |
94 | 95 | | |
95 | 96 | | |
| 97 | + | |
96 | 98 | | |
97 | 99 | | |
98 | 100 | | |
99 | 101 | | |
100 | 102 | | |
101 | | - | |
102 | | - | |
| 103 | + | |
103 | 104 | | |
104 | 105 | | |
105 | 106 | | |
106 | | - | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
107 | 116 | | |
108 | 117 | | |
109 | 118 | | |
| |||
148 | 157 | | |
149 | 158 | | |
150 | 159 | | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
151 | 165 | | |
152 | | - | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | | - | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
181 | 199 | | |
182 | 200 | | |
183 | 201 | | |
| |||
Lines changed: 15 additions & 25 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
137 | 137 | | |
138 | 138 | | |
139 | 139 | | |
140 | | - | |
141 | | - | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
142 | 144 | | |
143 | 145 | | |
144 | 146 | | |
145 | 147 | | |
146 | 148 | | |
147 | | - | |
| 149 | + | |
148 | 150 | | |
149 | 151 | | |
150 | 152 | | |
151 | 153 | | |
152 | 154 | | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | 155 | | |
161 | 156 | | |
162 | | - | |
163 | 157 | | |
164 | 158 | | |
165 | 159 | | |
| |||
183 | 177 | | |
184 | 178 | | |
185 | 179 | | |
186 | | - | |
187 | | - | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
188 | 184 | | |
189 | 185 | | |
190 | 186 | | |
191 | 187 | | |
192 | 188 | | |
193 | | - | |
194 | | - | |
195 | | - | |
196 | | - | |
197 | | - | |
198 | | - | |
199 | | - | |
200 | | - | |
201 | | - | |
| 189 | + | |
202 | 190 | | |
203 | 191 | | |
| 192 | + | |
204 | 193 | | |
205 | 194 | | |
206 | 195 | | |
207 | 196 | | |
208 | 197 | | |
209 | | - | |
210 | 198 | | |
211 | 199 | | |
212 | 200 | | |
| |||
233 | 221 | | |
234 | 222 | | |
235 | 223 | | |
236 | | - | |
237 | | - | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
238 | 228 | | |
239 | 229 | | |
240 | 230 | | |
| |||
0 commit comments