Skip to content

Upgrading

If you are on a MoniGo release older than v1.3.0, the API has moved underneath you. This page lists what changed and what you have to edit.

Terminal window
go get github.com/iyashjayesh/monigo@latest
Older releasesCurrent
monigo.TraceFunction(fn)monigo.TraceFunction(ctx, fn)
monigo.TraceFunctionWithArgs(fn, args...)monigo.TraceFunctionWithArgs(ctx, fn, args...)
monigo.TraceFunctionWithReturn(fn, args...)monigo.TraceFunctionWithReturn(ctx, fn, args...)
monigo.TraceFunctionWithReturns(fn, args...)monigo.TraceFunctionWithReturns(ctx, fn, args...)
monigo.GetRuningPort()monigo.GetRunningPort()
api.ViewFunctionMaetrticsapi.ViewFunctionMetrics
Build() silent on errorsBuild() panics on invalid config
API accepts any HTTP methodAPI enforces GET/POST - wrong method returns 405
log.Printf loggingStructured logging via log/slog
Data purged on startupHistorical data preserved across restarts
http.DefaultServeMux used internallyDedicated http.ServeMux per instance

1. Add context.Context to All Tracing Calls

Section titled “1. Add context.Context to All Tracing Calls”

All TraceFunction* methods now require context.Context as the first argument:

monigo.TraceFunction(myFunc)
monigo.TraceFunction(ctx, myFunc)
monigo.TraceFunctionWithArgs(myFunc, arg1, arg2)
monigo.TraceFunctionWithArgs(ctx, myFunc, arg1, arg2)
monigo.TraceFunctionWithReturn(myFunc, arg1)
monigo.TraceFunctionWithReturn(ctx, myFunc, arg1)
func handler(w http.ResponseWriter, r *http.Request) {
monigo.TraceFunction(r.Context(), myFunc)
}
monigoInstance.GetRuningPort()
monigoInstance.GetRunningPort()

Build() now panics if ServiceName is not set or config is invalid (bad port, invalid storage type). Ensure your config is valid:

monigoInstance := monigo.NewBuilder().
WithServiceName("my-service"). // Required!
Build()

Replace any log.Printf tuning with structured logging:

monigoInstance := monigo.NewBuilder().
WithServiceName("my-service").
WithLogLevel(slog.LevelInfo). // or slog.LevelDebug, slog.LevelWarn
Build()

Current releases handle SIGINT/SIGTERM automatically when using Start(). For manual control:

if err := monigoInstance.Shutdown(ctx); err != nil {
log.Printf("shutdown error: %v", err)
}

The per-release detail lives on the changelog, generated from the library’s own CHANGELOG.md so it cannot drift from what was actually released.