openwhisk-package-alarms icon indicating copy to clipboard operation
openwhisk-package-alarms copied to clipboard

Added support for Azure cosmosDB for alarms package

Open sandeep-paliwal opened this issue 6 years ago • 4 comments

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 avatar Aug 30 '18 08:08 sandeep-paliwal

@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)"

jasonpet avatar Oct 19 '18 18:10 jasonpet

@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.

jasonpet avatar Oct 19 '18 18:10 jasonpet

@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)

jasonpet avatar Oct 19 '18 19:10 jasonpet

Thanks for the comments @jasonpet . I will update the PR and run the tests you have mentioned.

sandeep-paliwal avatar Oct 22 '18 05:10 sandeep-paliwal