~whereisrysmind/charm-grafana:bugs/1875691

Last commit made on 2020-06-09
Get this branch:
git clone -b bugs/1875691 https://git.launchpad.net/~whereisrysmind/charm-grafana
Only Ryan Farrell can upload to this branch. If you are Ryan Farrell please log in for upload directions.

Branch merges

Branch information

Name:
bugs/1875691
Repository:
lp:~whereisrysmind/charm-grafana

Recent commits

df35a35... by Ryan Farrell

Added try/except to get source application

dd6ae02... by Ryan Farrell

Added helper function to get application name

Helper function works by searching through the relation data, as seen
from the perspective of grafana to match the request id with the
originating unit. It splits the related unit name and returns the
application name so that the source application can be inserted into the
dashboard title.

1d2dac8... by Ryan Farrell

Improved check_if_dashboard_update_required logic

This commit changes logic around checking existing dashboards for a
match with a new dashboard to be imported. It now only matches with the
dashboard titles for a list of uids. If the uid list is empty, the
dashboard is new and no further checking is required. If the list is
more than one item long, it will log a warning that only one dashboard
will be used for comparison and update; this should not happen because
grafana doesnt allow dashboards with duplicate titles.

Additional changes:
- Implements a check for a dashboard title when importing, and returns a
failure to import instead of applying the name "Untitled".
- Fixes a syntax error when logging success on the import_dashboards
action.

ad6e920... by Ryan Farrell

Fixed import_dashboard reactve flag

The reactive flag endpoint.dashboards.requests is only true for new
requests, and does not trigger true for updated requests. This commit
changes import_dashboards to use endpoint.dashboards.has_requests in
order to ensure dashboard updates will continually attempt to update
existing requests. It will still run comparison of the dashboard data
against existing dashboards in grafana so as to avoid repeated,
unnecessary POSTs.

32d92e2... by Ryan Farrell

Fixed import_dashboard title issue

Changed the import_dashboard invocation to let the dashboard title be
automatically parsed from the dashboard json, instead of passed in as
the request.name. This fixed an issue where the dashboards comparison
with whats present in grafana would never actually find a dashboard to
compare with, causing repeated imports.

d60dc7a... by Ryan Farrell

Removed use of helpers.data_changed

Helpers.data_changed did not get reset when relations were removed and
re-added, leading to a situaion where relation data would no longer be
shared over the relation. This commit removes this check and relies on
the already existing grafana dashboard comparson instead.

466c3e0... by Ryan Farrell

Added catch for json.loads errors

b48bac4... by Ryan Farrell

Fixed key cleanup comparing dashboards for update

Previously, the code comparing new and existing dashboards would remove
keys expected to be different from both dictionaries. However, new
dashboards passed via the dashboards relation may already be missing
these keys. This commit checks for the existence of those keys before
attempting to delete them.

7c4708a... by Ryan Farrell

Added failure messages for import dashboard action

0d5c53e... by Ryan Farrell

Implemented dashboard change check during import