From 38fc4e70230f52c7f7184313b103c3242f0ed937 Mon Sep 17 00:00:00 2001 From: Max Kutschka <2004maximilian@web.de> Date: Tue, 15 Oct 2024 13:01:47 +0200 Subject: [PATCH] Changed setup.cfg path to metricq-python git repo --- metricq_sink_nsca/main.py | 35 +++++++++++++++++------------------ setup.cfg | 2 +- 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/metricq_sink_nsca/main.py b/metricq_sink_nsca/main.py index 8ec991e..e3a9937 100644 --- a/metricq_sink_nsca/main.py +++ b/metricq_sink_nsca/main.py @@ -2,6 +2,7 @@ import click import click_log +from metricq.cli import metricq_command from .logging import get_logger from .reporter import ReporterSink @@ -48,23 +49,21 @@ def _set_log_levels(_ctx, _param, value: str): CONTEXT_SETTINGS = dict(help_option_names=["-h", "--help"]) -@click.command(context_settings=CONTEXT_SETTINGS) -@click.option("--metricq-server", "-s", default="amqp://localhost/") -@click.option("--token", "-t", default="sink-nsca") +@metricq_command(default_token="sink-nsca", client_version=None) @click.option("--dry-run", "-n", is_flag=True) @verbosity_option(root_logger) -def main(metricq_server, token, dry_run): - try: - import uvloop - - uvloop.install() - logging.info("Using uvloop-based event loop") - except ImportError: - logging.debug("Using default event loop") - - reporter = ReporterSink( - dry_run=dry_run, - management_url=metricq_server, - token=token, - ) - reporter.run(cancel_on_exception=True) +def main(server, token, dry_run): + try: + import uvloop + + uvloop.install() + logging.info("Using uvloop-based event loop") + except ImportError: + logging.debug("Using default event loop") + + reporter = ReporterSink( + dry_run=dry_run, + management_url=server, + token=token, + ) + reporter.run(cancel_on_exception=True) diff --git a/setup.cfg b/setup.cfg index 5abec84..799081e 100644 --- a/setup.cfg +++ b/setup.cfg @@ -35,7 +35,7 @@ include_package_data = True setup_requires = setuptools_scm install_requires = - metricq ~= 4.0 + metricq[cli] @ git+https://github.com/metricq/metricq-python.git@188-standardized-cli#egg=metricq[cli] click ~= 8.0 click-log ~= 0.3