AMS: Data Collection Service

Introduction

This is the second article in my Application Monitoring System (AMS) series where I am building an open source application to monitor performances of other applications. In this post, I will be discussing about the second component, the Data Collection Service.

Data Collection Service

The Data Collection Service is a Spring Boot application written in Java. As the name suggests, it is the collector component of our Application Monitoring System and it has the ability to pull metrics data from various source systems and send to various destination systems.

[Read more]

How to call Spring MongoRepository from an ExecutorService

The problem

Recently I encountered an issue in code when I tried to call the Spring MongoRepository from a non-Spring-managed thread in a Java Spring Boot application. Here is a brief description of the issue.

The Repository interface

public interface ResponseRepository extends MongoRepository<Response, String> {

}

It’s a standard Spring Repository interface without any custom methods.

The calling class

@Component //A Spring Component
public class AnImaginaryComponent {

    @Autowired
    private ResponseRepository responseRepo;

    public void saveResponseInANewThread(Response r) {
        //Create an Executor service
        ExecutorService executor = Executors.newSingleThreadExecutor();

        //Submit a Runnable instance
        executor.submit(() -> responseRepo.save(r));
    }
}

When anImaginaryComponent.saveResponseInANewThread(r) is invoked, it never saves the r Response into the database. And the worst part is that it doesn’t throw any exceptions or print any log messages for the failure.

[Read more]

Getting started with Kubernetes using Minikube - Installation

Introduction

I am working on a series of opinionated posts on how to get started with the basics of Kubernetes using Minikube. In these posts, I will discuss on a range of topics starting from the installation of Minikube to the deployment of pods and also workarounds for a few annoying issues I faced along the way. This is the first article of the series where I talk about how to install Minikube in your local computer.

[Read more]

AMS: Data Provider Service - Generating performance metrics with Spring Boot Actuator

Introduction

This is the first article in a series of upcoming articles on designing and creating an Application Monitoring System. An Application Monitoring System (AMS) is a system that can monitor performance of other running applications. I am building this application component by component from scratch and I will publish it here on this blog. In this post, I talk about how to create and run services that provide application performance metrics using Java, Spring Boot and Docker.

[Read more]

Requesting dark mode to websites on Firefox

Introduction

Most mainstream web-browsers including Firefox now-a-days come with a feature where your browser sends your preferred colorshemes to websites when you visit them. If the website supports this feature, then you are presented with a light or dark version of the website based on your preference. In this post I will share how to manually configure it in Firefox.

prefers-color-scheme

prefers-color-scheme is a CSS feature that can be used by websites to detect if the browser has requested a light or a dark color theme. And if your browser sends the preference of dark theme and if a visited website chooses to implement an alternate dark CSS colorsheme then the web content will be displayed in dark mode. Here are the allowed values for prefers-color-scheme:

[Read more]