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.
go get github.com/iyashjayesh/monigo@latestBreaking changes
Section titled “Breaking changes”| Older releases | Current |
|---|---|
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.ViewFunctionMaetrtics | api.ViewFunctionMetrics |
Build() silent on errors | Build() panics on invalid config |
| API accepts any HTTP method | API enforces GET/POST - wrong method returns 405 |
log.Printf logging | Structured logging via log/slog |
| Data purged on startup | Historical data preserved across restarts |
http.DefaultServeMux used internally | Dedicated http.ServeMux per instance |
Quick Migration Steps
Section titled “Quick Migration Steps”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)2. Use r.Context() in HTTP Handlers
Section titled “2. Use r.Context() in HTTP Handlers”func handler(w http.ResponseWriter, r *http.Request) { monigo.TraceFunction(r.Context(), myFunc)}3. Rename Typo Fixes
Section titled “3. Rename Typo Fixes”monigoInstance.GetRuningPort()monigoInstance.GetRunningPort()4. Handle Build() Panics
Section titled “4. Handle Build() Panics”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()5. Update Logging Configuration
Section titled “5. Update Logging Configuration”Replace any log.Printf tuning with structured logging:
monigoInstance := monigo.NewBuilder(). WithServiceName("my-service"). WithLogLevel(slog.LevelInfo). // or slog.LevelDebug, slog.LevelWarn Build()6. Add Graceful Shutdown
Section titled “6. Add Graceful Shutdown”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)}Everything that changed
Section titled “Everything that changed”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.