Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func New ¶
func New(cfg Config) (producers.MetricsProducer, chan producers.MetricsMessage)
New creates a new instance of the HTTP producer with the provided configuration.
Types ¶
type Route ¶
type Route struct { Name string Method string Path string HandlerFunc func(*producerImpl) http.HandlerFunc }
Route defines a single new route for gorilla/mux. This includes an arbitrary name, the HTTP method(s) allowed, the path for the endpoint, and the handler function in producers/http/handlers.go.
When one or more Route structures are defined in a slice, they can be used to programatically create a gorilla/mux router, like so:
for _, route := range routes { router.NewRoute() ...
Although arbitrary, up to this point our naming convention for Name has been:
- convert slashes to underscores
- remove any params ('id', etc) from the Name
Click to show internal directories.
Click to hide internal directories.