Skip to content
Snippets Groups Projects
user avatar
Will McCutchen authored
This is a very small improvement to developer ergonomics.
95fdb991
History
Name Last commit Last update
..
README.md
go.mod
go.sum
main.go

Custom Instrumentation

This example demonstrates how to use go-httpbin's Observer mechanism to add custom instrumentation to a go-httpbin instance.

An observer is a function that will be called with an httpbin.Result struct after every request, which provides a hook for custom logging, metrics, or other instrumentation.

Note: This does require building your own small wrapper around go-httpbin, as you can see in main.go here. That's because go-httpbin has no dependencies outside of the Go stdlib, to make sure that it is as safe/lightweight as possible to include as a dependency in other applications' test suites where useful.