vis: Observability That Lives in Your Go Binary, With a Way Back In
Instrumentation inside a service is mostly one way: signals go out to a platform, and acting on them happens somewhere else. vis is a Go library that keeps a live dashboard, SLOs and bounded runtime knobs inside the service itself, for the person on call and for the agent.
Go ships with a lot of tooling around its build system and its runtime. runtime/metrics reports what the scheduler and the garbage collector are doing. pprof profiles a running process. debug/buildinfo says what a binary was built from. go/analysis and go generate let a library check and write code at build time.
I wanted to see if those parts are enough to make a Go service observable from the inside. Self-contained in the executable, without marrying an observability platform to get there.
The second thing that bugged me is that the tooling we have is mostly read-only. OpenTelemetry and the other probes push metrics and signals out to a platform, and that’s where the story ends. You look at a dashboard, you understand something, and then you go change the service some other way: a config push, a redeploy, a feature flag in yet another system. There is no feedback loop.
So the question became: can the service itself tell you how it behaves, where it slows down or degrades, and also let you tweak and fix it while it runs? Regardless of where it runs. And given where software is heading, the one asking might be a person looking at a dashboard, or an agent on call.
That’s vis.
Two lines to see it#
The first step asks for nothing to design: two lines, vis.Start to start vis and vis.HTTP(mux) to wrap your mux.
mux := http.NewServeMux()
mux.HandleFunc("GET /hello", func(w http.ResponseWriter, r *http.Request) { w.Write([]byte("hello")) })
ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM)
defer stop()
if err := vis.Start(ctx, vis.Service("myservice")); err != nil {
log.Fatal(err)
}
defer vis.Stop()
srv := &http.Server{Addr: ":8080", Handler: vis.HTTP(mux)}
go srv.ListenAndServe()
<-ctx.Done()
srv.Shutdown(context.Background())Run it and open http://localhost:7071. There is no collector, no exporter and no account anywhere. The dashboard is served by the process it describes, and it shows the p99 of every route over the last hour, CPU and throttling, the scheduler and the GC, memory, and why the last process died if one did.

The routes of an image service under simulated load. Requests no route matched get a row too, so they don’t disappear.
gin and echo get their own middleware, so routes are named the way the router names them.
Where it slows down, and where the memory went#
Latency is judged against an objective once you declare one, as a comment above the handler:
mux.HandleFunc("GET /images/{id}", p.serveImage)
// vis:slo p99=500ms
func (p *Proxy) serveImage(w http.ResponseWriter, r *http.Request) { ... }You don’t name the route. The middleware times each request under the route the router matched, and vis gen finds which route the handler is registered under. With the objective, the headline says “All good.” or which route is over its SLO, the latency chart draws the objective, and every change is judged by what it did to that route.

The same service a minute into a slowdown. quality_backoff has stepped jpeg_quality from 95 to 90 and holds it under a 10 minute lease. It kept stepping until p99 was back under 400 ms.
Most Go services don’t set GOMEMLIMIT, and Go doesn’t set it from a container’s limit. So by default (GOGC=100), Go’s garbage collector lets the heap grow to about twice what the program keeps before it collects. That makes memory hard to read. A heap profile can say 184 MiB in use while the container holds 379, because the profile counts only what the program keeps. The garbage the GC hasn’t collected yet, and the memory the Go runtime holds for itself, aren’t in it.
vis draws the memory against the limit, and forecasts when it gets there: at the rate memory is growing now, a dotted line runs from now to where it meets the limit.
Next to it, the live heap is drawn as a waffle of the limit:
It isn’t tied to containers. In a cgroup (a container, a Kubernetes pod, a systemd unit with MemoryMax) it reads the cgroup. Outside one it reads what the Go runtime holds, and the limit is the platform’s memory size where vis can read it (AWS Lambda’s, today) or GOMEMLIMIT. With no limit at all, you still get the memory and the live heap, just no forecast of when it runs out.
A process killed for memory gets no chance to say so. So vis keeps a short note of its last readings, written every couple of seconds to the temp dir (on Kubernetes, point VIS_STATE_DIR at an emptyDir; in a fleet, its peers keep the readings too). When a process dies without stopping cleanly, the one that replaces it reads the note and tells you on the dashboard: “most likely killed for memory”, its last reading, and the values set at runtime that the restart dropped.
Tweak and fix while it runs#
A knob is a setting you declare as changeable at runtime, within a range. The declarations are comments that vis’s tool turns into code, so add the tool to your module once:
go get -tool github.com/tfcace/vis/cmd/vis
//go:generate go tool vis gen
// vis:knob range=1..16384 default=100 unit=MB uses=memory pull=agent
var CacheSize vis.Int // Memory for cached images.
// vis:knob range=1..100 default=95 uses=cpu pull=agent,rule
// vis:rule name=quality_backoff when="slo.p99 > 400ms" for=30s do=step(-5) cooldown=30s lease=10m
var JPEGQuality vis.Int // JPEG quality of resized images.
// vis:knob pull=agent
var Logging vis.LogLevel // What the service logs.A log level is a knob too. vis.LogLevel is a slog.Leveler, so giving it to the handler (slog.HandlerOptions{Level: Logging}) is all the wiring it needs.
The rule watches slo.p99, the objective declared by the // vis:slo above, so it lives in the same package. go generate turns the comments into ordinary Go in a vis_gen.go you check in, and go tool vis vet catches the mistakes that compile but are wrong. The declaration is reviewed code: the range, the default and who may change it (pull=agent) don’t change at runtime. Only the value does.
Every change to a value is bounded by that range, carries a lease so it ends on its own, and goes to an audit trail with who made it and why. A change sits on a layer (a person’s pin, a rule, an agent, a fleet rollout), so a person’s value wins over an agent’s, and removing one falls back to the layer below. A freeze stops every automated change with one click, and says who froze it and why.

