Create an entry in _extensionIDAnalytics with createdAnalytic if there does not exist one
data that we will turn into metrics
the analytic being created
Create an entry in _extensionIDAnalytics for requestData.pluginID with requestData.errorContentsOrMethod as the method if there does not exist one
data that we will turn into metrics
the analytic being created
Update the internal metrics structure for pluginID with method when a request is made
The data from the request that was made
If the language server request was successful or not
Decreases the total requests and the successful responses for pluginID with method by 1.
This is needed because an error and a successful language server request aren't currently associated together because of https://github.com/microsoft/vscode-languageserver-node/issues/517. That means that every language server request that resolves counts as a successful language server request. Therefore, we need to decrease the extension requests for pluginID when we know there is an error. Otherwise, for every language server request that errors we would count it as both a success and a failure.
The id of the plugin that should have the decreased requests
Attempts to extract the method name from the current errorContents using the vscode-languageclient matching regex.
If it cannot find a match in the errorContents it returns undefined
The contents of the current error or undefined
setPluginMetrics is a constant running function that sets pluginMetrics every {$METRICS_TIMEOUT} seconds so that it doesn't update /metrics on every request
Create an error metric for requestData.pluginID by attempting to extract the erroring language server method from the requestData.errorContentsOrMethod. If it cannot extract the error language server method from requestData.errorContentsOrMethod then it will not create a metric.