Improving Error Logging

While I completed the first version of the new error logging system late last week, we decided to improve it a bit. It’s going to also show logs for our “heartbeats” for each container. Heartbeats are a container pinging the rest to make sure their processes haven’t hung. AWS’s ECS (EC2 Container Service) is able to make sure that if the whole container crashes, it’s restarted. But it isn’t able to tell when the app inside simply hangs instead of completely exiting with an error exit code. So the heartbeat is a GET request send to the app running in the container. They’re sent every 10 seconds, and if they don’t get a response, the ECS task (which provides instructions for booting up all the containers) is restarted.

Having the ability to see the results of these heartbeats in one spot can allow us to quickly check the health of the containers without having to completely log into the AWS management console. Any Engineering.com staff using the VAT would have the ability to see this information easily too.

Integrating this functionality means I need to understand how each of the technologies comes into play with each other. I need to learn how to use Dygraphs (the JavaScript library we use for graphs) with React, which involves thinking carefully about how to render the graph (ex. it has to occur after the React component has finished rendering), and I have to integrate this feature with our existing features in our app which is now architected using Redux. Redux does make this kind of thing easier than before I think. Because the React components don’t manage their own state, and state is always in one exact spot, you can safely add features without worrying about what your added state is going to do to the application… *It won’t do anything except what your new feature does.*

I’ve definitely seen the power of functional programming and architectural patterns like Flux (of which Redux is an implementation) and I plan to use them in my other projects after this CDOT project.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s