Commit 967f440
feat: Add the plumbing for application blocking latencies client side metrics (#1575)
* Remove console log * Generate more documentation * Require a call to fetch the project when using MT * use same date provider for all metrics tracers * In the metrics traceer, don’t fetch the project for each call * Remove only * Add open telemetry api * Add TestExecuteQuery_EmptyResponse to failures * TestExecuteQuery_SingleSimpleRow known failures * Fix syntax in known failures * Add two tests to the known failures * TestSampleRowKeys_Retry_WithRetryInfo to known fai * Change word dimensions to attributes * Change more docs to use Attributes instead of dim * attributes * Test should use attributes as string * For Windows replace carriage return * Update documentation with types * Add metrics collector * Metrics handler, GCPMetricsHandler and tests add * Remove only * Add metrics handlers parameter to Doc * Don’t require retries to be passed into metrics collector * Remove testMeterProvider * Remove the attributesToString function * Eliminate unused class * Generate documentation for the IMetricsHandler * Generate documentation for GCPMetricsHandler * Restrict attributes interfaces and solve compile * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * use undefined instead of null * Introduce enums for allowable values * Add more headers * Remove only * Use null to pass values around. Not undefined * Modify test step * Add metrics * Don’t provide first response latency * Remove firstResponseLatency from operation metrics * Expose interface allowing undefined not null * Better explanations for design decision inline * Use attempt start time not operation start time for firstResponseLatency * Adjust tests for first response latency * Remove TODO * Use the MethodName enum instead of string * Don’t use enum for streaming operation * Remove copy/pasted comment * Rename to OperationMetricsCollector * Rename the method to getOperationAttributes * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * Add aggregate views to the GCP metrics handler * Adjust test based on enum changes * Update the documentation to be more descriptive * Add the state machine to the metrics collector * Use grpc code to report attempt/operation status * Remove parameters from JS Documentation * Update interfaces and some metrics - Introduce attributes interface for each metric. - First latency should be recorded per operation not per attempt - Update tests for firstResponseLatency change * Documentation for all the different interfaces * use operation start time as the benchmark * Final operation status shouldn’t be included per a * Move OnAttemptCompleteInfo Remove unused imports too * Provide AttemptOnlyAttributes in the only file In the only file that it is needed * Move over the OperationOnlyAttributes * Adjust the guard so that it is earlier * Adjust the test output file Dates don’t get read for rows after the first row anymore. * Change streaming back to STREAMING/UNARY * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * Change metrics handler interface to support each metric * Revert "Change metrics handler interface to support each metric" This reverts commit 2781561. * Supply the projectId later in the client side metrics lifecycle * Remove the GCPMetricsHandler file * Change location of the client-side-metrics-attribu file * Change common test utilities folder name * Remove aliases for grpc status * Should be MethodName type * Rename variable as it expands beyond latency * Remove private methods for building attributes * Replace the logger class with a simple object * Remove only * Remove the logger classes Replace them with a simpler object * Add stubs * Revert "Remove the GCPMetricsHandler file" This reverts commit b6f1302. * Add exporter and helper function * Add headers and fixture * Add milliseconds unit * Record to a histogram * Add necessary elements to the GCPMetricsHandler # Conflicts: # src/client-side-metrics/gcp-metrics-handler.ts * Pass an exporter into the GCPMetricsHandler * Move file to tests * Remove unused import * Adapt the fixture to include the projectId * More exporter code fixes * Add the fixture. We are going to use it later * Solved compiler errors. Test almost passes * Address the failing export test * Fixed the exporter. It now writes data properly. * Test should complete when the export doesnt error * Add the fixture to the shared folder * Remove two files not in this PR * delete empty file * Remove files that are already in the other PR * Remove the metrics handler fixture * Use 3 metrics instead of 1 * Replace with proper buckets * Change the metrics handler fixture * Stop using stub in exporter * Use more realistic buckets * Remove the go request to export * Modify the fixtures to be more realistic * Change the mean * Remove only * Add the export input fixture * Reducing export interval makes time complete * Add the GCPMetricsHandler test * Add a stub for the otel export * Test calling export is now working * Remove old unused code * Change tests and json structure to work with metricsCollectorData structure * Update all the fixtures * Fix the view creation code Pass in latency buckets * Starting test for gcp-metrics-handler * Put tests in the proper places * Replace start and end time with more recent values * Utilize the new metrics handler interface * Solve compiler errors resulting from metrics handl * Update the fixture * rewrite the metric to request method * Add interfaces to work with type guards * Correct the compile error problems different metric types are under metrics not scope metrics * Fix expected OTEL output test * Remove TODOs * Fix test to compare pointwise * connectivity error count corrections * Correct the fixtures * Eliminate tests using the old export input fixture * Add headers * run linter * Modify the gcp-metrics-handler and test the proces end to end * Remove only * Use a fake projectId * Only call export once * Ensure test suite completes * Remove shutdown * remove async * Don’t export the data twice * Increase the timeout * Use the PushMetricExporter interface * Removed some interfaces that are not used anymore * Update JSdoc * Move fake start time and fake end time * Remove the TODO * Update documentation * Add additional information to the error reported * Move start time and end time * Try to use timestamps in order * Reduce timestamp delay * Remove only * Inline addFakeRecentTimestamps * Move replace timestamps into the only file it is used * Fix comment * Rename the metric types * Generate documentation for the new classes * Add documentation for monitored resource * Generate documentation for the other metrics * Generate documentation for the constructor * Get documentation for replaceTimestamps, fixtures * Reduce the interval time * Make view list based on latencies * Add a guard for count * Invert the for and if * Pull all attributes out * Eliminate the need for the type guard * Eliminate the data points interface * only * Revert "Eliminate the need for the type guard" This reverts commit 791e70d. * Pull timeseries into one variable Solve the descriptor issue * Eliminate an unused import * Add a comment that explains the usefulness of each metric attribute category * Remove the gce instance setting * Eliminate the gcp cloud provider setting * run all tests * Eliminate duplicate project id from monitored resource * Change the two metric names * Extend the timeout so that the exporter has chance to work * Use spread syntax * Changed metric to otel instruments * Remove optional on Otel instruments * Rename initialize to getMetrics * Pin promisify to version 4 * cast to string - compiler errors * Change the latency buckets Adjust the test fixtures as well to account for the latency bucket change. * Updated the resultCallback comment * Change the test description * Add a comment explaining what the test is about * Completed the test for two metrics handlers * remove only * Cast as histogram to make compile error go away * Move the duplicate copies of replaceTimestamps into one file * Take steps to eliminate the ExportInput interface * Add a header * Remove only * Eliminate ExportInput and dependencies * Eliminate constant * Push conversion to status back to metrics collect Also add if statement for timeseries. * Change property names to match MetricServiceClient expectation * Solve the app_profile_id issue * It is actually app_profile not app_profile_id * Add guards that stop the export call * Remove only * Add a new test for ten metrics handlers * Remove only * Do not pass data through the Resource object anymore * Add a test for writing duplicate points to MH * Eliminate interface * Set connectivity error count to 1 (not increment) * started integration of the application blocking la * Fix tests for an empty set of latencies * Reset operation latencies per operation * Add documentation for new metrics collector method * Change the test fixtures to include application la latencies * Update the fixture for metrics collection output * Fixture adjustments * Adjust the fixtures to work with application latencies * end times still need adjusting * Get the application latencies to appear in the fixtures * Don’t do status: undefined * remove status: undefined * Use the hrtime module instead of the Date module * Do a state check * Make it explicit that it is milliseconds * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * Run linter * Add the nanos to the fixture * Add attributes * Update the fixture with the converted value * Update the hundred calls fixture --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>1 parent 96b5252 commit 967f440
File tree
8 files changed
+454
-130
lines changed- src/client-side-metrics
- test-common
- test/metrics-collector
8 files changed
+454
-130
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
160 | 160 | | |
161 | 161 | | |
162 | 162 | | |
| 163 | + | |
163 | 164 | | |
164 | 165 | | |
165 | 166 | | |
166 | 167 | | |
167 | 168 | | |
168 | 169 | | |
169 | | - | |
170 | 170 | | |
171 | 171 | | |
| 172 | + | |
172 | 173 | | |
173 | 174 | | |
174 | 175 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
236 | 236 | | |
237 | 237 | | |
238 | 238 | | |
239 | | - | |
240 | 239 | | |
241 | 240 | | |
242 | 241 | | |
| |||
245 | 244 | | |
246 | 245 | | |
247 | 246 | | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
248 | 256 | | |
249 | 257 | | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
250 | 264 | | |
251 | | - | |
252 | | - | |
253 | | - | |
254 | | - | |
255 | 265 | | |
256 | 266 | | |
257 | 267 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| 45 | + | |
45 | 46 | | |
46 | 47 | | |
47 | 48 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
| |||
63 | 64 | | |
64 | 65 | | |
65 | 66 | | |
66 | | - | |
67 | | - | |
| 67 | + | |
| 68 | + | |
68 | 69 | | |
69 | 70 | | |
70 | 71 | | |
| |||
76 | 77 | | |
77 | 78 | | |
78 | 79 | | |
| 80 | + | |
| 81 | + | |
79 | 82 | | |
80 | 83 | | |
81 | 84 | | |
| |||
102 | 105 | | |
103 | 106 | | |
104 | 107 | | |
| 108 | + | |
| 109 | + | |
105 | 110 | | |
106 | 111 | | |
107 | 112 | | |
| |||
124 | 129 | | |
125 | 130 | | |
126 | 131 | | |
127 | | - | |
| 132 | + | |
128 | 133 | | |
| 134 | + | |
129 | 135 | | |
130 | 136 | | |
131 | 137 | | |
| |||
148 | 154 | | |
149 | 155 | | |
150 | 156 | | |
151 | | - | |
| 157 | + | |
152 | 158 | | |
153 | | - | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
154 | 162 | | |
155 | 163 | | |
156 | 164 | | |
157 | | - | |
| 165 | + | |
158 | 166 | | |
159 | 167 | | |
160 | 168 | | |
| |||
181 | 189 | | |
182 | 190 | | |
183 | 191 | | |
184 | | - | |
| 192 | + | |
185 | 193 | | |
186 | 194 | | |
187 | 195 | | |
| 196 | + | |
188 | 197 | | |
189 | 198 | | |
190 | 199 | | |
| |||
202 | 211 | | |
203 | 212 | | |
204 | 213 | | |
205 | | - | |
| 214 | + | |
206 | 215 | | |
207 | | - | |
208 | | - | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
209 | 220 | | |
210 | 221 | | |
211 | 222 | | |
| |||
223 | 234 | | |
224 | 235 | | |
225 | 236 | | |
226 | | - | |
| 237 | + | |
227 | 238 | | |
228 | | - | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
229 | 242 | | |
230 | 243 | | |
231 | 244 | | |
| |||
235 | 248 | | |
236 | 249 | | |
237 | 250 | | |
238 | | - | |
| 251 | + | |
239 | 252 | | |
240 | 253 | | |
| 254 | + | |
241 | 255 | | |
242 | 256 | | |
243 | 257 | | |
| |||
281 | 295 | | |
282 | 296 | | |
283 | 297 | | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
284 | 330 | | |
285 | 331 | | |
286 | 332 | | |
| |||
0 commit comments