Skip to content

Commit

Permalink
grafana host parameterization
Browse files Browse the repository at this point in the history
  • Loading branch information
jmfiola committed Jan 10, 2024
1 parent bdba07d commit a4cd861
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ you must specify a host.
- `--influx_port`: Port for your `influx_host` in the case where it is non-default.
- `--influx_user`: Username for your `influx_host`, if you have one.
- `--influx_pwd`: Password for your `influx_host`, if you have one.
- `--grafana_host`: If you want to report your performance test metrics to some
grafana, and it is a separate URL from the influxdb, you can specify it here. If you don't,
then the grafana URL will be the same as the influxdb URL.

<p align="right">(<a href="#top">back to top</a>)</p>

Expand Down
8 changes: 8 additions & 0 deletions src/grasshopper/lib/configuration/gh_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,14 @@ class ConfigurationConstants:
"help": "Password to connect to the influx host.",
},
},
"grafana_host": {
"opts": ["--grafana_host"],
"attrs": {
"action": "store",
"help": "The base grafana url. If not specified, will default to the "
"url that the influxdb/influx_host is set to.",
},
},
"slack_webhook": {
"opts": ["--slack_webhook"],
"attrs": {
Expand Down
1 change: 1 addition & 0 deletions src/grasshopper/lib/fixtures/grasshopper_constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class GrasshopperConstants:
"influx_port",
"influx_user",
"influx_pwd",
"grafana_host",
"shape_instance",
"scenario_delay",
"slack_webhook",
Expand Down
14 changes: 14 additions & 0 deletions src/grasshopper/lib/grasshopper.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,20 @@ def influx_configuration(self) -> dict[str, Optional[str]]:

return configuration

@property
def grafana_configuration(self) -> dict[str, Optional[str]]:
"""Extract the grafana related configuration items.
# TODO-DEPRECATED: move this code to the GHConfiguration object
"""
configuration = {}

host = self.global_configuration.get(
"grafana_host", self.global_configuration.get("influx_host")
)
configuration["grafana_host"] = host
return configuration

@staticmethod
def launch_test(
weighted_user_classes: Union[
Expand Down

0 comments on commit a4cd861

Please sign in to comment.