Tuesday, July 15, 2025

⚓ Kanhoji: Real-Time Monitoring – The Guardian of Fraud-Free Swarajya


“The sea is no one’s property. But its protector, I shall be.”
— Kanhoji Angre, Admiral of the Maratha Navy


๐ŸŒŠ Why I Named Our Monitoring Module kanhoji

Every great kingdom needs a vigilant guardian — someone who spots threats before they reach the shore. In the Swarajya movement, that role was embodied by Kanhoji Angre, the legendary admiral of the Maratha Navy.

  • Kanhoji wasn’t just a warrior — he was a master strategist.
  • He intercepted enemy ships, anticipated surprise attacks, and built naval intelligence networks.
  • He knew that if you wait until a breach happens, it’s already too late.

In our modern-day microservices architecture, that role belongs to real-time monitoring. Thus, I named our observability module kanhoji — a tribute to the admiral who kept the empire safe with foresight and maritime mastery.

๐Ÿ“ˆ What kanhoji (Monitoring) Does in Our System

In the context of our AI-powered fraud detection platform, kanhoji is responsible for:

  • Keeping an eye on service health
  • Monitoring response times, error rates, and traffic patterns
  • Exposing custom metrics (e.g. fraud score thresholds)
  • Powering a Grafana dashboard for real-time visibility

Just like Kanhoji Angre kept Aurangzeb’s navy in check, our monitoring module makes sure fraud doesn’t creep in through hidden blind spots.

๐Ÿ”ง The Tech Behind It

ComponentRole
PrometheusPull-based metrics scraping and time series storage
GrafanaBeautiful dashboards for real-time data
MicrometerJava metrics facade for Spring Boot
Spring ActuatorAuto-exposes HTTP metrics (count, latency, status)

I integrated kanhoji into our existing services (sindhudurg, tanaji) with minimal overhead and maximum insight.

๐Ÿ“Š Our Dashboard in Action

I track metrics like:

  • ๐Ÿ“‰ http_server_requests_seconds_count – endpoint latency
  • ๐Ÿงช status="500" – internal server errors
  • ๐Ÿ” jvm_memory_used_bytes – memory health
  • ๐Ÿง  Coming soon – fraud-related custom metrics

I even tried to write a Python traffic simulator to test the dashboard in action! :) a little fun. 

๐Ÿง  Why Monitoring Matters in Fraud Detection

Fraud isn’t always loud. Sometimes it comes as:

  • A slow buildup of failed transactions
  • An AI model that’s taking too long to respond
  • Unusual traffic patterns on specific endpoints

Without observability, we’d be flying blind. Kanhoji gives us:

  • ⏱️ Early warnings
  • ๐Ÿงฏ Quick troubleshooting
  • ๐Ÿ” Root cause clarity

⚓ Kanhoji Angre: The Real Legend

Before we end, let’s celebrate the namesake:

  • ๐ŸŒŠ Known as the “Shivaji of the Sea”
  • ๐Ÿ‡ฎ๐Ÿ‡ณ Never defeated by British, Portuguese, or Dutch fleets
  • ⚔️ Ran a full naval intelligence network from Kolaba Fort
  • ๐Ÿšข Used small, agile ships to outsmart colonial navies — like microservices!

๐Ÿ›ก️ What’s Next?

  • Expose Redis and Rule Engine metrics
  • Enable alerts for fraud score spikes
  • Track rule overrides and fraud trends in real time

If Tanaji is the warrior, and Dadoji the wise council, then Kanhoji is the watchtower.
Every system needs one.

๐Ÿ“– Explore the Code

๐Ÿ”— GitHub: github.com/pcm1984/fraud-free-swarajya

๐Ÿ“Š For dashboard JSON and usage instructions: Kanhoji Monitoring README

No comments:

Post a Comment