Skip to content

Commit

Permalink
add autoconf_event_delay to reduce event requests
Browse files Browse the repository at this point in the history
  • Loading branch information
xvello committed Jun 14, 2017
1 parent 29e1357 commit e6c6211
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
7 changes: 5 additions & 2 deletions kubernetes/check.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
DEFAULT_COLLECT_EVENTS = False
DEFAULT_NAMESPACES = ['default']

DEFAULT_AUTOCONF_EVENT_DELAY = 5

NET_ERRORS = ['rx_errors', 'tx_errors', 'rx_dropped', 'tx_dropped']

DEFAULT_ENABLED_GAUGES = [
Expand Down Expand Up @@ -108,12 +110,13 @@ def __init__(self, name, init_config, agentConfig, instances=None):
self.event_retriever = self.kubeutil.get_event_retriever()
else:
# Only fetch service and pod events for service mapping and SD
self.event_retriever = self.kubeutil.get_event_retriever(kinds=['Service', 'Pod'])
event_delay = inst.get('autoconf_event_delay', DEFAULT_AUTOCONF_EVENT_DELAY) * 60
self.event_retriever = self.kubeutil.get_event_retriever(kinds=['Service', 'Pod'],
delay=event_delay)
else:
self._collect_events = None
self.event_retriever = None


def _perform_kubelet_checks(self, url):
service_check_base = NAMESPACE + '.kubelet.check'
is_ok = True
Expand Down
5 changes: 5 additions & 0 deletions kubernetes/conf.yaml.example
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ instances:
#
# collect_events: false
#
# Matching the pods to Kubernetes services requires to retrieve events regularly.
# To reduce the traffic to the apiserver, only query them every 5 minutes, adding a delay
# in pod -> service matching. You can configure it below (in minutes)
#
# autoconf_event_delay: 5
#
# The namespaces for which events should be collected.
# If not modified, the 'default' namespace will be used.
Expand Down

0 comments on commit e6c6211

Please sign in to comment.