Documentation ¶
Overview ¶
Package config parses config files for metaphite.
metaphite config files are in JSON format, and consists of a single JSON object containing string/string pairs. The key should be a metrics prefix to match, and the value should be a URL for the graphite server. For example,
{ "address": ":80", "mappings": { "dev": "https://dev-graphite.example.net/", "production": "https://graphite.example.net/", "staging": "https://stage-graphite.example.net/" } }
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // Do not validate HTTPS certs InsecureHTTPS bool // directory to load CA certs from CACertDir string // file to load CA certs from CACert string // The address to listen on, if not specified on the command line. Address string // Maps from metrics prefix to backend URL. Mappings map[string]string // Dump proxied requests Debug bool // contains filtered or unexported fields }
A Config contains the necessary information for running a metaphite server. Most importantly, it contains the mappings of metrics prefixes to backend servers. In the config JSON, the value of the "mappings" key must be an object of prefix -> URL pairs.
func (*Config) ServeHTTP ¶
func (c *Config) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP routes a graphite render query to a backend graphite server based on its content. If the query contains metrics that map one (and only one) of the prefixes in a configuration, ServeHTTP will strip the prefix and proxy the request to the appropriate backend server.