samagra-comms / uci-apis

Unified Communications Interface (UCI) is a system that powers governments to create and manage conversations with citizens and with its own officials. Through UCI governments can seamlessly setup simple and complex conversations using a multi-channel approach. UCI aims to democratize the use of different communication channels such as WhatsApp, Telegram, SMS, email for governance use cases through a standard configurable manner that is reusable and scalable across all governance use cases.
12 stars 30 forks source link

Integration of script with monitoring dashboard #179

Closed chinmoy12c closed 1 year ago

chinmoy12c commented 1 year ago

Currently, the monitoring script needs to be changed to integrate with the monitoring dashboard seamlessly.

End Goal:

An independent containerized image that provides access to

All Logs Data

A complete dump of all the logs from all the services must be stored. The logs would be segregated into separate daily files. The following queries can be done while fetching logs -

The overall flow of the system would be as follows.

Image

Real-Time analysis

This would enable specific log statements to be grepped and counted in real time (just like axiom). Before triggering a bot, the real-time analysis needs to be enabled or switched on, which would start monitoring incoming logs and start creating a dump of analyzed data in a file. This data would include the following information:

Image

The configuration of greppable statements would be in the following format:

services = [
    {
        'service_name': 'UCI API',
        'service_container': 'uci-api-service',
        'match_statements': {
            'BotServiceError': 'ERROR [BotService]',
            'DeviceAdded': 'Added device to registry',
            'ResolveUser': 'ServiceService::resolve: Resolving users'
        }
    },
    {
        'service_name': 'Broadcast Transformer',
        'service_container': 'docker-deploy-prod_broadcast-transformer_1',
        'match_statements': {
            'Kafka Push to outbound': 'Kafka::Send: Pushed to topic process-outbound',
            'Broadcast Processed': 'Notification processed by broadcast-transformer:',
        }
    },
]

Log Format Spec

This is the format that would be followed while creation of logs. This spec allows UCI-API to read data without communicating directly with the LogBase container.

Image

Endpoints

chinmoy12c commented 1 year ago

@karntrehan please review this

karntrehan commented 1 year ago

The logs would be segregated into separate daily files. This should be config driven. At a high load system I might need this hourly.

Log dump for a specific number of lines. What is the usecase for this?

The diagrams are helpful. Is log base going to be different layer altogether? Is it optional?

Overall this looks good!

chinmoy12c commented 1 year ago

The logs would be segregated into separate daily files. This should be config driven. At a high load system I might need this hourly.

Log dump for a specific number of lines. What is the usecase for this?

The diagrams are helpful. Is log base going to be different layer altogether? Is it optional?

Overall this looks good!

Yes, LogBase would be a separate service altogether which would be a simplistic and independent service. This is so that this component could also be used in other projects as an independent logger service.

aakashyadav-kgp commented 1 year ago

Dev done. Need to deploy and test on staging.

karntrehan commented 1 year ago

Awaiting some optimizations (https://github.com/samagra-comms/utils/issues/59) to be deployed before this goes out. Unit tests being written.