Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@
"node/shebang": "off",
"node/no-deprecated-api": "warn",
"no-useless-constructor": "warn",
"no-return-await": "off"
"no-return-await": "off",
"import/extensions": ["error", "never", { "json": "always" }]
},

"overrides": [
Expand Down Expand Up @@ -125,5 +126,17 @@
]
}
}
]
],

"settings": {
"import/resolver": {
"typescript": {
"alwaysTryTypes": true,
"project": ["tsconfig.json"]
},
"node": {
"extensions": [".js", ".ts", ".json"]
}
}
}
}
4 changes: 4 additions & 0 deletions lib/addNewMask.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// ↓ Should be imported first
require('@codefresh-io/cf-telemetry/init');
// ↓ Keep one blank line below to prevent automatic import reordering

const { getServerAddress } = require('./helpers');

const exitCodes = {
Expand Down
16 changes: 16 additions & 0 deletions lib/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
// ↓ Should be imported first
require('@codefresh-io/cf-telemetry/init');
// ↓ Keep one blank line below to prevent automatic import reordering

const otel = require('@codefresh-io/cf-telemetry/otel');
const path = require('node:path');
const cflogs = require('cf-logs');

const unhandledErrorsTotal = otel.cf.getMeter().createCounter(
'codefresh.unhandled_errors',
{
description: 'Number of unhandled errors',
unit: '{unhandled_error}',
valueType: otel.api.ValueType.INT,
},
);

const loggerOptions = {
filePath: path.join(__dirname, '../logs', 'logs.log'),
console: process.env.LOG_TO_CONSOLE || false,
Expand Down Expand Up @@ -41,12 +55,14 @@ process.on('exit', (code) => {
});

process.on('uncaughtException', (error) => {
unhandledErrorsTotal.add(1, { 'cf.unhandled_error.type': 'uncaughtException' });
console.log(`uncaughtException: ${error}`);
logger.state.uncaughtException = error;
logger._writeNewState();
});

process.on('unhandledRejection', (reason) => {
unhandledErrorsTotal.add(1, { 'cf.unhandled_error.type': 'unhandledRejection' });
console.log(`unhandledRejection: ${reason}`);
logger.state.unhandledRejection = reason;
logger._writeNewState();
Expand Down
4 changes: 4 additions & 0 deletions lib/isReady.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// ↓ Should be imported first
require('@codefresh-io/cf-telemetry/init');
// ↓ Keep one blank line below to prevent automatic import reordering

const { readFileSync } = require('fs');
const _ = require('lodash');
const { ContainerHandlingStatus } = require('./enums');
Expand Down
4 changes: 4 additions & 0 deletions lib/waitUntilFinish.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// ↓ Should be imported first
require('@codefresh-io/cf-telemetry/init');
// ↓ Keep one blank line below to prevent automatic import reordering

const fs = require('fs');
const path = require('path');
const Q = require('q');
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"**/request/form-data": "2.5.5"
},
"dependencies": {
"@codefresh-io/cf-telemetry": "^3.1.0",
"@codefresh-io/task-logger": "^1.12.3",
"cf-errors": "^0.1.17",
"cf-logs": "^1.1.28",
Expand All @@ -29,6 +30,7 @@
"chai": "^4.4.1",
"eslint": "^8.57.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-import-resolver-typescript": "^4.4.4",
"eslint-plugin-chai-friendly": "^1.0.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jsx-a11y": "^6.9.0",
Expand Down
2 changes: 1 addition & 1 deletion service.yaml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version: 1.12.8
version: 1.12.9
Loading
Loading