When someone disables and then re-enables the global telemetry setting,
the telemetry recorder needs to be recreated in order to allow it to
respond to events again.
Also, write the telemetry log item in the same telemetry processor as
is used to remove unused fields. This ensures there is no race condition
on the order of telemetry processors being run. We always log after
fields are removed.
This commit adds telemetry capturing for command execution. The data
captured explicitly captured and sent to application insights is only
the command id, execution time, and command completion status. We also
capture errors thrown by any command execution, but these are not sent
to application insights.
Telemetry capturing is opt-in. No data will be sent to application
insights unless the user explicitly allows it.
There are two new config settings added. The first controls whether or
not telemetry should be sent. This setting AND the global telemetry setting
must be enabled in order for telemetry to be sent.
The second setting controls whether or not telemetry event data should
be logged to the extension console. The hope here is that users can
inspect exactly what data is sent to the server and can have confidence
that nothing concerning is being leaked.
Note that the global setting for disabling telemetry collection is
handled inside the `vscode-extension-telemetry` package implicitly, so
this extension doesn't touch that setting explicitly.
The `codeql.canary` setting is being used to add an additional flag to
telemetry events. This flag will help us determine if a user in internal
or not.
The application insights key is injected at build time through a
repository secret.
This commit also includes a new `TELEMETRY.md` file that explains what
is being captured, and why.
This commit fixes#733. It does it by ensuring that the query server
emits an event when it restarts the query server. The database manager
listens for this even and properly re-registers its databases.
A few caveats though:
1. Convert query restarts to using a command that includes progress.
This will ensure that errors on restart are logged properly.
2. Because we want to log errors, we cannot use the vscode standard
EventEmitters. They run in the next tick and therefore any errors
will not be associated with this command execution.
3. Update the default cli version to run integration tests against to
2.4.2.
4. Add a new integration test that fails if databases are not
re-registered.
This adds two new jobs to the `Release` workflow. These
jobs are blocked behind an environment. When approved
by a committer, the extension will be deployed to
Open VSX and VS Code marketplace.
Also, update contributing docs for open-vsx publishing.
Also, hide the `CodeQL: Run Queries` command inside of zip folders
since we do not allow queries to be in archives. I wish we could be more
specific about when to show that command, eg- only *.ql files and
directories, but I couldn't find a way to restrict a command to only
appear on directories.
This removes the cached treeItem that is a property of the
completedQuery. We should not be caching them since they are cached by
the vscode api itself. Instead, we should recreate whenever requested.
Also, this change fixes#598 in a new way. Instead of adding the
context to the cached treeItem, we simply refresh only the item that has
changed. This is a fast operation.
This change avoids popping up error messages in two cases:
1. When doing test discovery, do not run discovery on non-existant
directories. Also, if there is an error, print to the log, and do not
pop up an error window. The reason is that test discovery is a
background operation and these should not normally cause pop-ups.
2. When looking for orphaned databases, don't pop up an error if the
storagePath can't be found. This is normal when working in a new,
single root workspace.
* Now query.test.ts runs on multiple cli versions
* Removed most `dispose` calls in cli tests because each test shares the
same instance of the extension and all of its properties. So, we
shouldn't be disposing until the last test completes. It's likely that
we will need to be more careful about cleaning up state between test
runs, but we haven't hit that yet and this can happen in a later
commit.
* Requires that QL_PATH environment variable is set and points to a
checkout of github/codeql
* Adds the `quiet` flag to the cli. When set, this flag will prevent
some modal dialogs from disrupting the flow. Currently, we only ensure
that the upgrades dialog is avoided.
* Update the main.yml workflow to checkout the codeql repo