Skip to content

Commit

Permalink
Fix exception messages on failed Rundeck api requests
Browse files Browse the repository at this point in the history
  • Loading branch information
phsmith committed Dec 16, 2020
1 parent abaf12c commit f924b99
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -253,3 +253,6 @@ docker run --rm -d -p 9620:9620 -e RUNDECK_TOKEN=$RUNDECK_TOKEN rundeck_exporter

`v2.2.0`:
* Fix issue Last Run #5 - Merged @h4wkmoon patch that adds rundeck_project_start_timestamp metric

`2.2.1`:
* Fix exception messages on failed Rundeck api requests
6 changes: 3 additions & 3 deletions rundeck_exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def request_data_from(self, endpoint: str) -> dict:
)
response_json = response.json()

if response_json and isinstance(response.json, dict) and response_json.get('error') is True:
if response_json and isinstance(response_json, dict) and response_json.get('error') is True:
raise Exception(response_json.get('message'))

return response_json
Expand Down Expand Up @@ -159,7 +159,7 @@ def get_project_executions(self, project: dict):
job_start_time = project_execution.get('date-started', {}).get('unixtime', 0)
job_end_time = project_execution.get('date-ended', {}).get('unixtime', 0)
job_execution_duration = (job_end_time - job_start_time)

start_metrics = GaugeMetricFamily(
'rundeck_project_start_timestamp',
f'Rundeck Project {project_name} Start Timestamp',
Expand All @@ -174,7 +174,7 @@ def get_project_executions(self, project: dict):
job_start_time
)
project_executions_status.append(start_metrics)

duration_metrics = GaugeMetricFamily(
'rundeck_project_execution_duration_seconds',
f'Rundeck Project {project_name} Execution Duration',
Expand Down

0 comments on commit f924b99

Please sign in to comment.