Skip to content

Commit

Permalink
fix error tag in tracker
Browse files Browse the repository at this point in the history
  • Loading branch information
Hyperstore committed Mar 26, 2018
1 parent 09e8541 commit e2ffb30
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vulcain-corejs",
"version": "2.0.0-beta951",
"version": "2.0.0-beta952",
"description": "Vulcain micro-service framework",
"main": "lib/src/index.js",
"scripts": {
Expand Down
5 changes: 2 additions & 3 deletions src/instrumentations/span.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ export class Span implements ISpanTracker {

endCommand() {
if (this.action) { // for ignored requests like _servicedependency
this.addTag("error", this.error ? "true" : "false");
this.addTag("error", this.error ? this.error.toString() : "false");
let metricsName = `vulcain_${this.commandType.toLowerCase()}command_duration_ms`;
this.metrics.timing(metricsName, this.durationInMs, this.tags);
}
Expand All @@ -165,8 +165,7 @@ export class Span implements ISpanTracker {
if (!this.error && this.kind === SpanKind.Request && this.context.response && this.context.response.statusCode && this.context.response.statusCode >= 400) {
this.error = new Error("Http error " + this.context.response.statusCode);
}
if(this.error)
this.addTag("error", this.error.toString());
this.addTag("error", this.error ? this.error.toString() : "false");

this.metrics.timing("vulcain_service_duration_ms", this.durationInMs, this.tags);
}
Expand Down

0 comments on commit e2ffb30

Please sign in to comment.