statsd: Make ping timeout values configurable.

Change-Id: I28713bdc9203939e56e1dd8dc0b74ecd275487a2
This commit is contained in:
David Shrewsbury
2013-06-05 13:26:53 -04:00
parent cf3d49a84b
commit 89b2cf9a29
4 changed files with 25 additions and 3 deletions

View File

@@ -322,6 +322,16 @@ Statsd Command Line Options
How often to run a ping check of load balancers (in seconds), default 60
.. option:: --poll_interval <POLL_INTERVAL>
How long to wait until we consider the initial ping check failed and
send a second ping. Default is 5 seconds.
.. option:: --poll_interval_retry <POLL_INTERVAL>
How long to wait until we consider the second and final ping check
failed. Default is 30 seconds.
.. option:: --repair_interval <REPAIR_INTERVAL>
How often to run a check to see if damaged load balancers had been

View File

@@ -69,6 +69,8 @@ datadog_message_tail="@user@domain.com"
datadog_tags=service:lbaas
datadog_env=prod
ping_interval = 60
poll_timeout = 5
poll_timeout_retry = 30
[admin_api]
db_user=root

View File

@@ -19,6 +19,8 @@ from libra.common.json_gearman import JSONGearmanClient
class GearJobs(object):
def __init__(self, logger, args):
self.logger = logger
self.poll_timeout = args.poll_timeout
self.poll_timeout_retry = args.poll_timeout_retry
self.gm_client = JSONGearmanClient(args.server)
def send_pings(self, node_list):
@@ -31,7 +33,7 @@ class GearJobs(object):
list_of_jobs.append(dict(task=str(node), data=job_data))
submitted_pings = self.gm_client.submit_multiple_jobs(
list_of_jobs, background=False, wait_until_complete=True,
poll_timeout=5.0
poll_timeout=self.poll_timeout
)
for ping in submitted_pings:
if ping.state == JOB_UNKNOWN:
@@ -61,7 +63,7 @@ class GearJobs(object):
list_of_jobs.append(dict(task=str(node), data=job_data))
submitted_pings = self.gm_client.submit_multiple_jobs(
list_of_jobs, background=False, wait_until_complete=True,
poll_timeout=30.0
poll_timeout=self.poll_timeout_retry
)
for ping in submitted_pings:
if ping.state == JOB_UNKNOWN:
@@ -92,7 +94,7 @@ class GearJobs(object):
list_of_jobs.append(dict(task=str(node), data=job_data))
submitted_pings = self.gm_client.submit_multiple_jobs(
list_of_jobs, background=False, wait_until_complete=True,
poll_timeout=5.0
poll_timeout=self.poll_timeout
)
for ping in submitted_pings:
if ping.state == JOB_UNKNOWN:

View File

@@ -58,6 +58,14 @@ def main():
'--ping_interval', type=int, default=60,
help='how often to ping load balancers (in seconds)'
)
options.parser.add_argument(
'--poll_timeout', type=int, default=5,
help='timeout value for initial ping request (in seconds)'
)
options.parser.add_argument(
'--poll_timeout_retry', type=int, default=30,
help='timeout value for the retry ping request (in seconds)'
)
options.parser.add_argument(
'--repair_interval', type=int, default=180,
help='how often to check if a load balancer has been repaired (in '