@nimee/initialize-ms 1.0.52 → 1.0.53
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.
|
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const { NodeSDK } = require("@opentelemetry/sdk-node"); // Add this line
|
|
7
7
|
const { AlwaysOnSampler } = require("@opentelemetry/sdk-trace-base");
|
|
8
|
+
const instrumentation_aws_sdk_1 = require("@opentelemetry/instrumentation-aws-sdk");
|
|
8
9
|
// const { diag, DiagConsoleLogger, DiagLogLevel } = require("@opentelemetry/api");
|
|
9
10
|
const opentelemetry_1 = require("@coralogix/opentelemetry");
|
|
10
11
|
const { Resource } = require("@opentelemetry/resources");
|
|
@@ -29,6 +30,19 @@ class TracerCoralogix {
|
|
|
29
30
|
return false;
|
|
30
31
|
},
|
|
31
32
|
});
|
|
33
|
+
const fastifyInstrumentation = new FastifyInstrumentation({
|
|
34
|
+
onRequest: (span, request) => {
|
|
35
|
+
if (request.body) {
|
|
36
|
+
span.setAttribute("http.request.body", JSON.stringify(request.body));
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
onResponse: (span, reply) => {
|
|
40
|
+
span.setAttribute("http.response.body", reply.raw ? reply.raw.toString() : "");
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
const awsInstrumentation = new instrumentation_aws_sdk_1.AwsInstrumentation({
|
|
44
|
+
suppressInternalInstrumentation: true,
|
|
45
|
+
});
|
|
32
46
|
// Now we"ll initialize the OTEL sdk:
|
|
33
47
|
const sdk = new NodeSDK({
|
|
34
48
|
// // Optional resource configuration section
|
|
@@ -43,7 +57,7 @@ class TracerCoralogix {
|
|
|
43
57
|
}),
|
|
44
58
|
}),
|
|
45
59
|
sampler: new opentelemetry_1.CoralogixTransactionSampler(new AlwaysOnSampler()),
|
|
46
|
-
instrumentations: [httpInstrumentation, new
|
|
60
|
+
instrumentations: [httpInstrumentation, fastifyInstrumentation, awsInstrumentation, new getNodeAutoInstrumentations()],
|
|
47
61
|
});
|
|
48
62
|
sdk.start();
|
|
49
63
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tracerCoralogix.js","sourceRoot":"","sources":["../../src/tracerCoralogix.ts"],"names":[],"mappings":";;;;;AAAA,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAAC,CAAC,gBAAgB;AACxE,MAAM,EAAE,eAAe,EAAE,GAAG,OAAO,CAAC,+BAA+B,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"tracerCoralogix.js","sourceRoot":"","sources":["../../src/tracerCoralogix.ts"],"names":[],"mappings":";;;;;AAAA,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAAC,CAAC,gBAAgB;AACxE,MAAM,EAAE,eAAe,EAAE,GAAG,OAAO,CAAC,+BAA+B,CAAC,CAAC;AAGrE,oFAA4E;AAE5E,mFAAmF;AACnF,4DAAuE;AACvE,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAAC;AACzD,MAAM,EAAE,0BAA0B,EAAE,GAAG,OAAO,CAAC,qCAAqC,CAAC,CAAC;AACtF,MAAM,EAAE,2BAA2B,EAAE,GAAG,OAAO,CAAC,2CAA2C,CAAC,CAAC;AAE7F,+CAA+C;AAC/C,MAAM,EAAE,kBAAkB,EAAE,GAAG,OAAO,CAAC,4CAA4C,CAAC,CAAC;AACrF,MAAM,EAAE,6BAA6B,EAAE,GAAG,OAAO,CAAC,4BAA4B,CAAC,CAAC;AAChF,MAAM,EAAE,mBAAmB,EAAE,GAAG,OAAO,CAAC,qCAAqC,CAAC,CAAC;AAC/E,MAAM,EAAE,sBAAsB,EAAE,GAAG,OAAO,CAAC,wCAAwC,CAAC,CAAC;AAErF,2DAAmC;AACnC,MAAqB,eAA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IAAI,QAAQ,CAAC;oBACrB,CAAC,0BAA0B,CAAC,YAAY,CAAC,EAAE,WAAW;oBACtD,CAAC,0BAA0B,CAAC,eAAe,CAAC,EAAE,KAAK;iBACpD,CAAC;gBACF,yCAAyC;gBACzC,YAAY,EAAE,IAAI,6BAA6B,CAAC;oBAC9C,QAAQ,EAAE,IAAI,kBAAkB,CAAC;wBAC/B,gBAAgB,EAAE,CAAC;qBACpB,CAAC;iBACH,CAAC;gBACF,OAAO,EAAE,IAAI,2CAA2B,CAAC,IAAI,eAAe,EAAE,CAAC;gBAC/D,gBAAgB,EAAE,CAAC,mBAAmB,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,IAAI,2BAA2B,EAAE,CAAC;aACvH,CAAC,CAAC;YAEH,GAAG,CAAC,KAAK,EAAE,CAAC;QACd,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,gBAAM,CAAC,KAAK,CAAC,sCAAsC,KAAK,EAAE,CAAC,CAAC;QAC9D,CAAC;IACH,CAAC;CACF;AAhDD,kCAgDC"}
|
package/package.json
CHANGED
package/src/tracerCoralogix.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
const { NodeSDK } = require("@opentelemetry/sdk-node"); // Add this line
|
|
2
2
|
const { AlwaysOnSampler } = require("@opentelemetry/sdk-trace-base");
|
|
3
|
+
import { Span, Context } from "@opentelemetry/api";
|
|
4
|
+
import { FastifyRequest, FastifyReply } from "fastify";
|
|
5
|
+
import { AwsInstrumentation } from "@opentelemetry/instrumentation-aws-sdk";
|
|
3
6
|
|
|
4
7
|
// const { diag, DiagConsoleLogger, DiagLogLevel } = require("@opentelemetry/api");
|
|
5
8
|
import { CoralogixTransactionSampler } from "@coralogix/opentelemetry";
|
|
@@ -27,6 +30,19 @@ export default class TracerCoralogix {
|
|
|
27
30
|
return false;
|
|
28
31
|
},
|
|
29
32
|
});
|
|
33
|
+
const fastifyInstrumentation = new FastifyInstrumentation({
|
|
34
|
+
onRequest: (span: Span, request: FastifyRequest) => {
|
|
35
|
+
if (request.body) {
|
|
36
|
+
span.setAttribute("http.request.body", JSON.stringify(request.body));
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
onResponse: (span: Span, reply: FastifyReply) => {
|
|
40
|
+
span.setAttribute("http.response.body", reply.raw ? reply.raw.toString() : "");
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
const awsInstrumentation = new AwsInstrumentation({
|
|
44
|
+
suppressInternalInstrumentation: true,
|
|
45
|
+
});
|
|
30
46
|
// Now we"ll initialize the OTEL sdk:
|
|
31
47
|
const sdk = new NodeSDK({
|
|
32
48
|
// // Optional resource configuration section
|
|
@@ -41,7 +57,7 @@ export default class TracerCoralogix {
|
|
|
41
57
|
}),
|
|
42
58
|
}),
|
|
43
59
|
sampler: new CoralogixTransactionSampler(new AlwaysOnSampler()),
|
|
44
|
-
instrumentations: [httpInstrumentation, new
|
|
60
|
+
instrumentations: [httpInstrumentation, fastifyInstrumentation, awsInstrumentation, new getNodeAutoInstrumentations()],
|
|
45
61
|
});
|
|
46
62
|
|
|
47
63
|
sdk.start();
|