# GMPay Daily Report System ## Business Goal: At a specific timimg everyday, we hope to see yesterday system status/statistics in a skype channl. **The specific timing, report details, skype channel should be configable.** i.e. if we want to add/remove/update the daily report, all we need is updating config file, such as report config file. No need to update the code base. For example, We would like to see GMPay daily report: - yesterday total 5xx - source: CloudWatch/Prometheus - yesterday highest rps - source: CloudWatch Insght - yesterday total request - source: CloudWatch/Prometheus - yesterday total OA - source: RepDB - yesterday total EA - source: RepDB **Example of Skype msg:** ![](https://i.imgur.com/fTZE2dE.png) **PS. This daily report application not only could support to GMPay but also to the other mdaq system, such as payment or AH. It would help us to management the daily report of different mdaq system easily and we fully control it.** ## Components 1. Notification channel part. Support: - Skype webhook - Slack webhook 2. Resource part. Support: - DB query - CloudWatch metric - CloudWatch Insight - Prometheus 3. Report generator part, Support - Report template - scheduling - input needed value from different resource - output to different notification channel ## Configs ### Report config files (yaml) ```yaml= - reportName: gmpay-daily-report - invokeTimestamp: ' * * * 10 *' - input: - fieldName: highestRPS sourceId: Prod-GMPay-LogInsight params: script: stats count(*) as rps ... - fieldName: 5xxCount sourceId: Prod-CloudWatch params: scope: xxx - fieldName: OACount sourceId: Prod-Repdb params: script: select count(*) from ... scriptFilePath: /path/to/sql/script.sql - output: - channelId: Log-Alert - messageFormat: |- GMPay Daily Report: Highest RPS: ${highestRPS} 5xx Count: ${5xxCount} OA Count: ${OACount} ``` ### Source Config (yaml) ```yaml= - sourceId: Prod-Repdb type: postgreSQL url: user: password: database: - sourceId: Prod-GMPay-LogInsight type: CloudWatchInsight logGroups: - group_1 - group_2 - sourceId: Prod-GMPay-Prometheus type: Prometheus - sourceId: Prod-CloudWatch type: CloudWatchMetrics ``` ### Notification Channel Config (yaml) ```yaml= - channelId: Log-Alert type: skype webhook: https://webhook.to/log-alert-channel - channelId: Support-Alert type: slack webhook: https://webhook.to/support-alert-channel ```