@fonoster/apiserver 0.32.0 → 0.33.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/telemetryInterceptor.js +13 -12
- package/package.json +12 -12
|
@@ -31,17 +31,13 @@ function createTelemetryInterceptor(telemetry) {
|
|
|
31
31
|
if (!telemetry.enabled)
|
|
32
32
|
return call;
|
|
33
33
|
const method = methodDefinition.path;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
mdNext(metadata);
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
},
|
|
34
|
+
// The span starts here, from the metadata the call already has, not in onReceiveMetadata:
|
|
35
|
+
// a request the auth interceptor refuses gets its status before `start` runs, and would
|
|
36
|
+
// otherwise have no span.
|
|
37
|
+
const metadata = call.metadata;
|
|
38
|
+
const parent = metadata === null || metadata === void 0 ? void 0 : metadata.get(common_1.TRACEPARENT_HEADER)[0];
|
|
39
|
+
const span = telemetry.startSpan("apiserver.grpc", { "rpc.system": "grpc", "rpc.method": method }, typeof parent === "string" ? parent : undefined);
|
|
40
|
+
const wrapped = new grpc_js_1.ServerInterceptingCall(call, {
|
|
45
41
|
sendStatus: (s, next) => {
|
|
46
42
|
var _a;
|
|
47
43
|
const code = (_a = grpc_js_1.status[s.code]) !== null && _a !== void 0 ? _a : String(s.code);
|
|
@@ -49,9 +45,14 @@ function createTelemetryInterceptor(telemetry) {
|
|
|
49
45
|
"rpc.method": method,
|
|
50
46
|
"rpc.grpc.status_code": code
|
|
51
47
|
});
|
|
52
|
-
span
|
|
48
|
+
span.end({ "rpc.grpc.status_code": s.code }, s.code === grpc_js_1.status.OK ? undefined : code);
|
|
53
49
|
next(s);
|
|
54
50
|
}
|
|
55
51
|
});
|
|
52
|
+
// The auth interceptor runs next and reads the request metadata from `call.metadata`, which
|
|
53
|
+
// only the call grpc-js hands the first interceptor has. Without it every request, the
|
|
54
|
+
// health check included, is refused as unauthenticated while telemetry is on.
|
|
55
|
+
wrapped.metadata = metadata;
|
|
56
|
+
return wrapped;
|
|
56
57
|
};
|
|
57
58
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fonoster/apiserver",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.33.0",
|
|
4
4
|
"description": "APIServer for Fonoster",
|
|
5
5
|
"author": "Pedro Sanders <psanders@fonoster.com>",
|
|
6
6
|
"homepage": "https://github.com/fonoster/fonoster#readme",
|
|
@@ -22,18 +22,18 @@
|
|
|
22
22
|
"fonoster-usage": "./dist/bin/usage.js"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@fonoster/authz": "^0.
|
|
26
|
-
"@fonoster/autopilot": "^0.
|
|
27
|
-
"@fonoster/callrecord": "^0.
|
|
28
|
-
"@fonoster/common": "^0.
|
|
29
|
-
"@fonoster/identity": "^0.
|
|
30
|
-
"@fonoster/logger": "^0.
|
|
31
|
-
"@fonoster/sipnet": "^0.
|
|
32
|
-
"@fonoster/types": "^0.
|
|
25
|
+
"@fonoster/authz": "^0.33.0",
|
|
26
|
+
"@fonoster/autopilot": "^0.33.0",
|
|
27
|
+
"@fonoster/callrecord": "^0.33.0",
|
|
28
|
+
"@fonoster/common": "^0.33.0",
|
|
29
|
+
"@fonoster/identity": "^0.33.0",
|
|
30
|
+
"@fonoster/logger": "^0.33.0",
|
|
31
|
+
"@fonoster/sipnet": "^0.33.0",
|
|
32
|
+
"@fonoster/types": "^0.33.0",
|
|
33
33
|
"@grpc/grpc-js": "~1.14.6",
|
|
34
34
|
"@prisma/client": "^6.19.1",
|
|
35
|
-
"@routr/common": "^2.
|
|
36
|
-
"@routr/sdk": "^2.
|
|
35
|
+
"@routr/common": "^2.24.0",
|
|
36
|
+
"@routr/sdk": "^2.24.0",
|
|
37
37
|
"express": "^5.0.1",
|
|
38
38
|
"grpc-health-check": "^2.0.1",
|
|
39
39
|
"jsonwebtoken": "^9.0.2",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"@types/uuid": "^10.0.0",
|
|
67
67
|
"@types/validator": "^13.15.10"
|
|
68
68
|
},
|
|
69
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "ab449441e5e628169680422c66b8cc3474ad9bf9",
|
|
70
70
|
"prisma": {
|
|
71
71
|
"seed": "tsx src/core/seed.ts"
|
|
72
72
|
}
|