Skip to content

Commit

Permalink
refactor: Add 127.0.0.1 as default uri value for PrometheusDB
Browse files Browse the repository at this point in the history
  • Loading branch information
roda82 committed Nov 22, 2023
1 parent eda819c commit fe186ca
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 4 additions & 2 deletions powerapi/cli/common_cli_parsing_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
from powerapi.cli.parsing_manager import RootConfigParsingManager, SubgroupConfigParsingManager
from powerapi.cli.config_parser import store_true
from powerapi.cli.config_parser import MissingValueException
from powerapi.database.prometheus_db import DEFAULT_METRIC_DESCRIPTION, DEFAULT_MODEL_VALUE, DEFAULT_PUSHER_NAME
from powerapi.database.prometheus_db import DEFAULT_METRIC_DESCRIPTION, DEFAULT_MODEL_VALUE, DEFAULT_PUSHER_NAME, \

Check warning on line 35 in powerapi/cli/common_cli_parsing_manager.py

View check run for this annotation

Codecov / codecov/patch

powerapi/cli/common_cli_parsing_manager.py#L35

Added line #L35 was not covered by tests
DEFAULT_ADDRESS
from powerapi.exception import BadTypeException, BadContextException, UnknownArgException

POWERAPI_ENVIRONMENT_VARIABLE_PREFIX = 'POWERAPI_'
Expand Down Expand Up @@ -253,7 +254,8 @@ def __init__(self):

subparser_prometheus_output = SubgroupConfigParsingManager("prometheus")
subparser_prometheus_output.add_argument("t", "tags", help_text="specify report tags")
subparser_prometheus_output.add_argument("u", "uri", help_text="specify server uri")
subparser_prometheus_output.add_argument("u", "uri", help_text="specify server uri",

Check warning on line 257 in powerapi/cli/common_cli_parsing_manager.py

View check run for this annotation

Codecov / codecov/patch

powerapi/cli/common_cli_parsing_manager.py#L255-L257

Added lines #L255 - L257 were not covered by tests
default_value=DEFAULT_ADDRESS)
subparser_prometheus_output.add_argument(

Check warning on line 259 in powerapi/cli/common_cli_parsing_manager.py

View check run for this annotation

Codecov / codecov/patch

powerapi/cli/common_cli_parsing_manager.py#L259

Added line #L259 was not covered by tests
"p", "port", help_text="specify server port", argument_type=int
)
Expand Down
4 changes: 1 addition & 3 deletions powerapi/cli/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@

from powerapi.actor import Actor
from powerapi.database.influxdb2 import InfluxDB2
from powerapi.database.prometheus_db import DEFAULT_ADDRESS
from powerapi.exception import PowerAPIException, ModelNameAlreadyUsed, DatabaseNameDoesNotExist, ModelNameDoesNotExist, \
DatabaseNameAlreadyUsed, ProcessorTypeDoesNotExist, ProcessorTypeAlreadyUsed, MonitorTypeDoesNotExist
from powerapi.filter import Filter
Expand Down Expand Up @@ -199,8 +198,7 @@ def __init__(self, component_group_name: str):
port=db_config['port'], metric_name=db_config['metric_name']),
'prometheus': lambda db_config: PrometheusDB(report_type=db_config['model'],
port=db_config['port'],
address=db_config['uri'] if 'uri' in db_config else
DEFAULT_ADDRESS,
address=db_config['uri'],
metric_name=db_config['metric_name'],
metric_description=db_config['metric_description'],
tags=gen_tag_list(db_config)),
Expand Down

0 comments on commit fe186ca

Please sign in to comment.