iyashjayesh / monigo

MoniGo is a performance monitoring library for Go apps, offering real-time insights into service-level and function-level metrics. With an intuitive UI, it enables developers to track and optimize performance. Get your Go app's dashboard up in just 10 seconds!
https://pkg.go.dev/github.com/iyashjayesh/monigo
Apache License 2.0
240 stars 10 forks source link

[Fixed] Minor bugs #11

Closed iyashjayesh closed 2 months ago

iyashjayesh commented 2 months ago

Update on Code Changes

After reviewing the feedback, it seems the default port change was missed during the code merge. Additionally, a minor enhancement has been added to the function trace logic.

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)
    }
}