@moreapp/common-nodejs 0.10.0 → 0.10.1
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/tracer.js +16 -16
- package/package.json +11 -1
package/dist/tracer.js
CHANGED
|
@@ -17,19 +17,9 @@ const utils_1 = require("./utils");
|
|
|
17
17
|
const tracer = (serviceName, { http = {
|
|
18
18
|
portsToInstrument: [3000],
|
|
19
19
|
}, extraInstrumentations = [], debug = false, }) => {
|
|
20
|
-
(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
new instrumentation_http_1.HttpInstrumentation({
|
|
24
|
-
ignoreIncomingRequestHook: (req) => {
|
|
25
|
-
return !http.portsToInstrument.includes(req.socket.localPort || 0);
|
|
26
|
-
},
|
|
27
|
-
}),
|
|
28
|
-
new instrumentation_express_1.ExpressInstrumentation(),
|
|
29
|
-
new instrumentation_winston_1.WinstonInstrumentation(),
|
|
30
|
-
...(extraInstrumentations || []),
|
|
31
|
-
],
|
|
32
|
-
});
|
|
20
|
+
if (debug) {
|
|
21
|
+
api_1.diag.setLogger(new api_1.DiagConsoleLogger(), api_1.DiagLogLevel.DEBUG);
|
|
22
|
+
}
|
|
33
23
|
const provider = new sdk_trace_node_1.NodeTracerProvider({
|
|
34
24
|
resource: (0, resources_1.resourceFromAttributes)({
|
|
35
25
|
[semantic_conventions_1.SemanticResourceAttributes.SERVICE_NAME]: serviceName,
|
|
@@ -51,8 +41,18 @@ const tracer = (serviceName, { http = {
|
|
|
51
41
|
injectEncoding: propagator_b3_1.B3InjectEncoding.MULTI_HEADER,
|
|
52
42
|
}),
|
|
53
43
|
});
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
44
|
+
(0, instrumentation_1.registerInstrumentations)({
|
|
45
|
+
instrumentations: [
|
|
46
|
+
new instrumentation_dns_1.DnsInstrumentation(),
|
|
47
|
+
new instrumentation_http_1.HttpInstrumentation({
|
|
48
|
+
ignoreIncomingRequestHook: (req) => {
|
|
49
|
+
return !http.portsToInstrument.includes(req.socket.localPort || 0);
|
|
50
|
+
},
|
|
51
|
+
}),
|
|
52
|
+
new instrumentation_express_1.ExpressInstrumentation(),
|
|
53
|
+
new instrumentation_winston_1.WinstonInstrumentation(),
|
|
54
|
+
...(extraInstrumentations || []),
|
|
55
|
+
],
|
|
56
|
+
});
|
|
57
57
|
};
|
|
58
58
|
exports.tracer = tracer;
|
package/package.json
CHANGED
|
@@ -1,9 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moreapp/common-nodejs",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.1",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"require": "./dist/index.js",
|
|
10
|
+
"types": "./dist/index.d.ts"
|
|
11
|
+
},
|
|
12
|
+
"./tracer": {
|
|
13
|
+
"require": "./dist/tracer.js",
|
|
14
|
+
"types": "./dist/tracer.d.ts"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
7
17
|
"scripts": {
|
|
8
18
|
"build": "tsc",
|
|
9
19
|
"test": "jest --detectOpenHandles",
|