Posts

Showing posts from March, 2022

Instrumenting Any Application for Custom metric using Prometheus.

Image
  Today we will be learning how to add monitoring support to our Go application. Before starting we will learn more about Prometheus. What is Prometheus? Prometheus  is an open-source system monitoring and alerting tool. Prometheus collects and stores its metrics as time-series data, i.e. metrics information is stored with the timestamp at which it was recorded, alongside optional key-value pairs called labels. Now we have some idea about what Prometheus is !! Let’s start the implementation. Installing Prometheus libraries. Run the below commands to install Prometheus libraries. go get github.com/prometheus/client_golang/prometheus go get github.com/prometheus/client_golang/prometheus/promauto go get github.com/prometheus/client_golang/prometheus/promhttp 2. Writing the Go application. We will implement Prometheus libraries in our Go code. To expose Prometheus metrics, We need to provide a  /metrics  HTTP endpoint. We will use  promhttp  as the handler func...

Loki, Grafana, and Promtail integration using Docker

Image
  Promtail-Loki-Grafana is an end-to-end logging solution for fetching logs to be visualized at a centralized location.  Before moving into the integration of the services we will start by understanding the role of each component. Promtail Promtail is an agent that ships the contents of local logs to a private Grafana Loki instance or Grafana Cloud . It is usually deployed to every machine that has applications needed to be monitored. It primarily Discovers targets Attaches labels to log streams Pushes them to the Loki instance. Loki Loki is a horizontally scalable, highly available, multi-tenant log aggregation system inspired by Prometheus. It is designed to be very cost-effective and easy to operate. It does not index the contents of the logs, but rather a set of labels for each log stream. Grafana Grafana is multi-platform open-source analytics and interactive visualization web application. It provides charts, graphs, and alerts for the web when connected to supported data...

Connecting Robo 3T with DocumentDB outside AWS VPC

Image
  This blog shows how you can connect DocumentDB with Robo3T outside of AWS VPC. Prerequisites AWS Account DocumentDB Cluster VPC Robo 3T installed on the local machine Overview We will be using the EC2 instance to create a tunnel between our local machine and DocumentDB. The EC2 and DocumentDB must be in the same VPC and we must make sure that the security group for DocumentDB must have EC2 instance security group or IP in the inbound rule. This will give access of DocumentDB to the EC2 instance. Add the inbound rule to EC2 as per your setup so that the local machine can access the EC2. If you are new, you can open the EC2 access to all protocols with source as 0.0.0.0/0(this allows any user to access the EC2) in the inbound rules of the EC2’s security group. Steps to Connect Open Robo 3T and choose to Create. 2. On the Connection tab, in the Address field, enter the cluster endpoint, Port as 27017, and give a name to the connection. you can use this  link  to find the e...