Skip to content

devopsfaith/krakend-memviz

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

krakend-memviz

Memviz exporter middleware for the KrakenD framework

Master Caution: running this module in production will kill your performance!!!

Usage

Add the ProxyFactory and BackendFactory functions in your factory stack as showed in the example:

// memviz backend proxy wrapper
bf := memviz.BackendFactory(logger, proxy.CustomHTTPProxyFactory(proxy.NewHTTPClient), *output)
// memviz proxy wrapper
pf := memviz.ProxyFactory(logger, proxy.NewDefaultFactory(bf, logger), *output)

routerFactory := krakendgin.NewFactory(krakendgin.Config{
	Engine:         gin.Default(),
	ProxyFactory:   pf,
	Logger:         logger,
	HandlerFactory: krakendgin.EndpointHandler,
})

routerFactory.NewWithContext(ctx).Run(serviceConfig)

After sending a testing request, you should see some activity in the logs:

[KRAKEND] DEBUG: memviz: request captured
[KRAKEND] DEBUG: memviz: request captured
[KRAKEND] DEBUG: memviz: request captured
[KRAKEND] DEBUG: proxy executed
[KRAKEND] DEBUG: rmemviz: response captured. returning
[KRAKEND] DEBUG: proxy executed
[KRAKEND] DEBUG: rmemviz: response captured. returning
[KRAKEND] DEBUG: proxy executed
[KRAKEND] DEBUG: rmemviz: response captured. returning

With enough samples, stop the KrakenD and process the .dot files generated by the module:

$ for i in *.dot ; do dot -Tpng -o "$i".png < "$i" ; done

About

Memviz exporter middleware for the KrakenD framework

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages