// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: MIT-0 import React, {FunctionComponent, useEffect, useState} from 'react'; import {Container, Button, StatusIndicator} from "aws-northstar"; import Stack from "aws-northstar/layouts/Stack"; import '../home/styles.css'; import {IAppHealth, IAppReady, IAppReplication} from "../../interfaces"; import Grid from "aws-northstar/esm/layouts/Grid"; import { getAppHealth, getAppReady, getAppReplication, } from "../../data"; import Flashbar, {FlashbarMessage} from "aws-northstar/components/Flashbar"; import Alert from "aws-northstar/components/Alert"; const ApplicationMonitor: FunctionComponent = () => { const [appReady, setAppReady] = useState({}); const [appHealth, setAppHealth] = useState({}); const [appReplication, setAppReplication] = useState({}); const [errors, setErrors] = React.useState([]); const [message, setMessage] = React.useState(""); const renderMessage = () => { return (message == ""?
: setMessage("")} > {message} ); } const getAllRequests = async () => { try { getAppReady("trade-matching").then( (result: IAppReady) => { console.log("Received Result for getAppReady for Trade Matching:" + JSON.stringify(result)) setAppReady(result); }); getAppHealth().then( (result: IAppHealth) => { console.log("Received Result for getAppHealth for Trade Matching:" + JSON.stringify(result)) setAppHealth(result); }); getAppReplication("trade-matching").then( (result: IAppReplication) => { console.log("Received Result for getAppReplication for Trade Matching:" + JSON.stringify(result)) setAppReplication(result); }); } catch (err) { const items:FlashbarMessage[] = [ { header: 'Could not get the app state: ' + err.toString(), type: 'error', dismissible: true, } ]; setErrors(items); } } useEffect( () => { console.log("useEffect Called") getAllRequests().then(() => console.log("getAppState() completed.")); // const interval = setInterval(() => { // getAllRequests().then(() => console.log("getAppState() completed.")); // }, 3000); // return () => clearInterval(interval); }, []); const renderReady = (ready: any) => { return (ready == "READY"?:(ready == "NOT_READY"?:"?")); } const renderHealth = (health: any) => { return (health == "HEALTHY"?:(health == "UNHEALTHY"?:"?")); } const renderReplication = (replication: any) => { return (replication == "HEALTHY"?:(replication == "DELAYED"?:"?")); } return (
Trade Matching Application         
Primary (US East 1)
{/**/} {/* */} {/*
*/} {/* Route 53 Controls*/} {/*
*/} {/*
*/} {/* */} {/* */} {/*
Control: DNS
*/} {/*
*/} {/* */} {/*
Ready
*/} {/*
*/} {/* */} {/*
*/} {/*
*/} {/* */} {/*
Healthy
*/} {/*
*/} {/* */} {/*
*/} {/*
*/} {/*
*/} {/* */} {/* */} {/*
Control: Queue
*/} {/*
*/} {/* */} {/*
Ready
*/} {/*
*/} {/* */} {/*
*/} {/*
*/} {/* */} {/*
Healthy
*/} {/*
*/} {/* */} {/*
*/} {/*
*/} {/*
*/} {/* */} {/* */} {/*
Control: App
*/} {/*
*/} {/* */} {/*
Ready
*/} {/*
*/} {/* */} {/*
*/} {/*
*/} {/* */} {/*
Healthy
*/} {/*
*/} {/* */} {/*
*/} {/*
*/} {/*
*/} {/*
*/} {/*
*/} {/*
*/} {/**/} {/**/}
Inbound Gateway
Amazon MQ: Trades
Ready
NA
Healthy
{renderHealth(appHealth.mq)}
Replication
NA
Amazon MQ: Settlements
Ready
NA
Healthy
{renderHealth(appHealth.mq)}
Replication
NA
DynamoDB: Trades
Ready
{renderReady(appReady.inbound_dynamodb_trade)}
Healthy
{renderHealth(appHealth.dynamodb)}
Replication
{renderReplication(appReplication.inbound_dynamodb_trade)}
DynamoDB: Settlements
Ready
{renderReady(appReady.inbound_dynamodb_settlement)}
Healthy
{renderHealth(appHealth.dynamodb)}
Replication
{renderReplication(appReplication.inbound_dynamodb_settlement)}
ECS Containers
Ready
{renderReady(appReady.inbound_ecs_primary)}
Healthy
{renderHealth(appHealth.ecs)}
Replication
NA
Ingestion
Kinesis: Trades
Ready
NA
Healthy
{renderHealth(appHealth.kinesis)}
Replication
NA
Kinesis: Settlements
Ready
NA
Healthy
{renderHealth(appHealth.kinesis)}
Replication
NA
DynamoDB: Trades
Ready
{renderReady(appReady.ingestion_dynamodb_trade)}
Healthy
{renderHealth(appHealth.dynamodb)}
Replication
{renderReplication(appReplication.ingestion_dynamodb_trade)}
DynamoDB: Settlements
Ready
{renderReady(appReady.ingestion_dynamodb_settlement)}
Healthy
{renderHealth(appHealth.dynamodb)}
Replication
{renderReplication(appReplication.ingestion_dynamodb_settlement)}
ECS Containers
Ready
{renderReady(appReady.ingestion_ecs_primary)}
Healthy
{renderHealth(appHealth.ecs)}
Replication
NA
Matching
Kinesis: Trades
Ready
NA
Healthy
{renderHealth(appHealth.kinesis)}
Replication
NA
Kinesis: Settlements
Ready
NA
Healthy
{renderHealth(appHealth.kinesis)}
Replication
NA
RDS
Ready
{renderReady(appReady.matching_rds)}
Healthy
{renderHealth(appHealth.rds)}
Replication
{renderReplication(appReplication.matching_rds)}
ECS Containers: Ingestion
Ready
{renderReady(appReady.matching_ecs_ingestion_primary)}
Healthy
{renderHealth(appHealth.ecs)}
Replication
NA
ECS Containers: Matching
Ready
{renderReady(appReady.matching_ecs_matching_primary)}
Healthy
{renderHealth(appHealth.ecs)}
Replication
NA
Egress
Kinesis: Trades
Ready
NA
Healthy
{renderHealth(appHealth.kinesis)}
Replication
NA
Kinesis: Settlements
Ready
NA
Healthy
{renderHealth(appHealth.kinesis)}
Replication
NA
DynamoDB: Trades
Ready
{renderReady(appReady.egress_dynamodb_trade)}
Healthy
{renderHealth(appHealth.dynamodb)}
Replication
{renderReplication(appReplication.egress_dynamodb_trade)}
DynamoDB: Settlements
Ready
{renderReady(appReady.egress_dynamodb_settlement)}
Healthy
{renderHealth(appHealth.dynamodb)}
Replication
{renderReplication(appReplication.egress_dynamodb_settlement)}
ECS Containers
Ready
{renderReady(appReady.egress_ecs_primary)}
Healthy
{renderHealth(appHealth.ecs)}
Replication
NA
Outbound Gateway
Kinesis: Trades
Ready
NA
Healthy
{renderHealth(appHealth.kinesis)}
Replication
NA
Kinesis: Settlements
Ready
NA
Healthy
{renderHealth(appHealth.kinesis)}
Replication
NA
DynamoDB: Trades
Ready
{renderReady(appReady.outbound_dynamodb_trade)}
Healthy
{renderHealth(appHealth.dynamodb)}
Replication
{renderReplication(appReplication.outbound_dynamodb_trade)}
DynamoDB: Settlements
Ready
{renderReady(appReady.outbound_dynamodb_settlement)}
Healthy
{renderHealth(appHealth.dynamodb)}
Replication
{renderReplication(appReplication.outbound_dynamodb_settlement)}
ECS Containers
Ready
{renderReady(appReady.outbound_ecs_primary)}
Healthy
{renderHealth(appHealth.ecs)}
Replication
NA
Amazon MQ: Trades
Ready
NA
Healthy
{renderHealth(appHealth.mq)}
Replication
NA
Amazon MQ: Settlements
Ready
NA
Healthy
{renderHealth(appHealth.mq)}
Replication
NA
Secondary (US West 2)
{/**/} {/* */} {/*
*/} {/* Route 53 Controls*/} {/*
*/} {/*
*/} {/* */} {/* */} {/*
Control: DNS
*/} {/*
*/} {/* */} {/*
Ready
*/} {/*
*/} {/* */} {/*
*/} {/*
*/} {/* */} {/*
Healthy
*/} {/*
*/} {/* */} {/*
*/} {/*
*/} {/*
*/} {/* */} {/* */} {/*
Control: Queue
*/} {/*
*/} {/* */} {/*
Ready
*/} {/*
*/} {/* */} {/*
*/} {/*
*/} {/* */} {/*
Healthy
*/} {/*
*/} {/* */} {/*
*/} {/*
*/} {/*
*/} {/* */} {/* */} {/*
Control: App
*/} {/*
*/} {/* */} {/*
Ready
*/} {/*
*/} {/* */} {/*
*/} {/*
*/} {/* */} {/*
Healthy
*/} {/*
*/} {/* */} {/*
*/} {/*
*/} {/*
*/} {/*
*/} {/*
*/} {/*
*/} {/**/} {/**/}
Inbound Gateway
Amazon MQ: Trades
Ready
NA
Healthy
{renderHealth(appHealth.mq)}
Replication
NA
Amazon MQ: Settlements
Ready
NA
Healthy
{renderHealth(appHealth.mq)}
Replication
NA
DynamoDB: Trades
Ready
{renderReady(appReady.inbound_dynamodb_trade)}
Healthy
{renderHealth(appHealth.dynamodb)}
Replication
{renderReplication(appReplication.inbound_dynamodb_trade)}
DynamoDB: Settlements
Ready
{renderReady(appReady.inbound_dynamodb_settlement)}
Healthy
{renderHealth(appHealth.dynamodb)}
Replication
{renderReplication(appReplication.inbound_dynamodb_settlement)}
ECS Containers
Ready
{renderReady(appReady.inbound_ecs_secondary)}
Healthy
{renderHealth(appHealth.ecs)}
Replication
NA
Ingestion
Kinesis: Trades
Ready
NA
Healthy
{renderHealth(appHealth.kinesis)}
Replication
NA
Kinesis: Settlements
Ready
NA
Healthy
{renderHealth(appHealth.kinesis)}
Replication
NA
DynamoDB: Trades
Ready
{renderReady(appReady.ingestion_dynamodb_trade)}
Healthy
{renderHealth(appHealth.dynamodb)}
Replication
{renderReplication(appReplication.ingestion_dynamodb_trade)}
DynamoDB: Settlements
Ready
{renderReady(appReady.ingestion_dynamodb_settlement)}
Healthy
{renderHealth(appHealth.dynamodb)}
Replication
{renderReplication(appReplication.ingestion_dynamodb_settlement)}
ECS Containers
Ready
{renderReady(appReady.ingestion_ecs_secondary)}
Healthy
{renderHealth(appHealth.ecs)}
Replication
NA
Matching
Kinesis: Trades
Ready
NA
Healthy
{renderHealth(appHealth.kinesis)}
Replication
NA
Kinesis: Settlements
Ready
NA
Healthy
{renderHealth(appHealth.kinesis)}
Replication
NA
RDS
Ready
{renderReady(appReady.matching_rds)}
Healthy
{renderHealth(appHealth.rds)}
Replication
{renderReplication(appReplication.matching_rds)}
ECS Containers: Ingestion
Ready
{renderReady(appReady.matching_ecs_ingestion_secondary)}
Healthy
{renderHealth(appHealth.ecs)}
Replication
NA
ECS Containers: Matching
Ready
{renderReady(appReady.matching_ecs_matching_secondary)}
Healthy
{renderHealth(appHealth.ecs)}
Replication
NA
Egress
Kinesis: Trades
Ready
NA
Healthy
{renderHealth(appHealth.kinesis)}
Replication
NA
Kinesis: Settlements
Ready
NA
Healthy
{renderHealth(appHealth.kinesis)}
Replication
NA
DynamoDB: Trades
Ready
{renderReady(appReady.egress_dynamodb_trade)}
Healthy
{renderHealth(appHealth.dynamodb)}
Replication
{renderReplication(appReplication.egress_dynamodb_trade)}
DynamoDB: Settlements
Ready
{renderReady(appReady.egress_dynamodb_settlement)}
Healthy
{renderHealth(appHealth.dynamodb)}
Replication
{renderReplication(appReplication.egress_dynamodb_settlement)}
ECS Containers
Ready
{renderReady(appReady.egress_ecs_secondary)}
Healthy
{renderHealth(appHealth.ecs)}
Replication
NA
Outbound Gateway
Kinesis: Trades
Ready
NA
Healthy
{renderHealth(appHealth.kinesis)}
Replication
NA
Kinesis: Settlements
Ready
NA
Healthy
{renderHealth(appHealth.kinesis)}
Replication
NA
DynamoDB: Trades
Ready
{renderReady(appReady.outbound_dynamodb_trade)}
Healthy
{renderHealth(appHealth.dynamodb)}
Replication
{renderReplication(appReplication.outbound_dynamodb_trade)}
DynamoDB: Settlements
Ready
{renderReady(appReady.outbound_dynamodb_settlement)}
Healthy
{renderHealth(appHealth.dynamodb)}
Replication
{renderReplication(appReplication.outbound_dynamodb_settlement)}
ECS Containers
Ready
{renderReady(appReady.outbound_ecs_secondary)}
Healthy
{renderHealth(appHealth.ecs)}
Replication
NA
Amazon MQ: Trades
Ready
NA
Healthy
{renderHealth(appHealth.mq)}
Replication
NA
Amazon MQ: Settlements
Ready
NA
Healthy
{renderHealth(appHealth.mq)}
Replication
NA
{renderMessage()}
); } export default ApplicationMonitor;