Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add discovery options to ddev env check command #11044

Merged
merged 4 commits into from
Jan 7, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,41 @@
)
@click.option('--config', 'config_file', help='Path to a JSON check configuration to use')
@click.option('--jmx-list', 'jmx_list', help='JMX metrics listing method')
def check_run(check, env, rate, times, pause, delay, log_level, as_json, as_table, break_point, config_file, jmx_list):
@click.option(
'--discovery-timeout',
'discovery_timeout',
type=click.INT,
help='max retry duration until Autodiscovery resolves the check template (in seconds)',
AlexandreYang marked this conversation as resolved.
Show resolved Hide resolved
)
@click.option(
'--discovery-retry-interval',
'discovery_retry_interval',
type=click.INT,
help='duration between retries until Autodiscovery resolves the check template (in seconds)',
AlexandreYang marked this conversation as resolved.
Show resolved Hide resolved
)
@click.option(
'--discovery-min-instances',
'discovery_min_instances',
type=click.INT,
help='number of checks to wait, retry until the specified number of checks is reached',
AlexandreYang marked this conversation as resolved.
Show resolved Hide resolved
)
def check_run(
check,
env,
rate,
times,
pause,
delay,
log_level,
as_json,
as_table,
break_point,
config_file,
jmx_list,
discovery_timeout,
discovery_retry_interval,
discovery_min_instances,
):
"""Run an Agent check."""
envs = get_configured_envs(check)
if not envs:
Expand Down Expand Up @@ -68,6 +102,9 @@ def check_run(check, env, rate, times, pause, delay, log_level, as_json, as_tabl
as_table=as_table,
break_point=break_point,
jmx_list=jmx_list,
discovery_timeout=discovery_timeout,
discovery_retry_interval=discovery_retry_interval,
discovery_min_instances=discovery_min_instances,
)

if config_file:
Expand Down
12 changes: 12 additions & 0 deletions datadog_checks_dev/datadog_checks/dev/tooling/e2e/docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,9 @@ def run_check(
as_table=False,
break_point=None,
jmx_list=None,
discovery_timeout=None,
discovery_retry_interval=None,
discovery_min_instances=None,
):
# JMX check
if jmx_list:
Expand Down Expand Up @@ -166,6 +169,15 @@ def run_check(
if as_table:
command.append('--table')

if discovery_timeout is not None:
command.extend(['--discovery-timeout', str(discovery_timeout)])

if discovery_retry_interval is not None:
command.extend(['--discovery-retry-interval', str(discovery_retry_interval)])

if discovery_min_instances is not None:
command.extend(['--discovery-min-instances', str(discovery_min_instances)])

if log_level is not None:
command.extend(['--log-level', log_level])

Expand Down
12 changes: 12 additions & 0 deletions datadog_checks_dev/datadog_checks/dev/tooling/e2e/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,9 @@ def run_check(
as_table=False,
break_point=None,
jmx_list=None,
discovery_timeout=None,
discovery_retry_interval=None,
discovery_min_instances=None,
):
# JMX check
if jmx_list:
Expand Down Expand Up @@ -179,6 +182,15 @@ def run_check(
if break_point is not None:
command += f' --breakpoint {break_point}'

if discovery_timeout is not None:
command += f'--discovery-timeout {discovery_timeout}'

if discovery_retry_interval is not None:
command += f'--discovery-retry-interval {discovery_retry_interval}'

if discovery_min_instances is not None:
command += f'--discovery-min-instances {discovery_min_instances}'

if log_level is not None:
command += f' --log-level {log_level}'

Expand Down