openwhisk-package-alarms
openwhisk-package-alarms copied to clipboard
Added support for Azure cosmosDB for alarms package
Added support for alarms package to use cosmos DB. All database interactions will now go through database.js which in turn will delegate to actual DB implementations (couchdb or cosmosdb) based on dbType. There are some TODO comments and need to get better understanding on those.
@sandeep-paliwal - have you tested this with couchdb? fails for me
"namespace": "whisk.system",
"name": "alarmWebAction",
"version": "0.0.2",
"subject": "whisk.system",
"activationId": "5d9dfa5f98cb4f629dfa5f98cb2f6232",
"start": 1539971896476,
"end": 1539971896495,
"duration": 19,
"response": {
"status": "application error",
"statusCode": 0,
"success": false,
"result": {
"error": {
"message": "Cannot read property 'getWorkerID' of undefined",
"stack": "TypeError: Cannot read property 'getWorkerID' of undefined\n at common.verifyTriggerAuth.then (/nodejsAction/dUGHWGoL/alarmWebAction.js:135:26)\n at process._tickCallback (internal/process/next_tick.js:109:7)"
@sandeep-paliwal Please run all tests to verify it works once you fix this issue. The getDatabase function in alarmWebAction needs to be a promise that you wait on when you call it. You are returning the database but only after you wait on the initDB. The call to getDatabase right before you try to getWorkerID is undefined because you are not waiting on it.
@sandeep-paliwal I also see some alarms functionality that exists with couchdb that was not made available with cosmosDB as part of this PR:
- The internal monitoring/health code that creates and deletes trigger db entries found in provider/lib/health.js
- The trigger feed cleanup that occurs for the fire once alarm when the deleteAfterFire param is not set to false (see the handleFiredTriggers function in provider/lib/utils.js)
Thanks for the comments @jasonpet . I will update the PR and run the tests you have mentioned.