Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plugin-metrics: fix typos #8560

Merged
merged 1 commit into from
Oct 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

- [scm] show in the commit textbox the branch to which the commit will go [#6156](https://github.com/eclipse-theia/theia/pull/6156)

<a name="breaking_changes_1.7.0">[Breaking Changes:](#breaking_changes_1.7.0)</a>

- [plugin-metrics] renamed `AnalyticsFromRequests.succesfulResponses` to `AnalyticsFromRequests.successfulResponses` []()

## v1.6.0 - 24/09/2020

Expand Down
8 changes: 4 additions & 4 deletions packages/plugin-metrics/src/browser/plugin-metrics-creator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export class PluginMetricsCreator {
* create a metric.
*
* @param pluginID The id of the plugin
* @param errorContents The contents that the langauge server error has produced
* @param errorContents The contents that the language server error has produced
*/
async createErrorMetric(requestData: DataFromRequest): Promise<void> {
if (!requestData.pluginID) {
Expand All @@ -49,7 +49,7 @@ export class PluginMetricsCreator {

const method = this.extractMethodFromValue(requestData.errorContentsOrMethod);

// only log the metric if we can find the method that it occured in
// only log the metric if we can find the method that it occurred in
if (method) {
const createdMetric = createRequestData(requestData.pluginID, method, requestData.timeTaken);
this.createMetric(createdMetric, false);
Expand All @@ -75,7 +75,7 @@ export class PluginMetricsCreator {
const currentAnalytics = thisExtension[method];
if (currentAnalytics) {
currentAnalytics.totalRequests -= 1;
currentAnalytics.succesfulResponses -= 1;
currentAnalytics.successfulResponses -= 1;
}
}
}
Expand Down Expand Up @@ -104,7 +104,7 @@ export class PluginMetricsCreator {
if (currentAnalytic) {
currentAnalytic.totalRequests += 1;
if (isRequestSuccessful) {
currentAnalytic.succesfulResponses += 1;
currentAnalytic.successfulResponses += 1;
}
if (isRequestSuccessful) {
currentAnalytic.sumOfTimeForSuccess = currentAnalytic.sumOfTimeForSuccess + requestData.timeTaken;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { PluginMetricsCreator } from './plugin-metrics-creator';
import { createRequestData } from '../common/plugin-metrics-types';

/**
* This class helps resolve language server requests into successess or failures
* This class helps resolve language server requests into successes or failures
* and sends the data to the metricsExtractor
*/
@injectable()
Expand Down
6 changes: 3 additions & 3 deletions packages/plugin-metrics/src/common/plugin-metrics-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export interface MethodToAnalytics {

export interface AnalyticsFromRequests {
totalRequests: number;
succesfulResponses: number;
successfulResponses: number;
sumOfTimeForSuccess: number;
sumOfTimeForFailure: number;
}
Expand Down Expand Up @@ -66,14 +66,14 @@ export function createDefaultAnalytics(timeTaken: number, isRequestSuccessful: b
return {
sumOfTimeForSuccess: timeTaken,
sumOfTimeForFailure: 0,
succesfulResponses: 0,
successfulResponses: 0,
totalRequests: 0
};
} else {
return {
sumOfTimeForSuccess: 0,
sumOfTimeForFailure: timeTaken,
succesfulResponses: 0,
successfulResponses: 0,
totalRequests: 0
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ export class PluginMetricTimeCount implements MetricOutput {
public header = '# HELP language_server_time_count Number of language server requests\n# TYPE language_server_time_count gauge\n';

createMetricOutput(id: string, method: string, requestAnalytics: AnalyticsFromRequests): string {
if (requestAnalytics.succesfulResponses < 0) {
requestAnalytics.succesfulResponses = 0;
if (requestAnalytics.successfulResponses < 0) {
requestAnalytics.successfulResponses = 0;
}
const successMetric = `language_server_time_count{id="${id}" method="${method}" result="success"} ${requestAnalytics.succesfulResponses}\n`;
const successMetric = `language_server_time_count{id="${id}" method="${method}" result="success"} ${requestAnalytics.successfulResponses}\n`;

const failedRequests = requestAnalytics.totalRequests - requestAnalytics.succesfulResponses;
const failedRequests = requestAnalytics.totalRequests - requestAnalytics.successfulResponses;
const failureMetric = `language_server_time_count{id="${id}" method="${method}" result="fail"} ${failedRequests}\n`;
return successMetric + failureMetric;
}
Expand Down
16 changes: 8 additions & 8 deletions packages/plugin-metrics/src/node/metrics-contributor.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ describe('Metrics contributor:', () => {
const analytics = {
sumOfTimeForFailure: 0,
sumOfTimeForSuccess: 5,
succesfulResponses: 10,
successfulResponses: 10,
totalRequests: 15
} as AnalyticsFromRequests;
const metricExtensionID = 'my_test_metric.test_metric';
Expand Down Expand Up @@ -72,7 +72,7 @@ describe('Metrics contributor:', () => {
const firstClientAnalytics = {
sumOfTimeForFailure: 0,
sumOfTimeForSuccess: 5,
succesfulResponses: 10,
successfulResponses: 10,
totalRequests: 15
} as AnalyticsFromRequests;
const firstClientMetricExtensionID = 'my_test_metric.test_metric';
Expand All @@ -86,7 +86,7 @@ describe('Metrics contributor:', () => {
const secondClientAnalytics = {
sumOfTimeForFailure: 0,
sumOfTimeForSuccess: 15,
succesfulResponses: 20,
successfulResponses: 20,
totalRequests: 18
} as AnalyticsFromRequests;
const secondClientMetricsMap = {
Expand All @@ -110,7 +110,7 @@ describe('Metrics contributor:', () => {
const expectedAnalytics = {
sumOfTimeForFailure: 0,
sumOfTimeForSuccess: 20,
succesfulResponses: 30,
successfulResponses: 30,
totalRequests: 33
} as AnalyticsFromRequests;

Expand All @@ -130,7 +130,7 @@ describe('Metrics contributor:', () => {
const firstClientAnalytics = {
sumOfTimeForFailure: 0,
sumOfTimeForSuccess: 5,
succesfulResponses: 10,
successfulResponses: 10,
totalRequests: 15
} as AnalyticsFromRequests;
const firstClientMetricExtensionID = 'my_test_metric.test_metric';
Expand All @@ -144,7 +144,7 @@ describe('Metrics contributor:', () => {
const secondClientAnalytics = {
sumOfTimeForFailure: 0,
sumOfTimeForSuccess: 15,
succesfulResponses: 20,
successfulResponses: 20,
totalRequests: 18
} as AnalyticsFromRequests;
const secondClientMetricExtensionID = 'my_other_test_metric.test_metric';
Expand Down Expand Up @@ -185,7 +185,7 @@ describe('Metrics contributor:', () => {
const firstClientAnalytics = {
sumOfTimeForFailure: 0,
sumOfTimeForSuccess: 5,
succesfulResponses: 10,
successfulResponses: 10,
totalRequests: 15
} as AnalyticsFromRequests;
const firstClientMetricExtensionID = 'my_test_metric.test_metric';
Expand All @@ -198,7 +198,7 @@ describe('Metrics contributor:', () => {
const secondClientAnalytics = {
sumOfTimeForFailure: 0,
sumOfTimeForSuccess: 15,
succesfulResponses: 20,
successfulResponses: 20,
totalRequests: 18
} as AnalyticsFromRequests;
const secondClientMetricMethod = 'textDocument/myOthertestMethod';
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-metrics/src/node/metrics-contributor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export class PluginMetricsContributor {
newAnalytic.sumOfTimeForSuccess = newAnalytic.sumOfTimeForSuccess + currentAnalytic.sumOfTimeForSuccess;
newAnalytic.sumOfTimeForFailure = newAnalytic.sumOfTimeForFailure + currentAnalytic.sumOfTimeForFailure;
newAnalytic.totalRequests += currentAnalytic.totalRequests;
newAnalytic.succesfulResponses += currentAnalytic.succesfulResponses;
newAnalytic.successfulResponses += currentAnalytic.successfulResponses;

reconciledMap[vscodeExtensionID][method] = newAnalytic;
}
Expand Down