securenow 1.0.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/README.md +2 -0
- package/package.json +18 -0
- package/tracing.js +32 -0
package/README.md
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "securenow",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Plug&Secure for nodejs apps",
|
|
5
|
+
"main": "tracing.js",
|
|
6
|
+
"dependencies": {
|
|
7
|
+
"@opentelemetry/sdk-node": "^1.0.0",
|
|
8
|
+
"@opentelemetry/auto-instrumentations-node": "^1.0.0",
|
|
9
|
+
"@opentelemetry/exporter-trace-otlp-http": "^1.0.0",
|
|
10
|
+
"@opentelemetry/resources": "^1.0.0",
|
|
11
|
+
"@opentelemetry/semantic-conventions": "^1.0.0"
|
|
12
|
+
},
|
|
13
|
+
"scripts": {},
|
|
14
|
+
"keywords": [],
|
|
15
|
+
"author": "",
|
|
16
|
+
"license": "ISC"
|
|
17
|
+
}
|
|
18
|
+
|
package/tracing.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// tracing.js
|
|
2
|
+
'use strict'
|
|
3
|
+
const process = require('process');
|
|
4
|
+
const opentelemetry = require('@opentelemetry/sdk-node');
|
|
5
|
+
const { getNodeAutoInstrumentations } = require('@opentelemetry/auto-instrumentations-node');
|
|
6
|
+
const { OTLPTraceExporter } = require('@opentelemetry/exporter-trace-otlp-http');
|
|
7
|
+
const { Resource } = require('@opentelemetry/resources');
|
|
8
|
+
const { SemanticResourceAttributes } = require('@opentelemetry/semantic-conventions');
|
|
9
|
+
|
|
10
|
+
const exporterOptions = {
|
|
11
|
+
url: 'http://65.108.80.206:4318/v1/traces'
|
|
12
|
+
}
|
|
13
|
+
const traceExporter = new OTLPTraceExporter(exporterOptions);
|
|
14
|
+
const sdk = new opentelemetry.NodeSDK({
|
|
15
|
+
traceExporter,
|
|
16
|
+
instrumentations: [getNodeAutoInstrumentations()],
|
|
17
|
+
resource: new Resource({
|
|
18
|
+
[SemanticResourceAttributes.SERVICE_NAME]: 'securenow-free'
|
|
19
|
+
})
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
// initialize the SDK and register with the OpenTelemetry API
|
|
23
|
+
// this enables the API to record telemetry
|
|
24
|
+
sdk.start()
|
|
25
|
+
|
|
26
|
+
// gracefully shut down the SDK on process exit
|
|
27
|
+
process.on('SIGTERM', () => {
|
|
28
|
+
sdk.shutdown()
|
|
29
|
+
.then(() => console.log('Tracing terminated'))
|
|
30
|
+
.catch((error) => console.log('Error terminating tracing', error))
|
|
31
|
+
.finally(() => process.exit(0));
|
|
32
|
+
});
|