8.3.3. Exporting all Metric Values from the Dashboard¶
8.3.3.1. Background¶
You have a running Axivion Suite CI configuration.
You want a report for all metric values, not just the violations.
8.3.3.2. What needs to be done?¶
To import all metric values (and not just the metric violations), set the Metrics options
report_all_values to
true and
report_propagated_values
to all. The propagate option
must be
true, which is the default.
You can then use the Dashboard Python API as follows.
Example script using the python API¶
# Copyright (C) 2025 Axivion GmbH
# Copyright (C) 2025 The Qt Company GmbH, a subsidiary of The Qt Group
# https://www.qt.io
import csv
from bauhaus.dashboard import ApiToken, Dashboard
with Dashboard('http://localhost:9090/axivion/', auth=ApiToken('token')) as dashboard:
project = dashboard.project('my_project')
if not project:
raise Exception('Project not found')
entity_table = project.fetch_entity_metric_values()
columns = entity_table['columns']
rows = entity_table['rows']
with open('all_metric_values.csv', 'w', encoding='utf-8', newline='') as csvfile:
writer = csv.writer(
csvfile, delimiter=';', quotechar='"', quoting=csv.QUOTE_MINIMAL
)
writer.writerow([x['header'] for x in columns])
for row in rows:
writer.writerow([row[x['key']] for x in columns])