The Alert Service provides two main endpoints to interact with the alert system. This document outlines the details and usage of these endpoints.
- Group ID:
com.alert-service - Artifact ID:
demo - Version:
0.0.1-SNAPSHOT - Name:
demo - Description:
Alert project for Spring Boot - Java Version:
Java 17
- Group ID:
org.springframework.boot - Artifact ID:
spring-boot-starter-parent - Version:
2.7.16
- Endpoint:
/alerts - HTTP Method:
POST - Description: This endpoint allows you to add a new alert to the system.
{
"alertId": "string",
"serviceId": "string",
"serviceName": "string",
"model": "string",
"alertType": "string",
"severity": "string",
"teamSlack": "string",
"alertTs": "string"
}On successful insertion:
{
"alert_id": "string",
"error": ""
}- Endpoint:
/alerts - HTTP Method:
GET - Description: Retrieve alerts based on service ID and a timestamp range.
service_id: ID of the service.start_ts: Start timestamp (UNIX format).end_ts: End timestamp (UNIX format).
On successful retrieval:
{
"service_id": "string",
"alerts": [
{
"alert_id": "string",
... (other alert fields)
},
... (other alerts)
]
}On no alerts found:
{
"success": false,
"error": "No alerts found"
}- Application Properties
spring.jpa.show-sql=true
spring.datasource.url=jdbc:mysql://localhost:3306/alert-service-database
spring.datasource.username=alert-service
spring.datasource.password=dummypassword
spring.jpa.hibernate.ddl-auto=update
spring.jpa.properties.hibernate.dialec=org.hibernate.dialect.MySQLDialect- This Project deployed MySql on local Docker Eviroment, command line to create the database:
docker run --detach --env MYSQL_ROOT_PASSWORD=dummypassword --env MYSQL_USER=alert-service --env MYSQL_PASSWORD=dummypassword --env MYSQL_DATABASE=alert-service-database --name mysql --publish 3306:3306 mysql:8-oracleHibernate and JPA would create