8.3.3. Exporting all Metric Values from the Web UI¶
8.3.3.1. Background¶
You have a running Axivion Suite CI configuration.
You want to have a report for all metric values and not only violations.
8.3.3.2. What needs to be done?¶
If you want to import all values of metrics (and not just the metric violations), you
have to set Metrics/report_all_values and Metrics/propagate to true and
Metrics/report_propagated_values to all.
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])