aws-toolkit-vscode
aws-toolkit-vscode copied to clipboard
telemetry: improve query/log interface
followup to https://github.com/aws/aws-toolkit-vscode/pull/2650
Problem
- TelemetryService.findIter() is unstable
- TelemetryLogger never flushes its items, and queries don't have a way to limit searches to time intervals
Proposal
- Eliminate either TelemetryService.findIter() or TelemetryLogger, or both (and add a stable query interface to TelemetryService)
- 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.
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.
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.
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.