visgin

package module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 5, 2026 License: MIT Imports: 3 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package visgin connects vis to gin: every request carries a snapshot of the knobs and is timed under its route pattern, as with vis.HTTP. It is its own module, so vis itself never depends on gin.

r := gin.Default()
r.Use(visgin.Middleware())
r.POST("/api/generate", func(c *gin.Context) {
	n := MaxLoaded.From(c.Request.Context())
	…
})

A // vis:slo directive above a handler registered this way names its route as the middleware does, "POST /api/generate", and vis gen finds it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Middleware

func Middleware() gin.HandlerFunc

Middleware is MiddlewareIn for the default instance, the one vis.Start serves.

func MiddlewareIn

func MiddlewareIn(in *vis.Instance) gin.HandlerFunc

MiddlewareIn puts a snapshot of in's knobs in each request's context and times the request under "METHOD /route/:pattern", the way gin's FullPath names it. Requests gin can't route count under one route, so paths never become routes. Use it after gin.Recovery, as gin.Default has it, so a panic counts as the 500 Recovery sends.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL