Skip to content

Commit

Permalink
Grafana host parameterization (#31)
Browse files Browse the repository at this point in the history
jmfiola authored Jan 11, 2024
1 parent b4d3b6a commit 920a8d8
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
@@ -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 your grafana 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 when the grasshopper object generates grafana links.

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

8 changes: 8 additions & 0 deletions src/grasshopper/lib/configuration/gh_configuration.py
Original file line number Diff line number Diff line change
@@ -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": {
1 change: 1 addition & 0 deletions src/grasshopper/lib/fixtures/grasshopper_constants.py
Original file line number Diff line number Diff line change
@@ -17,6 +17,7 @@ class GrasshopperConstants:
"influx_port",
"influx_user",
"influx_pwd",
"grafana_host",
"shape_instance",
"scenario_delay",
"slack_webhook",
14 changes: 14 additions & 0 deletions src/grasshopper/lib/grasshopper.py
Original file line number Diff line number Diff line change
@@ -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[

0 comments on commit 920a8d8

Please sign in to comment.