securenow 1.0.9 → 2.0.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.
Files changed (2) hide show
  1. package/package.json +12 -3
  2. package/tracing.js +69 -12
package/package.json CHANGED
@@ -1,17 +1,26 @@
1
1
  {
2
2
  "name": "securenow",
3
- "version": "1.0.9",
3
+ "version": "2.0.1",
4
4
  "description": "Plug&Secure for nodejs apps",
5
5
  "main": "tracing.js",
6
6
  "dependencies": {
7
7
  "@opentelemetry/auto-instrumentations-node": "^0.40.3",
8
8
  "@opentelemetry/exporter-trace-otlp-http": "^0.47.0",
9
9
  "@opentelemetry/instrumentation-express": "^0.38.0",
10
+ "@opentelemetry/instrumentation-fastify": "^0.44.2",
11
+ "@opentelemetry/instrumentation-graphql": "^0.47.1",
12
+ "@opentelemetry/instrumentation-hapi": "^0.45.2",
10
13
  "@opentelemetry/instrumentation-http": "^0.51.1",
14
+ "@opentelemetry/instrumentation-koa": "^0.47.1",
11
15
  "@opentelemetry/instrumentation-mongodb": "^0.43.0",
12
- "@opentelemetry/resources": "^1.0.0",
16
+ "@opentelemetry/instrumentation-mysql": "^0.45.1",
17
+ "@opentelemetry/instrumentation-mysql2": "^0.45.2",
18
+ "@opentelemetry/instrumentation-nestjs-core": "^0.44.1",
19
+ "@opentelemetry/instrumentation-pg": "^0.51.1",
20
+ "@opentelemetry/instrumentation-redis": "^0.46.1",
21
+ "@opentelemetry/resources": "^1.30.1",
13
22
  "@opentelemetry/sdk-node": "^0.47.0",
14
- "@opentelemetry/semantic-conventions": "^1.0.0",
23
+ "@opentelemetry/semantic-conventions": "^1.30.0",
15
24
  "uuid": "^9.0.1"
16
25
  },
17
26
  "scripts": {},
package/tracing.js CHANGED
@@ -5,6 +5,7 @@ const process = require('process');
5
5
  const opentelemetry = require('@opentelemetry/sdk-node');
6
6
  const { OTLPTraceExporter } = require('@opentelemetry/exporter-trace-otlp-http');
7
7
  //instrumentations
8
+ const { getNodeAutoInstrumentations } = require('@opentelemetry/auto-instrumentations-node');
8
9
  const { ExpressInstrumentation } = require("@opentelemetry/instrumentation-express");
9
10
  const { MongoDBInstrumentation } = require("@opentelemetry/instrumentation-mongodb");
10
11
  const { HttpInstrumentation } = require("@opentelemetry/instrumentation-http");
@@ -13,7 +14,7 @@ const { v4: uuidv4 } = require('uuid');
13
14
  const { Resource } = require('@opentelemetry/resources');
14
15
  const { SemanticResourceAttributes } = require('@opentelemetry/semantic-conventions');
15
16
 
16
- const securenow_instance = process.env.securenow_instance|| 'http://65.108.80.206:4318';
17
+ const securenow_instance = process.env.securenow_instance|| 'http://37.27.39.173:4318';
17
18
  const exporterOptions = {
18
19
  url: securenow_instance+'/v1/traces'
19
20
  }
@@ -21,20 +22,76 @@ const exporterOptions = {
21
22
  const traceExporter = new OTLPTraceExporter(exporterOptions);
22
23
  const sdk = new opentelemetry.NodeSDK({
23
24
  traceExporter,
24
- instrumentations: [new ExpressInstrumentation(), new MongoDBInstrumentation(), new HttpInstrumentation()],
25
+ instrumentations: [
26
+ // Auto-instrument many Node.js libraries and frameworks
27
+ getNodeAutoInstrumentations({
28
+ // You can customize specific instrumentations if needed
29
+ '@opentelemetry/instrumentation-fs': {
30
+ enabled: true,
31
+ },
32
+ '@opentelemetry/instrumentation-dns': {
33
+ enabled: true,
34
+ },
35
+ '@opentelemetry/instrumentation-net': {
36
+ enabled: true,
37
+ },
38
+ // Next.js support through auto-instrumentation
39
+ '@opentelemetry/instrumentation-http': {
40
+ enabled: true,
41
+ },
42
+ '@opentelemetry/instrumentation-express': {
43
+ enabled: true,
44
+ },
45
+ '@opentelemetry/instrumentation-graphql': {
46
+ enabled: true,
47
+ },
48
+ '@opentelemetry/instrumentation-mongodb': {
49
+ enabled: true,
50
+ },
51
+ // Add more framework instrumentations
52
+ '@opentelemetry/instrumentation-koa': {
53
+ enabled: true,
54
+ },
55
+ '@opentelemetry/instrumentation-redis': {
56
+ enabled: true,
57
+ },
58
+ '@opentelemetry/instrumentation-pg': {
59
+ enabled: true,
60
+ },
61
+ '@opentelemetry/instrumentation-mysql': {
62
+ enabled: true,
63
+ },
64
+ '@opentelemetry/instrumentation-mysql2': {
65
+ enabled: true,
66
+ },
67
+ '@opentelemetry/instrumentation-nestjs-core': {
68
+ enabled: true,
69
+ },
70
+ '@opentelemetry/instrumentation-fastify': {
71
+ enabled: true,
72
+ },
73
+ '@opentelemetry/instrumentation-hapi': {
74
+ enabled: true,
75
+ },
76
+ }),
77
+ // Add specific instrumentations that might not be covered by auto-instrumentation
78
+ new ExpressInstrumentation(),
79
+ new MongoDBInstrumentation(),
80
+ new HttpInstrumentation(),
81
+ ],
25
82
  resource: new Resource({
26
83
  [SemanticResourceAttributes.SERVICE_NAME]: process.env.securenow || 'securenow-free-'+uuidv4()
27
84
  })
28
85
  });
29
86
 
30
- // initialize the SDK and register with the OpenTelemetry API
31
- // this enables the API to record telemetry
32
- sdk.start()
87
+ // initialize the SDK and register with the OpenTelemetry API
88
+ // this enables the API to record telemetry
89
+ sdk.start()
33
90
 
34
- // gracefully shut down the SDK on process exit
35
- process.on('SIGTERM', () => {
36
- sdk.shutdown()
37
- .then(() => console.log('Tracing terminated'))
38
- .catch((error) => console.log('Error terminating tracing', error))
39
- .finally(() => process.exit(0));
40
- });
91
+ // gracefully shut down the SDK on process exit
92
+ process.on('SIGTERM', () => {
93
+ sdk.shutdown()
94
+ .then(() => console.log('Tracing terminated'))
95
+ .catch((error) => console.log('Error terminating tracing', error))
96
+ .finally(() => process.exit(0));
97
+ });