@munlib/common 1.0.138 → 1.0.140

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/build/index.d.ts CHANGED
@@ -12,3 +12,4 @@ export * from './events/types/order-status';
12
12
  export * from './events/types/instituciones-pagos';
13
13
  export * from './logs/logger';
14
14
  export * from "./errors/erroresStatus";
15
+ export * from './middlewares/apm';
package/build/index.js CHANGED
@@ -30,3 +30,4 @@ __exportStar(require("./events/types/order-status"), exports);
30
30
  __exportStar(require("./events/types/instituciones-pagos"), exports);
31
31
  __exportStar(require("./logs/logger"), exports);
32
32
  __exportStar(require("./errors/erroresStatus"), exports);
33
+ __exportStar(require("./middlewares/apm"), exports);
@@ -0,0 +1,2 @@
1
+ declare const apm: any;
2
+ export default apm;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ // apm.ts
4
+ var apm = require('elastic-apm-node').start({
5
+ // The service name is the primary filter in the APM UI and is used to group errors and trace data together. Allowed characters are a-z, A-Z, 0-9, -, _, and space. Overrides the service name in package.json.
6
+ serviceName: 'MUNICIPIO_OBSERVABILIDAD',
7
+ // Use if APM Server requires an API Key. This is used to ensure that only your agents can send data to your APM server. Agents can use API keys as a replacement of secret token, APM server can have multiple API keys. When both secret token and API key are used, API key has priority and secret token is ignored.
8
+ apiKey: 'VnFqX0JaSUIyLUFFeEQwTXNObGU6a3poeEFCdVBTT0dja2w4YUstS0VQdw==',
9
+ // Set the custom APM Server URL (default: http://localhost:8200). The URL must be fully qualified, including protocol (http or https) and port.
10
+ serverUrl: 'https://observabilidad-muni-f2162e.apm.us-east-1.aws.elastic.cloud:443',
11
+ // The name of the environment this service is deployed in, e.g., "production" or "staging". Environments allow you to easily filter data on a global level in the APM UI. It's important to be consistent when naming environments across agents.
12
+ environment: 'DEV',
13
+ logLevel: 'trace',
14
+ });
15
+ exports.default = apm;
@@ -1,9 +1,15 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.errorHandler = void 0;
4
7
  var custom_error_1 = require("../errors/custom-error");
5
8
  var erroresStatus_1 = require("../errors/erroresStatus");
9
+ var apm_1 = __importDefault(require("./apm"));
6
10
  var errorHandler = function (err, req, res, next) {
11
+ //ELK LOGS
12
+ apm_1.default.captureError(err);
7
13
  // Manejo de errores personalizados
8
14
  if (err instanceof custom_error_1.CustomError) {
9
15
  return res.status(err.statusCode).send(err.serializeErrors());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@munlib/common",
3
- "version": "1.0.138",
3
+ "version": "1.0.140",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",