Skip to content

Commit

Permalink
Fixing DTrace probe instantiation such that it happens within start()
Browse files Browse the repository at this point in the history
  • Loading branch information
avoidwork committed Feb 28, 2019
1 parent ea9afb3 commit 2eddc3c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
23 changes: 13 additions & 10 deletions lib/tenso.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,23 +167,14 @@ class Tenso extends Base {
};
this.etags = null;
this.dtrace = this.config.dtrace;
this.dtp = this.dtrace ? dtrace("tenso") : null;
this.dtp = null;
this.probes = new Map();
this.rates = new Map();
this.renderers = renderers;
this.router = null;
this.serializers = serializers;
this.server = null;
this.version = "";

if (this.dtrace) {
this.probes.set("etag", this.dtp.addProbe("etag", "char *", "char *", "char *"));
this.probes.set("headers", this.dtp.addProbe("headers", "char *", "char *", "int", "char *"));
this.probes.set("rate", this.dtp.addProbe("rate", "char *", "char *", "bool", "int", "int", "int", "char *"));
this.probes.set("render", this.dtp.addProbe("render", "char *", "char *", "char *"));
this.probes.set("send", this.dtp.addProbe("send", "char *", "char *", "int", "char *"));
this.dtp.enable();
}
}

all (route, fn) {
Expand Down Expand Up @@ -548,6 +539,18 @@ class Tenso extends Base {
}).on("stream", this.router.route).listen(this.config.port, this.config.host, () => this.drop());
}

this.dtrace = this.config.dtrace;

if (this.dtrace) {
this.dtp = dtrace("tenso");
this.probes.set("etag", this.dtp.addProbe("etag", "char *", "char *", "char *"));
this.probes.set("headers", this.dtp.addProbe("headers", "char *", "char *", "int", "char *"));
this.probes.set("rate", this.dtp.addProbe("rate", "char *", "char *", "bool", "int", "int", "int", "char *"));
this.probes.set("render", this.dtp.addProbe("render", "char *", "char *", "char *"));
this.probes.set("send", this.dtp.addProbe("send", "char *", "char *", "int", "char *"));
this.dtp.enable();
}

this.log(`Started server on port ${this.config.host}:${this.config.port}`, "debug");
}

Expand Down
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,7 +1,7 @@
{
"name": "tenso",
"description": "Tensō is an HTTP/HTTP2 REST API framework",
"version": "10.4.3",
"version": "10.4.4",
"homepage": "http://avoidwork.github.io/tenso",
"author": "Jason Mulligan <[email protected]>",
"repository": {
Expand Down

0 comments on commit 2eddc3c

Please sign in to comment.