Documentation
¶
Index ¶
- type Worker
- func (w *Worker) Collect(ch chan<- prometheus.Metric)
- func (w *Worker) Describe(ch chan<- *prometheus.Desc)
- func (w *Worker) Refresh()
- func (w *Worker) RefreshQPSAccountData()
- func (w *Worker) RefreshQPSData()
- func (w *Worker) RefreshQPSRecordData()
- func (w *Worker) RefreshQPSZoneData()
- func (w *Worker) RefreshZoneData()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Worker ¶
type Worker struct { EnableZoneQPS bool EnableRecordQPS bool ZoneBlacklist *regexp.Regexp ZoneWhitelist *regexp.Regexp // contains filtered or unexported fields }
Worker is a struct containing configs needed to retrieve stats from NS1 API to expose as prometheus metrics. It implements the prometheus.Collector interface
func NewWorker ¶
func NewWorker(client *api.Client, zoneEnabled, recordEnabled bool, blacklist, whitelist *regexp.Regexp) *Worker
NewWorker creates a new Worker struct to collect data from the NS1 API
func (*Worker) Collect ¶
func (w *Worker) Collect(ch chan<- prometheus.Metric)
Collect implements the prometheus.Collector interface
func (*Worker) Describe ¶
func (w *Worker) Describe(ch chan<- *prometheus.Desc)
Describe implements the prometheus.Collector interface
func (*Worker) Refresh ¶
func (w *Worker) Refresh()
Refresh calls the other Refresh* functions as needed to update the worker's data from the NS1 API.
func (*Worker) RefreshQPSAccountData ¶
func (w *Worker) RefreshQPSAccountData()
RefreshQPSAccountData refreshes the worker's `[]*ns1_internal.QPS` cache array by requesting account-level QPS stats from the NS1 API.
func (*Worker) RefreshQPSData ¶
func (w *Worker) RefreshQPSData()
RefreshQPSData refreshes the worker's `[]*ns1_internal.QPS` cache array by using the zone/record information present in the worker's `map[string]*ns1_internal.Zone` cache map. This function dispatches the work of making the API calls/updating the cache to either `Worker.RefreshQPSRecordData()`, `Worker.RefreshQPSZoneData()`, or `Worker.RefreshQPSAccountData()` as needed, depending on the flags provided to the service.
func (*Worker) RefreshQPSRecordData ¶
func (w *Worker) RefreshQPSRecordData()
RefreshQPSRecordData refreshes the worker's `[]*ns1_internal.QPS` cache array by using the zone/record information present in the worker's `map[string]*ns1_internal.Zone` cache map.
func (*Worker) RefreshQPSZoneData ¶
func (w *Worker) RefreshQPSZoneData()
RefreshQPSZoneData refreshes the worker's `[]*ns1_internal.QPS` cache array by using the zone/record information present in the worker's `map[string]*ns1_internal.Zone` cache map.
func (*Worker) RefreshZoneData ¶
func (w *Worker) RefreshZoneData()
RefreshZoneData updates the data for each of the zones in the worker's zone list by querying the NS1 API, parses the data to structs that serve as internal counterparts to the NS1 API's dns.Record and dns.Zone, and then updating the worker's internal map of zones. This internal map is used as a cache to respond to respond to HTTP requests.