@multiplayer-app/session-recorder-node 1.3.37 → 2.0.17-alpha.9
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/package.json +3 -3
- package/examples/cli/dist/config.d.ts +0 -16
- package/examples/cli/dist/config.d.ts.map +0 -1
- package/examples/cli/dist/config.js +0 -42
- package/examples/cli/dist/config.js.map +0 -1
- package/examples/cli/dist/index.d.ts +0 -2
- package/examples/cli/dist/index.d.ts.map +0 -1
- package/examples/cli/dist/index.js +0 -29
- package/examples/cli/dist/index.js.map +0 -1
- package/examples/cli/dist/opentelemetry.d.ts +0 -2
- package/examples/cli/dist/opentelemetry.d.ts.map +0 -1
- package/examples/cli/dist/opentelemetry.js +0 -135
- package/examples/cli/dist/opentelemetry.js.map +0 -1
- package/examples/http-server/dist/api.d.ts +0 -3
- package/examples/http-server/dist/api.d.ts.map +0 -1
- package/examples/http-server/dist/api.js +0 -19
- package/examples/http-server/dist/api.js.map +0 -1
- package/examples/http-server/dist/config.d.ts +0 -13
- package/examples/http-server/dist/config.d.ts.map +0 -1
- package/examples/http-server/dist/config.js +0 -22
- package/examples/http-server/dist/config.js.map +0 -1
- package/examples/http-server/dist/index.d.ts +0 -3
- package/examples/http-server/dist/index.d.ts.map +0 -1
- package/examples/http-server/dist/index.js +0 -40
- package/examples/http-server/dist/index.js.map +0 -1
- package/examples/http-server/dist/opentelemetry.d.ts +0 -2
- package/examples/http-server/dist/opentelemetry.d.ts.map +0 -1
- package/examples/http-server/dist/opentelemetry.js +0 -135
- package/examples/http-server/dist/opentelemetry.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@multiplayer-app/session-recorder-node",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.17-alpha.9",
|
|
4
4
|
"description": "Multiplayer Fullstack Session Recorder for Node.js",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Multiplayer Software, Inc.",
|
|
@@ -29,14 +29,14 @@
|
|
|
29
29
|
"fullstack session recorder"
|
|
30
30
|
],
|
|
31
31
|
"scripts": {
|
|
32
|
-
"lint": "eslint src/**/*.ts --config eslint.config.js",
|
|
32
|
+
"lint": "eslint 'src/**/*.ts' --config eslint.config.js",
|
|
33
33
|
"preversion": "npm run lint",
|
|
34
34
|
"postversion:skip": "git push && git push --tags",
|
|
35
35
|
"build": "rm -rf dist tsconfig.tsbuildinfo && tsc --build tsconfig.json",
|
|
36
36
|
"prepublishOnly": "npm run build"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@multiplayer-app/session-recorder-common": "
|
|
39
|
+
"@multiplayer-app/session-recorder-common": "2.0.17-alpha.9",
|
|
40
40
|
"@opentelemetry/api": "^1.9.0",
|
|
41
41
|
"@opentelemetry/core": "^2.0.1",
|
|
42
42
|
"@opentelemetry/otlp-exporter-base": "^0.203.0",
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export declare const NODE_ENV: string;
|
|
2
|
-
export declare const isProduction: boolean;
|
|
3
|
-
export declare const LOG_LEVEL: string;
|
|
4
|
-
export declare const COMPONENT_NAME: string;
|
|
5
|
-
export declare const COMPONENT_VERSION: string;
|
|
6
|
-
export declare const ENVIRONMENT: string;
|
|
7
|
-
export declare const MULTIPLAYER_OTLP_KEY: string;
|
|
8
|
-
export declare const OTLP_TRACES_ENDPOINT: string;
|
|
9
|
-
export declare const OTLP_LOGS_ENDPOINT: string;
|
|
10
|
-
export declare const MULTIPLAYER_OTLP_SPAN_RATIO: number;
|
|
11
|
-
export declare let DIALOGUE_HUB_SERVICE_URL: string;
|
|
12
|
-
export declare let EPOCH_ENGINE_SERVICE_URL: string;
|
|
13
|
-
export declare let MINDS_OF_TIME_SERVICE_URL: string;
|
|
14
|
-
export declare let VAULT_OF_TIME_SERVICE_URL: string;
|
|
15
|
-
export declare const MULTIPLAYER_BACKEND_SOURCE: string;
|
|
16
|
-
//# sourceMappingURL=config.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,QAAQ,QAAwC,CAAA;AAC7D,eAAO,MAAM,YAAY,SAA4B,CAAA;AAErD,eAAO,MAAM,SAAS,QAA6D,CAAA;AAEnF,eAAO,MAAM,cAAc,QAAqG,CAAA;AAChI,eAAO,MAAM,iBAAiB,QAA6C,CAAA;AAC3E,eAAO,MAAM,WAAW,QAAuC,CAAA;AAE/D,eAAO,MAAM,oBAAoB,EAAuC,MAAM,CAAA;AAM9E,eAAO,MAAM,oBAAoB,QAA8E,CAAA;AAC/G,eAAO,MAAM,kBAAkB,QAA0E,CAAA;AAEzG,eAAO,MAAM,2BAA2B,QAEhC,CAAA;AAER,eAAO,IAAI,wBAAwB,QAAK,CAAA;AACxC,eAAO,IAAI,wBAAwB,QAAK,CAAA;AACxC,eAAO,IAAI,yBAAyB,QAAK,CAAA;AACzC,eAAO,IAAI,yBAAyB,QAAK,CAAA;AAEzC,eAAO,MAAM,0BAA0B,QAAyD,CAAA"}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var _a;
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.MULTIPLAYER_BACKEND_SOURCE = exports.VAULT_OF_TIME_SERVICE_URL = exports.MINDS_OF_TIME_SERVICE_URL = exports.EPOCH_ENGINE_SERVICE_URL = exports.DIALOGUE_HUB_SERVICE_URL = exports.MULTIPLAYER_OTLP_SPAN_RATIO = exports.OTLP_LOGS_ENDPOINT = exports.OTLP_TRACES_ENDPOINT = exports.MULTIPLAYER_OTLP_KEY = exports.ENVIRONMENT = exports.COMPONENT_VERSION = exports.COMPONENT_NAME = exports.LOG_LEVEL = exports.isProduction = exports.NODE_ENV = void 0;
|
|
5
|
-
exports.NODE_ENV = process.env.NODE_ENV || 'development';
|
|
6
|
-
exports.isProduction = exports.NODE_ENV === 'production';
|
|
7
|
-
exports.LOG_LEVEL = process.env.LOG_LEVEL || (exports.isProduction ? 'info' : 'debug');
|
|
8
|
-
exports.COMPONENT_NAME = ((_a = process.env.npm_package_name) === null || _a === void 0 ? void 0 : _a.split('/').pop()) || process.env.SERVICE_NAME || 'timegate';
|
|
9
|
-
exports.COMPONENT_VERSION = process.env.npm_package_version || '0.0.1';
|
|
10
|
-
exports.ENVIRONMENT = process.env.ENVIRONMENT || 'staging';
|
|
11
|
-
exports.MULTIPLAYER_OTLP_KEY = process.env.MULTIPLAYER_OTLP_KEY;
|
|
12
|
-
if (!exports.MULTIPLAYER_OTLP_KEY) {
|
|
13
|
-
throw new Error('MULTIPLAYER_OTLP_KEY is not set');
|
|
14
|
-
}
|
|
15
|
-
exports.OTLP_TRACES_ENDPOINT = process.env.OTLP_TRACES_ENDPOINT || 'https://api.multiplayer.app/v1/traces';
|
|
16
|
-
exports.OTLP_LOGS_ENDPOINT = process.env.OTLP_LOGS_ENDPOINT || 'https://api.multiplayer.app/v1/logs';
|
|
17
|
-
exports.MULTIPLAYER_OTLP_SPAN_RATIO = process.env.MULTIPLAYER_OTLP_SPAN_RATIO
|
|
18
|
-
? Number(process.env.MULTIPLAYER_OTLP_SPAN_RATIO)
|
|
19
|
-
: 0.01;
|
|
20
|
-
exports.DIALOGUE_HUB_SERVICE_URL = '';
|
|
21
|
-
exports.EPOCH_ENGINE_SERVICE_URL = '';
|
|
22
|
-
exports.MINDS_OF_TIME_SERVICE_URL = '';
|
|
23
|
-
exports.VAULT_OF_TIME_SERVICE_URL = '';
|
|
24
|
-
exports.MULTIPLAYER_BACKEND_SOURCE = process.env.MULTIPLAYER_BACKEND_SOURCE || 'production';
|
|
25
|
-
switch (process.env.MULTIPLAYER_BACKEND_SOURCE) {
|
|
26
|
-
case 'production':
|
|
27
|
-
exports.DIALOGUE_HUB_SERVICE_URL = 'https://api.demo.multiplayer.app/v1/dialogue-hub';
|
|
28
|
-
exports.EPOCH_ENGINE_SERVICE_URL = 'https://api.demo.multiplayer.app/v1/epoch-engine';
|
|
29
|
-
exports.MINDS_OF_TIME_SERVICE_URL = 'https://api.demo.multiplayer.app/v1/minds-of-time';
|
|
30
|
-
exports.VAULT_OF_TIME_SERVICE_URL = 'https://api.demo.multiplayer.app/v1/vault-of-time';
|
|
31
|
-
break;
|
|
32
|
-
default:
|
|
33
|
-
exports.DIALOGUE_HUB_SERVICE_URL = 'http://localhost:3000/v1/dialogue-hub';
|
|
34
|
-
exports.EPOCH_ENGINE_SERVICE_URL = 'http://localhost:3000/v1/epoch-engine';
|
|
35
|
-
exports.MINDS_OF_TIME_SERVICE_URL = 'http://localhost:3000/v1/minds-of-time';
|
|
36
|
-
exports.VAULT_OF_TIME_SERVICE_URL = 'http://localhost:3000/v1/vault-of-time';
|
|
37
|
-
}
|
|
38
|
-
exports.DIALOGUE_HUB_SERVICE_URL = process.env.DIALOGUE_HUB_SERVICE_URL || exports.DIALOGUE_HUB_SERVICE_URL;
|
|
39
|
-
exports.EPOCH_ENGINE_SERVICE_URL = process.env.EPOCH_ENGINE_SERVICE_URL || exports.EPOCH_ENGINE_SERVICE_URL;
|
|
40
|
-
exports.MINDS_OF_TIME_SERVICE_URL = process.env.MINDS_OF_TIME_SERVICE_URL || exports.MINDS_OF_TIME_SERVICE_URL;
|
|
41
|
-
exports.VAULT_OF_TIME_SERVICE_URL = process.env.VAULT_OF_TIME_SERVICE_URL || exports.VAULT_OF_TIME_SERVICE_URL;
|
|
42
|
-
//# sourceMappingURL=config.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":";;;;AAAa,QAAA,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,aAAa,CAAA;AAChD,QAAA,YAAY,GAAG,gBAAQ,KAAK,YAAY,CAAA;AAExC,QAAA,SAAS,GAAG,OAAO,CAAC,GAAG,CAA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,CAAA;QAC7E,gCAAwB,GAAG,kDAAkD,CAAA;QAC7E,iCAAyB,GAAG,mDAAmD,CAAA;QAC/E,iCAAyB,GAAG,mDAAmD,CAAA;QAC/E,MAAK;IACP;QACE,gCAAwB,GAAG,uCAAuC,CAAA;QAClE,gCAAwB,GAAG,uCAAuC,CAAA;QAClE,iCAAyB,GAAG,wCAAwC,CAAA;QACpE,iCAAyB,GAAG,wCAAwC,CAAA;AACxE,CAAC;AAED,gCAAwB,GAAG,OAAO,CAAC,GAAG,CAAC,wBAAwB,IAAI,gCAAwB,CAAA;AAC3F,gCAAwB,GAAG,OAAO,CAAC,GAAG,CAAC,wBAAwB,IAAI,gCAAwB,CAAA;AAC3F,iCAAyB,GAAG,OAAO,CAAC,GAAG,CAAC,yBAAyB,IAAI,iCAAyB,CAAA;AAC9F,iCAAyB,GAAG,OAAO,CAAC,GAAG,CAAC,yBAAyB,IAAI,iCAAyB,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const opentelemetry_1 = require("./opentelemetry");
|
|
4
|
-
const session_recorder_node_1 = require("@multiplayer-app/session-recorder-node");
|
|
5
|
-
const config_1 = require("./config");
|
|
6
|
-
const main = async () => {
|
|
7
|
-
session_recorder_node_1.sessionRecorder.init({
|
|
8
|
-
apiKey: config_1.MULTIPLAYER_OTLP_KEY,
|
|
9
|
-
traceIdGenerator: opentelemetry_1.idGenerator,
|
|
10
|
-
resourceAttributes: {
|
|
11
|
-
componentName: config_1.COMPONENT_NAME,
|
|
12
|
-
componentVersion: config_1.COMPONENT_VERSION,
|
|
13
|
-
environment: config_1.ENVIRONMENT,
|
|
14
|
-
},
|
|
15
|
-
});
|
|
16
|
-
await session_recorder_node_1.sessionRecorder.start(session_recorder_node_1.SessionType.MANUAL, {
|
|
17
|
-
name: 'Test nodejs cli app debug session',
|
|
18
|
-
resourceAttributes: {
|
|
19
|
-
version: 1,
|
|
20
|
-
},
|
|
21
|
-
});
|
|
22
|
-
// do something here
|
|
23
|
-
await session_recorder_node_1.sessionRecorder.stop();
|
|
24
|
-
setTimeout(() => {
|
|
25
|
-
process.exit(0);
|
|
26
|
-
}, 15000);
|
|
27
|
-
};
|
|
28
|
-
main();
|
|
29
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AAAA,mDAA6C;AAC7C,kFAG+C;AAC/C,qCAKiB;AAEjB,MAAM,IAAI,GAAG,KAAK,IAAI,EAAE;IACtB,uCAAe,CAAC,IAAI,CAAC;QACnB,MAAM,EAAE,6BAAoB;QAC5B,gBAAgB,EAAE,2BAAW;QAC7B,kBAAkB,EAAE;YAClB,aAAa,EAAE,uBAAc;YAC7B,gBAAgB,EAAE,0BAAiB;YACnC,WAAW,EAAE,oBAAW;SACzB;KACF,CAAC,CAAA;IAEF,MAAM,uCAAe,CAAC,KAAK,CACzB,mCAAW,CAAC,MAAM,EAClB;QACE,IAAI,EAAE,mCAAmC;QACzC,kBAAkB,EAAE;YAClB,OAAO,EAAE,CAAC;SACX;KACF,CACF,CAAA;IAED,oBAAoB;IAEpB,MAAM,uCAAe,CAAC,IAAI,EAAE,CAAA;IAE5B,UAAU,CAAC,GAAG,EAAE;QACd,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACjB,CAAC,EAAE,KAAK,CAAC,CAAA;AACX,CAAC,CAAA;AAED,IAAI,EAAE,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"opentelemetry.d.ts","sourceRoot":"","sources":["../src/opentelemetry.ts"],"names":[],"mappings":"AAkFA,eAAO,MAAM,WAAW,KAAmC,CAAA"}
|
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
-
};
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.idGenerator = void 0;
|
|
40
|
-
const os_1 = require("os");
|
|
41
|
-
const sdk_node_1 = require("@opentelemetry/sdk-node");
|
|
42
|
-
const sdk_trace_base_1 = require("@opentelemetry/sdk-trace-base");
|
|
43
|
-
const auto_instrumentations_node_1 = require("@opentelemetry/auto-instrumentations-node");
|
|
44
|
-
const resources_1 = require("@opentelemetry/resources");
|
|
45
|
-
const semantic_conventions_1 = require("@opentelemetry/semantic-conventions");
|
|
46
|
-
const api_1 = __importDefault(require("@opentelemetry/api"));
|
|
47
|
-
// import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-http"
|
|
48
|
-
const core_1 = require("@opentelemetry/core");
|
|
49
|
-
const session_recorder_node_1 = require("@multiplayer-app/session-recorder-node");
|
|
50
|
-
const sdk_logs_1 = require("@opentelemetry/sdk-logs");
|
|
51
|
-
const apiLogs = __importStar(require("@opentelemetry/api-logs"));
|
|
52
|
-
// import { OTLPLogExporter } from '@opentelemetry/exporter-logs-otlp-http'
|
|
53
|
-
const config_1 = require("./config");
|
|
54
|
-
// NOTE: Update instrumentation configuration as needed
|
|
55
|
-
// For more see: https://www.npmjs.com/package/@opentelemetry/auto-instrumentations-node
|
|
56
|
-
const instrumentations = [
|
|
57
|
-
(0, auto_instrumentations_node_1.getNodeAutoInstrumentations)({
|
|
58
|
-
'@opentelemetry/instrumentation-http': {
|
|
59
|
-
requestHook: session_recorder_node_1.SessionRecorderHttpInstrumentationHooksNode.requestHook({
|
|
60
|
-
maskHeadersList: ['X-Api-Key'],
|
|
61
|
-
maxPayloadSizeBytes: 5000,
|
|
62
|
-
schemifyDocSpanPayload: false,
|
|
63
|
-
isMaskBodyEnabled: false,
|
|
64
|
-
}),
|
|
65
|
-
responseHook: session_recorder_node_1.SessionRecorderHttpInstrumentationHooksNode.responseHook({
|
|
66
|
-
maskHeadersList: ['X-Api-Key'],
|
|
67
|
-
maxPayloadSizeBytes: 5000,
|
|
68
|
-
schemifyDocSpanPayload: false,
|
|
69
|
-
isMaskBodyEnabled: false,
|
|
70
|
-
}),
|
|
71
|
-
},
|
|
72
|
-
}),
|
|
73
|
-
];
|
|
74
|
-
const getResource = () => {
|
|
75
|
-
const resourceWithAttributes = (0, resources_1.resourceFromAttributes)({
|
|
76
|
-
[semantic_conventions_1.ATTR_SERVICE_NAME]: config_1.COMPONENT_NAME,
|
|
77
|
-
[semantic_conventions_1.ATTR_SERVICE_VERSION]: config_1.COMPONENT_VERSION,
|
|
78
|
-
[semantic_conventions_1.SEMRESATTRS_HOST_NAME]: (0, os_1.hostname)(),
|
|
79
|
-
[semantic_conventions_1.SEMRESATTRS_DEPLOYMENT_ENVIRONMENT]: config_1.ENVIRONMENT,
|
|
80
|
-
[semantic_conventions_1.SEMRESATTRS_PROCESS_RUNTIME_VERSION]: process.version,
|
|
81
|
-
[semantic_conventions_1.SEMRESATTRS_PROCESS_PID]: process.pid,
|
|
82
|
-
});
|
|
83
|
-
const detectedResources = (0, resources_1.detectResources)({ detectors: (0, auto_instrumentations_node_1.getResourceDetectors)() });
|
|
84
|
-
const resource = resourceWithAttributes.merge(detectedResources);
|
|
85
|
-
return resource;
|
|
86
|
-
};
|
|
87
|
-
exports.idGenerator = new session_recorder_node_1.SessionRecorderIdGenerator();
|
|
88
|
-
const opentelemetry = () => {
|
|
89
|
-
// const traceExporter = new OTLPTraceExporter({
|
|
90
|
-
// url: OTLP_TRACES_ENDPOINT,
|
|
91
|
-
// headers: {
|
|
92
|
-
// Authorization: MULTIPLAYER_OTLP_KEY
|
|
93
|
-
// },
|
|
94
|
-
// })
|
|
95
|
-
const traceExporter = new session_recorder_node_1.SessionRecorderHttpTraceExporter({
|
|
96
|
-
apiKey: config_1.MULTIPLAYER_OTLP_KEY,
|
|
97
|
-
url: config_1.OTLP_TRACES_ENDPOINT,
|
|
98
|
-
});
|
|
99
|
-
const resource = getResource();
|
|
100
|
-
const provider = new sdk_node_1.node.NodeTracerProvider({
|
|
101
|
-
resource,
|
|
102
|
-
spanProcessors: [
|
|
103
|
-
new sdk_trace_base_1.BatchSpanProcessor(traceExporter),
|
|
104
|
-
],
|
|
105
|
-
sampler: new sdk_trace_base_1.ParentBasedSampler({
|
|
106
|
-
root: new session_recorder_node_1.SessionRecorderTraceIdRatioBasedSampler(config_1.MULTIPLAYER_OTLP_SPAN_RATIO),
|
|
107
|
-
}),
|
|
108
|
-
idGenerator: exports.idGenerator,
|
|
109
|
-
});
|
|
110
|
-
// const logExporter = new OTLPLogExporter({
|
|
111
|
-
// url: OTLP_LOGS_ENDPOINT,
|
|
112
|
-
// headers: {
|
|
113
|
-
// Authorization: MULTIPLAYER_OTLP_KEY
|
|
114
|
-
// },
|
|
115
|
-
// })
|
|
116
|
-
const logExporter = new session_recorder_node_1.SessionRecorderHttpLogsExporter({
|
|
117
|
-
apiKey: config_1.MULTIPLAYER_OTLP_KEY,
|
|
118
|
-
url: config_1.OTLP_LOGS_ENDPOINT,
|
|
119
|
-
});
|
|
120
|
-
const logRecordProcessor = new sdk_logs_1.BatchLogRecordProcessor(logExporter);
|
|
121
|
-
const loggerProvider = new sdk_logs_1.LoggerProvider({
|
|
122
|
-
resource,
|
|
123
|
-
processors: [logRecordProcessor],
|
|
124
|
-
});
|
|
125
|
-
apiLogs.logs.setGlobalLoggerProvider(loggerProvider);
|
|
126
|
-
provider.register();
|
|
127
|
-
api_1.default.trace.setGlobalTracerProvider(provider);
|
|
128
|
-
api_1.default.propagation.setGlobalPropagator(new core_1.W3CTraceContextPropagator());
|
|
129
|
-
const sdk = new sdk_node_1.NodeSDK({
|
|
130
|
-
instrumentations,
|
|
131
|
-
});
|
|
132
|
-
sdk.start();
|
|
133
|
-
};
|
|
134
|
-
opentelemetry();
|
|
135
|
-
//# sourceMappingURL=opentelemetry.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"opentelemetry.js","sourceRoot":"","sources":["../src/opentelemetry.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;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AC3C,aAAG,CAAC,WAAW,CAAC,mBAAmB,CAAC,IAAI,gCAAyB,EAAE,CAAC,CAAA;IAEpE,MAAM,GAAG,GAAG,IAAI,kBAAO,CAAC;QACtB,gBAAgB;KACjB,CAAC,CAAA;IAEF,GAAG,CAAC,KAAK,EAAE,CAAA;AACb,CAAC,CAAA;AAED,aAAa,EAAE,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAOA,QAAA,MAAM,MAAM,KAAW,CAAA;AAYvB,eAAe,MAAM,CAAA"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const express_1 = __importDefault(require("express"));
|
|
7
|
-
const { Router } = express_1.default;
|
|
8
|
-
const router = Router();
|
|
9
|
-
const health = async (req, res, next) => {
|
|
10
|
-
try {
|
|
11
|
-
return res.status(200).json({});
|
|
12
|
-
}
|
|
13
|
-
catch (err) {
|
|
14
|
-
return next(err);
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
router.route('/').get(health);
|
|
18
|
-
exports.default = router;
|
|
19
|
-
//# sourceMappingURL=api.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"api.js","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":";;;;;AAAA,sDAIgB;AAEhB,MAAM,EAAE,MAAM,EAAE,GAAG,iBAAO,CAAA;AAC1B,MAAM,MAAM,GAAG,MAAM,EAAE,CAAA;AAEvB,MAAM,MAAM,GAAG,KAAK,EAAE,GAAY,EAAE,GAAa,EAAE,IAAkB,EAAE,EAAE;IACvE,IAAI,CAAC;QACH,OAAO,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IACjC,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,IAAI,CAAC,GAAG,CAAC,CAAA;IAClB,CAAC;AACH,CAAC,CAAA;AAED,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;AAE7B,kBAAe,MAAM,CAAA"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export declare const NODE_ENV: string;
|
|
2
|
-
export declare const isProduction: boolean;
|
|
3
|
-
export declare const PORT: number;
|
|
4
|
-
export declare const API_PREFIX: string;
|
|
5
|
-
export declare const LOG_LEVEL: string;
|
|
6
|
-
export declare const COMPONENT_NAME: string;
|
|
7
|
-
export declare const COMPONENT_VERSION: string;
|
|
8
|
-
export declare const ENVIRONMENT: string;
|
|
9
|
-
export declare const MULTIPLAYER_OTLP_KEY: string;
|
|
10
|
-
export declare const OTLP_TRACES_ENDPOINT: string;
|
|
11
|
-
export declare const OTLP_LOGS_ENDPOINT: string;
|
|
12
|
-
export declare const MULTIPLAYER_OTLP_SPAN_RATIO: number;
|
|
13
|
-
//# sourceMappingURL=config.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,QAAQ,QAAwC,CAAA;AAC7D,eAAO,MAAM,YAAY,SAA4B,CAAA;AAErD,eAAO,MAAM,IAAI,QAAmC,CAAA;AACpD,eAAO,MAAM,UAAU,QAAsC,CAAA;AAE7D,eAAO,MAAM,SAAS,QAA6D,CAAA;AAEnF,eAAO,MAAM,cAAc,QAAqG,CAAA;AAChI,eAAO,MAAM,iBAAiB,QAA6C,CAAA;AAC3E,eAAO,MAAM,WAAW,QAAuC,CAAA;AAE/D,eAAO,MAAM,oBAAoB,EAAuC,MAAM,CAAA;AAM9E,eAAO,MAAM,oBAAoB,QAA8E,CAAA;AAC/G,eAAO,MAAM,kBAAkB,QAA0E,CAAA;AAEzG,eAAO,MAAM,2BAA2B,QAEhC,CAAA"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var _a;
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.MULTIPLAYER_OTLP_SPAN_RATIO = exports.OTLP_LOGS_ENDPOINT = exports.OTLP_TRACES_ENDPOINT = exports.MULTIPLAYER_OTLP_KEY = exports.ENVIRONMENT = exports.COMPONENT_VERSION = exports.COMPONENT_NAME = exports.LOG_LEVEL = exports.API_PREFIX = exports.PORT = exports.isProduction = exports.NODE_ENV = void 0;
|
|
5
|
-
exports.NODE_ENV = process.env.NODE_ENV || 'development';
|
|
6
|
-
exports.isProduction = exports.NODE_ENV === 'production';
|
|
7
|
-
exports.PORT = Number(process.env.PORT || 3000);
|
|
8
|
-
exports.API_PREFIX = process.env.API_PREFIX || '/v1/api';
|
|
9
|
-
exports.LOG_LEVEL = process.env.LOG_LEVEL || (exports.isProduction ? 'info' : 'debug');
|
|
10
|
-
exports.COMPONENT_NAME = ((_a = process.env.npm_package_name) === null || _a === void 0 ? void 0 : _a.split('/').pop()) || process.env.SERVICE_NAME || 'timegate';
|
|
11
|
-
exports.COMPONENT_VERSION = process.env.npm_package_version || '0.0.1';
|
|
12
|
-
exports.ENVIRONMENT = process.env.ENVIRONMENT || 'staging';
|
|
13
|
-
exports.MULTIPLAYER_OTLP_KEY = process.env.MULTIPLAYER_OTLP_KEY;
|
|
14
|
-
if (!exports.MULTIPLAYER_OTLP_KEY) {
|
|
15
|
-
throw new Error('MULTIPLAYER_OTLP_KEY is not set');
|
|
16
|
-
}
|
|
17
|
-
exports.OTLP_TRACES_ENDPOINT = process.env.OTLP_TRACES_ENDPOINT || 'https://api.multiplayer.app/v1/traces';
|
|
18
|
-
exports.OTLP_LOGS_ENDPOINT = process.env.OTLP_LOGS_ENDPOINT || 'https://api.multiplayer.app/v1/logs';
|
|
19
|
-
exports.MULTIPLAYER_OTLP_SPAN_RATIO = process.env.MULTIPLAYER_OTLP_SPAN_RATIO
|
|
20
|
-
? Number(process.env.MULTIPLAYER_OTLP_SPAN_RATIO)
|
|
21
|
-
: 0.01;
|
|
22
|
-
//# sourceMappingURL=config.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":";;;;AAAa,QAAA,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,aAAa,CAAA;AAChD,QAAA,YAAY,GAAG,gBAAQ,KAAK,YAAY,CAAA;AAExC,QAAA,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,IAAI,CAAC,CAAA;AACvC,QAAA,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU,IAAI,SAAS,CAAA;AAEhD,QAAA,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,CAAC,oBAAY,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAA;AAEtE,QAAA,cAAc,GAAG,CAAA,MAAA,OAAO,CAAC,GAAG,CAAC,gBAAgB,0CAAE,KAAK,CAAC,GAAG,EAAE,GAAG,EAAY,KAAI,OAAO,CAAC,GAAG,CAAC,YAAY,IAAI,UAAU,CAAA;AACnH,QAAA,iBAAiB,GAAG,OAAO,CAAC,GAAG,CAAC,mBAAmB,IAAI,OAAO,CAAA;AAC9D,QAAA,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,SAAS,CAAA;AAElD,QAAA,oBAAoB,GAAG,OAAO,CAAC,GAAG,CAAC,oBAA8B,CAAA;AAE9E,IAAI,CAAC,4BAAoB,EAAE,CAAC;IAC1B,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAA;AACpD,CAAC;AAEY,QAAA,oBAAoB,GAAG,OAAO,CAAC,GAAG,CAAC,oBAAoB,IAAI,uCAAuC,CAAA;AAClG,QAAA,kBAAkB,GAAG,OAAO,CAAC,GAAG,CAAC,kBAAkB,IAAI,qCAAqC,CAAA;AAE5F,QAAA,2BAA2B,GAAG,OAAO,CAAC,GAAG,CAAC,2BAA2B;IAChF,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,2BAA2B,CAAC;IACjD,CAAC,CAAC,IAAI,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,CAAA;AACtB,OAAO,iBAAiB,CAAA"}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
require("dotenv/config");
|
|
7
|
-
require("./opentelemetry");
|
|
8
|
-
const http_1 = __importDefault(require("http"));
|
|
9
|
-
const cors_1 = __importDefault(require("cors"));
|
|
10
|
-
const body_parser_1 = __importDefault(require("body-parser"));
|
|
11
|
-
const express_1 = __importDefault(require("express"));
|
|
12
|
-
const config_1 = require("./config");
|
|
13
|
-
const api_1 = __importDefault(require("./api"));
|
|
14
|
-
const app = (0, express_1.default)();
|
|
15
|
-
app.use((0, cors_1.default)());
|
|
16
|
-
app.use(body_parser_1.default.urlencoded({ extended: true }));
|
|
17
|
-
app.use(body_parser_1.default.json());
|
|
18
|
-
app.use(config_1.API_PREFIX, api_1.default);
|
|
19
|
-
app.use((req, res, next) => {
|
|
20
|
-
res.status(404).send('Not found');
|
|
21
|
-
});
|
|
22
|
-
const httpServer = http_1.default.createServer(app);
|
|
23
|
-
const onReady = () => {
|
|
24
|
-
console.log(`🚀 Server ready at http://localhost:${config_1.PORT}`);
|
|
25
|
-
};
|
|
26
|
-
httpServer.listen(config_1.PORT, onReady);
|
|
27
|
-
const exitHandler = async (error) => {
|
|
28
|
-
if (error) {
|
|
29
|
-
console.log('Server exited with error', error);
|
|
30
|
-
}
|
|
31
|
-
process.removeListener('exit', exitHandler);
|
|
32
|
-
process.exit();
|
|
33
|
-
};
|
|
34
|
-
process.on('exit', exitHandler);
|
|
35
|
-
process.on('SIGINT', exitHandler);
|
|
36
|
-
process.on('SIGTERM', exitHandler);
|
|
37
|
-
process.on('uncaughtException', (err) => {
|
|
38
|
-
console.error('uncaughtException', err);
|
|
39
|
-
});
|
|
40
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;AAAA,yBAAsB;AACtB,2BAAwB;AACxB,gDAAuB;AACvB,gDAAuB;AACvB,8DAAoC;AACpC,sDAIgB;AAChB,qCAA2C;AAC3C,gDAAuB;AAEvB,MAAM,GAAG,GAAG,IAAA,iBAAO,GAAE,CAAA;AAErB,GAAG,CAAC,GAAG,CAAC,IAAA,cAAI,GAAE,CAAC,CAAA;AACf,GAAG,CAAC,GAAG,CAAC,qBAAU,CAAC,UAAU,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAA;AAClD,GAAG,CAAC,GAAG,CAAC,qBAAU,CAAC,IAAI,EAAE,CAAC,CAAA;AAE1B,GAAG,CAAC,GAAG,CAAC,mBAAU,EAAE,aAAG,CAAC,CAAA;AAExB,GAAG,CAAC,GAAG,CAAC,CAAC,GAAY,EAAE,GAAa,EAAE,IAAkB,EAAE,EAAE;IACxD,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA;AACnC,CAAC,CAAC,CAAA;AAEJ,MAAM,UAAU,GAAG,cAAI,CAAC,YAAY,CAAC,GAAG,CAAC,CAAA;AACzC,MAAM,OAAO,GAAG,GAAG,EAAE;IACjB,OAAO,CAAC,GAAG,CAAC,uCAAuC,aAAI,EAAE,CAAC,CAAA;AAC9D,CAAC,CAAA;AAED,UAAU,CAAC,MAAM,CAAC,aAAI,EAAE,OAAO,CAAC,CAAA;AAEhC,MAAM,WAAW,GAAG,KAAK,EAAE,KAAY,EAAE,EAAE;IACvC,IAAI,KAAK,EAAE,CAAC;QACR,OAAO,CAAC,GAAG,CAAC,0BAA0B,EAAE,KAAK,CAAC,CAAA;IAClD,CAAC;IACD,OAAO,CAAC,cAAc,CAAC,MAAM,EAAE,WAAW,CAAC,CAAA;IAC3C,OAAO,CAAC,IAAI,EAAE,CAAA;AAClB,CAAC,CAAA;AAED,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,WAAW,CAAC,CAAA;AAC/B,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAA;AACjC,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,WAAW,CAAC,CAAA;AAClC,OAAO,CAAC,EAAE,CAAC,mBAAmB,EAAE,CAAC,GAAG,EAAE,EAAE;IACpC,OAAO,CAAC,KAAK,CAAC,mBAAmB,EAAE,GAAG,CAAC,CAAA;AAC3C,CAAC,CAAC,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"opentelemetry.d.ts","sourceRoot":"","sources":["../src/opentelemetry.ts"],"names":[],"mappings":"AAkFA,eAAO,MAAM,WAAW,KAAmC,CAAA"}
|
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
-
};
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.idGenerator = void 0;
|
|
40
|
-
const os_1 = require("os");
|
|
41
|
-
const sdk_node_1 = require("@opentelemetry/sdk-node");
|
|
42
|
-
const sdk_trace_base_1 = require("@opentelemetry/sdk-trace-base");
|
|
43
|
-
const auto_instrumentations_node_1 = require("@opentelemetry/auto-instrumentations-node");
|
|
44
|
-
const resources_1 = require("@opentelemetry/resources");
|
|
45
|
-
const semantic_conventions_1 = require("@opentelemetry/semantic-conventions");
|
|
46
|
-
const api_1 = __importDefault(require("@opentelemetry/api"));
|
|
47
|
-
// import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-http"
|
|
48
|
-
const core_1 = require("@opentelemetry/core");
|
|
49
|
-
const session_recorder_node_1 = require("@multiplayer-app/session-recorder-node");
|
|
50
|
-
const sdk_logs_1 = require("@opentelemetry/sdk-logs");
|
|
51
|
-
const apiLogs = __importStar(require("@opentelemetry/api-logs"));
|
|
52
|
-
// import { OTLPLogExporter } from '@opentelemetry/exporter-logs-otlp-http'
|
|
53
|
-
const config_1 = require("./config");
|
|
54
|
-
// NOTE: Update instrumentation configuration as needed
|
|
55
|
-
// For more see: https://www.npmjs.com/package/@opentelemetry/auto-instrumentations-node
|
|
56
|
-
const instrumentations = [
|
|
57
|
-
(0, auto_instrumentations_node_1.getNodeAutoInstrumentations)({
|
|
58
|
-
'@opentelemetry/instrumentation-http': {
|
|
59
|
-
requestHook: session_recorder_node_1.SessionRecorderHttpInstrumentationHooksNode.requestHook({
|
|
60
|
-
maskHeadersList: ['X-Api-Key'],
|
|
61
|
-
maxPayloadSizeBytes: 5000,
|
|
62
|
-
schemifyDocSpanPayload: false,
|
|
63
|
-
isMaskBodyEnabled: false,
|
|
64
|
-
}),
|
|
65
|
-
responseHook: session_recorder_node_1.SessionRecorderHttpInstrumentationHooksNode.responseHook({
|
|
66
|
-
maskHeadersList: ['X-Api-Key'],
|
|
67
|
-
maxPayloadSizeBytes: 5000,
|
|
68
|
-
schemifyDocSpanPayload: false,
|
|
69
|
-
isMaskBodyEnabled: false,
|
|
70
|
-
}),
|
|
71
|
-
},
|
|
72
|
-
}),
|
|
73
|
-
];
|
|
74
|
-
const getResource = () => {
|
|
75
|
-
const resourceWithAttributes = (0, resources_1.resourceFromAttributes)({
|
|
76
|
-
[semantic_conventions_1.ATTR_SERVICE_NAME]: config_1.COMPONENT_NAME,
|
|
77
|
-
[semantic_conventions_1.ATTR_SERVICE_VERSION]: config_1.COMPONENT_VERSION,
|
|
78
|
-
[semantic_conventions_1.SEMRESATTRS_HOST_NAME]: (0, os_1.hostname)(),
|
|
79
|
-
[semantic_conventions_1.SEMRESATTRS_DEPLOYMENT_ENVIRONMENT]: config_1.ENVIRONMENT,
|
|
80
|
-
[semantic_conventions_1.SEMRESATTRS_PROCESS_RUNTIME_VERSION]: process.version,
|
|
81
|
-
[semantic_conventions_1.SEMRESATTRS_PROCESS_PID]: process.pid,
|
|
82
|
-
});
|
|
83
|
-
const detectedResources = (0, resources_1.detectResources)({ detectors: (0, auto_instrumentations_node_1.getResourceDetectors)() });
|
|
84
|
-
const resource = resourceWithAttributes.merge(detectedResources);
|
|
85
|
-
return resource;
|
|
86
|
-
};
|
|
87
|
-
exports.idGenerator = new session_recorder_node_1.SessionRecorderIdGenerator();
|
|
88
|
-
const opentelemetry = () => {
|
|
89
|
-
// const traceExporter = new OTLPTraceExporter({
|
|
90
|
-
// url: OTLP_TRACES_ENDPOINT,
|
|
91
|
-
// headers: {
|
|
92
|
-
// Authorization: MULTIPLAYER_OTLP_KEY
|
|
93
|
-
// },
|
|
94
|
-
// })
|
|
95
|
-
const traceExporter = new session_recorder_node_1.SessionRecorderHttpTraceExporter({
|
|
96
|
-
apiKey: config_1.MULTIPLAYER_OTLP_KEY,
|
|
97
|
-
url: config_1.OTLP_TRACES_ENDPOINT,
|
|
98
|
-
});
|
|
99
|
-
const resource = getResource();
|
|
100
|
-
const provider = new sdk_node_1.node.NodeTracerProvider({
|
|
101
|
-
resource,
|
|
102
|
-
spanProcessors: [
|
|
103
|
-
new sdk_trace_base_1.BatchSpanProcessor(traceExporter),
|
|
104
|
-
],
|
|
105
|
-
sampler: new sdk_trace_base_1.ParentBasedSampler({
|
|
106
|
-
root: new session_recorder_node_1.SessionRecorderTraceIdRatioBasedSampler(config_1.MULTIPLAYER_OTLP_SPAN_RATIO),
|
|
107
|
-
}),
|
|
108
|
-
idGenerator: exports.idGenerator,
|
|
109
|
-
});
|
|
110
|
-
// const logExporter = new OTLPLogExporter({
|
|
111
|
-
// url: OTLP_LOGS_ENDPOINT,
|
|
112
|
-
// headers: {
|
|
113
|
-
// Authorization: MULTIPLAYER_OTLP_KEY
|
|
114
|
-
// },
|
|
115
|
-
// })
|
|
116
|
-
const logExporter = new session_recorder_node_1.SessionRecorderHttpLogsExporter({
|
|
117
|
-
apiKey: config_1.MULTIPLAYER_OTLP_KEY,
|
|
118
|
-
url: config_1.OTLP_LOGS_ENDPOINT,
|
|
119
|
-
});
|
|
120
|
-
const logRecordProcessor = new sdk_logs_1.BatchLogRecordProcessor(logExporter);
|
|
121
|
-
const loggerProvider = new sdk_logs_1.LoggerProvider({
|
|
122
|
-
resource,
|
|
123
|
-
processors: [logRecordProcessor],
|
|
124
|
-
});
|
|
125
|
-
apiLogs.logs.setGlobalLoggerProvider(loggerProvider);
|
|
126
|
-
provider.register();
|
|
127
|
-
api_1.default.trace.setGlobalTracerProvider(provider);
|
|
128
|
-
api_1.default.propagation.setGlobalPropagator(new core_1.W3CTraceContextPropagator());
|
|
129
|
-
const sdk = new sdk_node_1.NodeSDK({
|
|
130
|
-
instrumentations,
|
|
131
|
-
});
|
|
132
|
-
sdk.start();
|
|
133
|
-
};
|
|
134
|
-
opentelemetry();
|
|
135
|
-
//# sourceMappingURL=opentelemetry.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"opentelemetry.js","sourceRoot":"","sources":["../src/opentelemetry.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2BAA6B;AAC7B,sDAAuD;AACvD,kEAGsC;AACtC,0FAGkD;AAClD,wDAGiC;AACjC,8EAO4C;AAC5C,6DAAoC;AACpC,8EAA8E;AAC9E,8CAA+D;AAC/D,kFAM+C;AAC/C,sDAAiF;AACjF,iEAAkD;AAClD,2EAA2E;AAE3E,qCAQiB;AAEjB,uDAAuD;AACvD,wFAAwF;AACxF,MAAM,gBAAgB,GA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