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

Update Statsbeat Network Metric Names #1276

Merged
merged 2 commits into from
Feb 15, 2024
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
12 changes: 6 additions & 6 deletions Declarations/Constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,12 +147,12 @@ export const StatsbeatAttach = {
}

export const StatsbeatCounter = {
REQUEST_SUCCESS: "Request Success Count",
REQUEST_FAILURE: "Request Failure Count",
REQUEST_DURATION: "Request Duration",
RETRY_COUNT: "Retry Count",
THROTTLE_COUNT: "Throttle Count",
EXCEPTION_COUNT: "Exception Count",
REQUEST_SUCCESS: "Request_Success_Count",
REQUEST_FAILURE: "Request_Failure_Count",
REQUEST_DURATION: "Request_Duration",
RETRY_COUNT: "Retry_Count",
THROTTLE_COUNT: "Throttle_Count",
EXCEPTION_COUNT: "Exception_Count",
ATTACH: "Attach",
FEATURE: "Feature"
}
Expand Down
28 changes: 14 additions & 14 deletions Tests/AutoCollection/Statsbeat.tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ describe("AutoCollection/Statsbeat", () => {
statsBeat.setCodelessAttach();
statsBeat.trackShortIntervalStatsbeats().then(() => {
assert.ok(sendStub.called, "should call _sendStatsbeats");
let metric = statsBeat["_statbeatMetrics"].filter(f => f.name === "Request Duration")[0];
let metric = statsBeat["_statbeatMetrics"].filter(f => f.name === "Request_Duration")[0];
assert.ok(metric, "Statsbeat Request not found");
assert.equal(metric.value, 123);
assert.equal((<any>(metric.properties))["attach"], "IntegratedAuto");
Expand All @@ -174,7 +174,7 @@ describe("AutoCollection/Statsbeat", () => {
statsBeat.trackShortIntervalStatsbeats().then((error) => {
assert.ok(sendStub.called, "should call _sendStatsbeats");
assert.equal(statsBeat["_statbeatMetrics"].length, 3);
let metric = statsBeat["_statbeatMetrics"].filter(f => f.name === "Request Duration")[0];
let metric = statsBeat["_statbeatMetrics"].filter(f => f.name === "Request_Duration")[0];
assert.ok(metric, "Request Duration metric not found");
assert.equal(metric.value, 750);
done();
Expand Down Expand Up @@ -202,36 +202,36 @@ describe("AutoCollection/Statsbeat", () => {
statsBeat.trackShortIntervalStatsbeats().then(() => {
assert.ok(sendStub.called, "should call _sendStatsbeats");
assert.equal(statsBeat["_statbeatMetrics"].length, 11);
let metric = statsBeat["_statbeatMetrics"].filter(f => f.name === "Request Success Count")[0];
let metric = statsBeat["_statbeatMetrics"].filter(f => f.name === "Request_Success_Count")[0];
assert.ok(metric, "Request Success Count metric not found");
assert.equal(metric.value, 4);

metric = statsBeat["_statbeatMetrics"].filter(f => f.name === "Request Failure Count")[0];
metric = statsBeat["_statbeatMetrics"].filter(f => f.name === "Request_Failure_Count")[0];
assert.ok(metric, "Request Failure Count metric not found");
assert.equal((<any>(metric.properties))["statusCode"], 500);
assert.equal(metric.value, 2);
let metricCount = statsBeat["_statbeatMetrics"].filter(f => f.name === "Request Failure Count");
let metricCount = statsBeat["_statbeatMetrics"].filter(f => f.name === "Request_Failure_Count");
assert.equal(metricCount.length, 3);

metric = statsBeat["_statbeatMetrics"].filter(f => f.name === "Retry Count")[0];
metric = statsBeat["_statbeatMetrics"].filter(f => f.name === "Retry_Count")[0];
assert.ok(metric, "Retry Count metric not found");
assert.equal((<any>(metric.properties))["statusCode"], 206);
assert.equal(metric.value, 2);
metricCount = statsBeat["_statbeatMetrics"].filter(f => f.name === "Retry Count");
metricCount = statsBeat["_statbeatMetrics"].filter(f => f.name === "Retry_Count");
assert.equal(metricCount.length, 2);

metric = statsBeat["_statbeatMetrics"].filter(f => f.name === "Throttle Count")[0];
metric = statsBeat["_statbeatMetrics"].filter(f => f.name === "Throttle_Count")[0];
assert.ok(metric, "Throttle Count metric not found");
assert.equal((<any>(metric.properties))["statusCode"], 402);
assert.equal(metric.value, 1);
metricCount = statsBeat["_statbeatMetrics"].filter(f => f.name === "Throttle Count");
metricCount = statsBeat["_statbeatMetrics"].filter(f => f.name === "Throttle_Count");
assert.equal(metricCount.length, 2);

metric = statsBeat["_statbeatMetrics"].filter(f => f.name === "Exception Count")[0];
metric = statsBeat["_statbeatMetrics"].filter(f => f.name === "Exception_Count")[0];
assert.ok(metric, "Exception Count metric not found");
assert.equal(metric.value, 1);
assert.equal((<any>(metric.properties))["exceptionType"], "Statsbeat");
metricCount = statsBeat["_statbeatMetrics"].filter(f => f.name === "Exception Count");
metricCount = statsBeat["_statbeatMetrics"].filter(f => f.name === "Exception_Count");
assert.equal(metricCount.length, 2);
done();
}).catch((error) => { done(error); });
Expand Down Expand Up @@ -337,17 +337,17 @@ describe("AutoCollection/Statsbeat", () => {
statsBeat.countRequest(0, "breezeSecondEndpoint", 400, true, 200);
statsBeat.trackShortIntervalStatsbeats().then(() => {
assert.ok(sendStub.called, "should call _sendStatsbeats");
let metric: any = statsBeat["_statbeatMetrics"].find(f => f.name === "Request Duration"
let metric: any = statsBeat["_statbeatMetrics"].find(f => f.name === "Request_Duration"
&& f.value === 100);
assert.ok(metric, "breezeFirstEndpoint metric not found");
assert.equal((<any>(metric.properties))["endpoint"], 0);
assert.equal((<any>(metric.properties))["host"], "breezeFirstEndpoint");
metric = statsBeat["_statbeatMetrics"].find(f => f.name === "Request Duration"
metric = statsBeat["_statbeatMetrics"].find(f => f.name === "Request_Duration"
&& f.value === 200);
assert.ok(metric, "quickpulseEndpoint metric not found");
assert.equal((<any>(metric.properties))["endpoint"], 1);
assert.equal((<any>(metric.properties))["host"], "quickpulseEndpoint");
metric = statsBeat["_statbeatMetrics"].find(f => f.name === "Request Duration"
metric = statsBeat["_statbeatMetrics"].find(f => f.name === "Request_Duration"
&& f.value === 400);
assert.ok(metric, "breezeSecondEndpoint metric not found");
assert.equal((<any>(metric.properties))["endpoint"], 0);
Expand Down
158 changes: 100 additions & 58 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading