@ofirdagan/pingdom
Advanced tools
Comparing version 1.0.4 to 1.0.5
@@ -8,2 +8,5 @@ "use strict"; | ||
const axios_1 = __importDefault(require("axios")); | ||
const axios_retry_1 = __importDefault(require("axios-retry")); | ||
const logger_1 = require("./services/logger"); | ||
(0, axios_retry_1.default)(axios_1.default, { retryDelay: (retryCount) => retryCount * 300 }); | ||
const THREE_MIN = 1000 * 60 * 3; | ||
@@ -15,5 +18,10 @@ function monitor(serviceName, apiKey) { | ||
exports.monitor = monitor; | ||
function reportAlive(serviceName, apiKey) { | ||
axios_1.default.get(`https://ofird11.editorx.io/pingdom/_functions/ping/${serviceName}`, { headers: { 'x-api-key': apiKey } }); | ||
async function reportAlive(serviceName, apiKey) { | ||
try { | ||
await axios_1.default.get(`https://ofird11.editorx.io/pingdom/_functions/ping/${serviceName}`, { headers: { 'x-api-key': apiKey } }); | ||
} | ||
catch (e) { | ||
(0, logger_1.log)('exception in reporting ping', e); | ||
} | ||
} | ||
//# sourceMappingURL=pingdom.js.map |
{ | ||
"name": "@ofirdagan/pingdom", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"description": "my own lightweight version of pingdom (service monitoring)", | ||
@@ -25,3 +25,4 @@ "main": "dist/pingdom.js", | ||
"dependencies": { | ||
"axios": "^0.24.0" | ||
"axios": "^0.24.0", | ||
"axios-retry": "^3.2.4" | ||
}, | ||
@@ -28,0 +29,0 @@ "devDependencies": { |
@@ -8,7 +8,8 @@ # PingDom | ||
* Add a new service (service name must be unique and **without spaces/ special characters**) | ||
* copy your API key | ||
* In your project `npm install @ofirdagan/pingdom` | ||
* In your code: | ||
```js | ||
import {init} from '@ofirdagan/pingdom'; | ||
init(serviceName); | ||
import {monitor} from '@ofirdagan/pingdom'; | ||
monitor(serviceName, apiKey); | ||
``` |
import axios from 'axios'; | ||
import axiosRetry from 'axios-retry'; | ||
import {log} from './services/logger'; | ||
axiosRetry(axios, { retryDelay: (retryCount) => retryCount * 300 }); | ||
const THREE_MIN = 1000 * 60 * 3; | ||
@@ -10,4 +12,8 @@ | ||
function reportAlive(serviceName: string, apiKey: string) { | ||
axios.get(`https://ofird11.editorx.io/pingdom/_functions/ping/${serviceName}`, {headers: {'x-api-key': apiKey}}); | ||
} | ||
async function reportAlive(serviceName: string, apiKey: string) { | ||
try { | ||
await axios.get(`https://ofird11.editorx.io/pingdom/_functions/ping/${serviceName}`, {headers: {'x-api-key': apiKey}}); | ||
} catch (e) { | ||
log('exception in reporting ping', e); | ||
} | ||
} |
import {monitor} from '../src/pingdom'; | ||
monitor('test'); | ||
monitor('test', 'wrong-api-key'); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5504
12
79
15
2
1
+ Addedaxios-retry@^3.2.4
+ Added@babel/runtime@7.26.0(transitive)
+ Addedaxios-retry@3.9.1(transitive)
+ Addedis-retry-allowed@2.2.0(transitive)
+ Addedregenerator-runtime@0.14.1(transitive)