-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add new metric rundeck_project_executions_total
- Loading branch information
Showing
3 changed files
with
32 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,7 +26,7 @@ | |
__author__ = 'Phillipe Smith' | ||
__author_email__ = '[email protected]' | ||
__app__ = 'rundeck_exporter' | ||
__version__ = '2.4.13' | ||
__version__ = '2.5.0' | ||
|
||
# Disable InsecureRequestWarning | ||
requests.urllib3.disable_warnings() | ||
|
@@ -237,6 +237,10 @@ def get_project_executions(self, project: dict): | |
project_executions_running_info = self.request_data_from(endpoint_running_executions) | ||
project_executions_info = self.request_data_from(endpoint) | ||
|
||
project_executions_total = { | ||
'project': project_name, | ||
'total_executions': project_executions_info['paging']['total'] | ||
} | ||
project_executions = (project_executions_running_info.get('executions', []) | ||
+ project_executions_info.get('executions', [])) | ||
|
||
|
@@ -279,10 +283,10 @@ def get_project_executions(self, project: dict): | |
RundeckProjectExecutionRecord(default_metrics + [status], value, RundeckProjectExecution.STATUS) | ||
) | ||
|
||
except Exception: # nosec | ||
pass | ||
except Exception as error: # nosec | ||
logging.error(error) | ||
|
||
return project_execution_records | ||
return project_execution_records, project_executions_total | ||
|
||
|
||
""" | ||
|
@@ -468,7 +472,17 @@ def collect(self): | |
labels=default_labels + ['status'] | ||
) | ||
|
||
for project_execution_record_group in project_execution_records: | ||
project_executions_total_metrics = CounterMetricFamily( | ||
'rundeck_project_executions_total', | ||
f'Rundeck Project ProjectName Total Executions', | ||
labels=self.default_labels + ['project_name'] | ||
) | ||
|
||
for project_execution_record_group, project_executions_total in project_execution_records: | ||
project_executions_total_metrics.add_metric( | ||
self.default_labels_values + [project_executions_total['project']], | ||
project_executions_total['total_executions'] | ||
) | ||
for project_execution_record in project_execution_record_group: | ||
if project_execution_record.execution_type == RundeckProjectExecution.START: | ||
project_start_metrics.add_metric(project_execution_record.tags, project_execution_record.value) | ||
|
@@ -480,6 +494,7 @@ def collect(self): | |
yield project_start_metrics | ||
yield project_duration_metrics | ||
yield project_metrics | ||
yield project_executions_total_metrics | ||
|
||
@staticmethod | ||
def exit_with_msg(msg: str, level: str): | ||
|