Turning logging up to DEBUG on the dashboard. Before anything changes, the plan says what will hold and for how long, and shows the same change as an agent would send it.
And then the loop closes. About 30 seconds after a change, vis reports what it did: the route’s p99 before and after, CPU, memory, the service’s own signals, and anything else that changed in the same window that might be the real cause. That’s the part I missed in every one-way setup. The answer to “did that help?” comes from the same place the change went to.

Every change gets measured, the rule’s and the person’s. The rule’s first step took p99 from 705 to 638 ms. DEBUG logging made no difference to this route’s p99.
For a person, and for an agent#
The dashboard is for the person on call. The same state is served over MCP for an agent, at http://127.0.0.1:7070 (localhost only by default, like the dashboard). Its tools are describe, metrics, profile, history, impact, set_knob, revert and a few more. Without tokens it’s read-only, and an agent can only act with a token granted to act:
VIS_TOKENS=s3cret=agent:oncall:act go run .
The token s3cret makes whoever sends it an agent named oncall, which may act. Every change it makes is recorded as agent:oncall, and dropping :act makes the token read-only.
I didn’t want two products here. A change an agent makes shows up on the dashboard with its reason, its lease and its measured effect, the same as one made by a person.
How I checked it was any good#
I could have convinced myself of anything with a demo, so most of the work went into testing vis on services and seeing where it broke. Four services, each testing something different:
- cacheproxy is a small HTTP cache Claude wrote for vis, with faults I can inject. It’s where the on-call evals run: an agent gets paged with nothing but “the container restarted”, vis’s MCP tools and the service’s source, and is scored on what it does and on what happens after. It’s also where control got designed. Rules judged by the objective, steps by a percent of the value, and impact reports all came out of those evals.
- imageproxy (willnorris/imageproxy) tested adoption. An agent gets the service and
go docfor vis, and nothing else. In the first scored round none of the 3 agent runs adopted it cleanly, and they found two things vis got wrong: the guide’s ownmainignored Ctrl-C and SIGTERM, and a knob had no way to say its 0 means none. After the fixes all 3 runs were clean, about a minute each. - Ollama is a fork I adopted vis into from the outside, and it found what adoption needs that cacheproxy never could: a Go version a real service already has, gin routes, configuration from environment variables, a port another vis already holds, and a dashboard that tells the truth before anything is declared. It’s also the showcase video: two lines, a few comments, a log level changed while Ollama runs, and an agent on call that raises
max_loaded_modelsunder a lease until p99 on generate comes back under 300 ms. - of-watchdog (openfaas/of-watchdog) is a service none of the guide was written from. All 3 agent runs adopted it cleanly. Every agent made its concurrency cap a knob by writing a small limiter that reads it per request, which is also why vis doesn’t ship its own limiter yet.
The on-call evals are where I learned the most, mostly by being wrong. On an early build, an agent read a heap profile, saw 214 MiB in use with the container near its memory limit, and concluded the cache didn’t respect its size. It reverted its own fix and left the service in a crash loop. Another one called the service stable until its lease ended, and it was killed 77 seconds later. Each of those became something vis now says plainly: the forecast to the limit, the gap between the heap and the container, the value a restart dropped.
What it won’t do#
It doesn’t replace OpenTelemetry. If your team already runs a metrics stack, vis is a second place to look for now. An opt-in Prometheus export is on the list, once someone asks for it.
Runtime values are volatile on purpose. A value set while the service runs ends with its lease, and a restart drops it. The one exception is a value its writer asks to keep: vis sets it back after a restart for what is left of its lease, unless it’s what kills the fresh process. Making a value permanent means changing the default in code. Closing that loop too, turning the values that held into pull requests that change the default, and production profiles into PGO builds, is on the backlog.
The dashboard has no login. It listens on localhost, and you reach it from another machine through SSH or kubectl port-forward.
It’s Go only. The fleet support (members that gossip, compare and roll a change out in stages) works, but I’m calling it experimental. Code weaving, where vis inserts its hooks at build time instead of you running go generate, is still on the roadmap.
Try it#
vis is MIT licensed, at github.com/tfcace/vis. The README’s first example is the one above.
What I can’t test on my own is the part that matters most: a team I don’t know putting it on a service I’ve never seen, and still using it a couple of weeks later. If you run a Go service, and especially one without a metrics stack of its own, I’d love for you to try it. Tell me what broke, what you expected it to say and it didn’t, or that it just worked. If there’s anything I can do to help you get started, please let me know.