Home

Awesome

<!-- ### Status: Testing going on for v1 release 🚀 --> <p align="center"> <img src="./static/assets/monigo-icon.png" width="200" title="Monigo Icon" alt="monigo-icon"/> </p>

MoniGo - Performance Monitoring for Go Applications

Go Report Card GoDoc License Visitors GitHub last commit <a href="https://www.producthunt.com/posts/monigo?embed=true&utm_source=badge-featured&utm_medium=badge&utm_souce=badge-monigo" target="_blank"><img src="https://api.producthunt.com/widgets/embed-image/v1/featured.svg?post_id=487815&theme=light" alt="MoniGO - Go&#0032;App&#0032;Performance&#0032;Dashboard&#0032;in&#0032;10&#0032;Seconds&#0032;with&#0032;R&#0045;T&#0032;Insight&#0033; | Product Hunt" style="width: 250px; height: 54px;" width="250" height="54" /></a>

<!-- [![Github All Releases](https://img.shields.io/github/downloads/iyashjayesh/monigo/total.svg)](https://GitHub.com/iyashjayesh/monigo/releases/) -->

MoniGo is a performance monitoring library for Go applications. It provides real-time insights into application performance with an intuitive user interface, enabling developers to track and optimize both service-level and function-level metrics.

<div align="center" style="display: flex; flex-wrap: wrap; gap: 10px; border: 2px solid #ccc; padding: 10px;"> <img src="./static/assets/ss/d1.png" alt="Dashboard" width="300"> <img src="./static/assets/ss/d10.png" alt="Dashboard" width="300"> <img src="./static/assets/ss/d2.png" alt="Dashboard" width="300"> <img src="./static/assets/ss/d7.png" alt="Dashboard" width="300"> <img src="./static/assets/ss/d8.png" alt="Dashboard" width="300"> <img src="./static/assets/ss/d3.png" alt="Dashboard" width="300"> <img src="./static/assets/ss/d4.png" alt="Dashboard" width="300"> <img src="./static/assets/ss/d5.png" alt="Dashboard" width="300"> <img src="./static/assets/ss/d6.png" alt="Dashboard" width="300"> <img src="./static/assets/ss/d9.png" alt="Dashboard" width="300"> </div>

Features

Installation

To install MoniGo, use the following command:

go get github.com/iyashjayesh/monigo@latest

Example:

package main

import (
    "github.com/iyashjayesh/monigo"
)

func main() {

	monigoInstance := &monigo.Monigo{
		ServiceName:             "data-api", // Mandatory field
		DashboardPort:           8080,       // Default is 8080
		DataPointsSyncFrequency: "5s",       // Default is 5 Minutes
		DataRetentionPeriod:     "4d",       // Default is 7 days. Supported values: "1h", "1d", "1w", "1m"
		TimeZone:                "Local",    // Default is Local timezone. Supported values: "Local", "UTC", "Asia/Kolkata", "America/New_York" etc. (https://en.wikipedia.org/wiki/List_of_tz_database_time_zones)
		// MaxCPUUsage:             90,         // Default is 95%
		// MaxMemoryUsage:          90,         // Default is 95%
		// MaxGoRoutines:           100,        // Default is 100
	}

   	monigo.TraceFunction(highCPUUsage) // Trace function, when the function is called, it will be traced and the metrics will be displayed on the dashboard

	go monigoInstance.Start() // Starting monigo dashboard
	log.Println("Monigo dashboard started at port 8080")

  	// Optional
	// routinesStats := monigoInstance.GetGoRoutinesStats() // Get go routines stats
	// log.Println(routinesStats)

  	select {} // To keep the program running
}

// highCPUUsage is a function that simulates high CPU usage
func highCPUUsage() {
	// Simulate high CPU usage by performing heavy computations
	var sum float64
	for i := 0; i < 1e8; i++ { // 100 million iterations
		sum += math.Sqrt(float64(i))
	}
}

For more detailed usage instructions, refer to the documentation. By default, the dashboard will be available at http://localhost:8080/ else at the port you have provided.

Note:

The monigo.TraceFunction(func()) method accept func(){} as a type.

Example Usage:

func apiHandler(w http.ResponseWriter, r *http.Request) {
    // Trace function: when the highMemoryUsage function is called, it will be traced.
    monigo.TraceFunction(highMemoryUsage)
    w.Write([]byte("API1 response: memexpensiveFunc"))
}

func highMemoryUsage() {
    // Simulate high memory usage by allocating a large slice
    largeSlice := make([]float64, 1e8) // 100 million elements
    for i := 0; i < len(largeSlice); i++ {
        largeSlice[i] = float64(i)
    }
}

Bellow Reports are available

Note: You can download the reports in excel format.

  1. Load Statistics: Provides an overview of the overall load of the service, CPU load, memory load, and system load.
Field NameValue (Datatype)
overall_load_of_servicefloat64
service_cpu_loadfloat64
service_memory_loadfloat64
system_cpu_loadfloat64
system_memory_loadfloat64
  1. CPU Statistics: Displays the total number of cores, cores used by the service, and cores used by the system.
Field NameValue (Datatype)
total_coresint
cores_used_by_serviceint
cores_used_by_systemint
  1. Memory Statistics: Shows the total system memory, memory used by the system, memory used by the service, available memory, GC pause duration, and stack memory usage.
Field NameValue (Datatype)
total_system_memoryfloat64
memory_used_by_systemfloat64
memory_used_by_servicefloat64
available_memoryfloat64
gc_pause_durationfloat64
stack_memory_usagefloat64
  1. Memory Profile: Provides information on heap allocation by the service, heap allocation by the system, total allocation by the service, and total memory by the OS.
Field NameValue (Datatype)
heap_alloc_by_servicefloat64
heap_alloc_by_systemfloat64
total_alloc_by_servicefloat64
total_memory_by_osfloat64
  1. Network IO: Displays the number of bytes sent and received.
Field NameValue (Datatype)
bytes_sentfloat64
bytes_receivedfloat64
  1. Health Metrics: Provides an overall health percentage for the service.
Field NameValue (Datatype)
service_health_percentfloat64
system_health_percentfloat64

API Reference

EndpointDescriptionMethodRequestResponseExample
/monigo/api/v1/metricsGet all metricsGETNoneJSONExample
/monigo/api/v1/go-routines-statsGet go routines statsGETNoneJSONExample
/monigo/api/v1/service-infoGet service infoGETNoneJSONExample
/monigo/api/v1/service-metricsGet service metricsPOSTJSON ExampleJSONExample
/monigo/api/v1/reportsGet history dataPOSTJSON ExampleJSONExample

Contributing

We welcome contributions! If you encounter any issues or have suggestions, please submit a pull request or open an issue.

If you find MoniGo useful, consider giving it a star! ⭐

Contact

For questions or feedback, please open an issue or contact me at iyashjayesh@gmail.com or at LinkedIn

Star History

Star History Chart

License

This project is licensed under the Apache 2.0 License - see the LICENSE file for details.