aws-toolkit-vscode icon indicating copy to clipboard operation
aws-toolkit-vscode copied to clipboard

telemetry: improve query/log interface

Open justinmk3 opened this issue 2 years ago • 3 comments

followup to https://github.com/aws/aws-toolkit-vscode/pull/2650

Problem

  1. TelemetryService.findIter() is unstable
  2. TelemetryLogger never flushes its items, and queries don't have a way to limit searches to time intervals

Proposal

  1. Eliminate either TelemetryService.findIter() or TelemetryLogger, or both (and add a stable query interface to TelemetryService)
  2. add options to the telemetry logger so that components can "mark" a time they are interested in, or just flush (clear) the whole thing (then we don't need the "marker" concept). And/or add a way to query by a time range.

justinmk3 avatar Jun 02 '22 23:06 justinmk3

TelemetryLogger never flushes its items, and queries don't have a way to limit searches to time intervals

This was intentional. Having to think about flushing makes testing more complicated than necessary.

I could see a 'live' query interface being useful for our own internal tooling (e.g. displaying metrics in queue). Still, I would suggest that most code should not use it directly.

JadenSimon avatar Jun 07 '22 18:06 JadenSimon

This was intentional. Having to think about flushing makes testing more complicated than necessary.

The "problem" is addressed by the addition of logger.clear() in globalTestSetup.ts. Or just having clear() available at all. Being able to limit a query to a range might also be useful though.

justinmk3 avatar Jun 07 '22 20:06 justinmk3

I think we're on different wavelengths when talking about 'flushing'. I'm referring to the optimization that telemetry does to send metrics in bulk. How and when the system chooses to make the API call should have no bearing on whether or not a metric was emitted by code.

Clearing the metrics between each test is a very good thing. This was done previously, though it wasn't explicit as we just re-created the logger each time.

JadenSimon avatar Jun 07 '22 20:06 JadenSimon