]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
mgr/telemetry: handle empty device report when "send" is triggered 45092/head
authorLaura Flores <lflores@redhat.com>
Fri, 11 Feb 2022 19:37:26 +0000 (19:37 +0000)
committerLaura Flores <lflores@redhat.com>
Mon, 21 Feb 2022 00:57:37 +0000 (00:57 +0000)
commit2e775dc3385e806155ca5e61b555780e10cde6c9
treec57cbe42d0fa3c6387d7091db2b52f0e7ceec2e0
parent60fd24fa136ad38e7a7b03dc4bb38120be74c8de
mgr/telemetry: handle empty device report when "send" is triggered

On certain environments, such as the "ceph-dev-docker" environment
(https://github.com/ricardoasmarques/ceph-dev-docker), the mgr
module is unable to fetch device metrics. As a result, the device
report generated by "gather_device_report()" returns an empty dict.
This causes an AssertionError when the "send" function is triggered
(i.e. by running `ceph telemetry status` or `ceph telemetry send`),
and the module crashes.

The fix in this commit checks that the generated device report
contains metrics before trying to send it. If the device report
does not contain metrics (it returns an empty dict), the module
will log an appropriate message in the mgr log and not send the
device report.

If this scenario happens when running the `ceph telemetry send` command,
the user will additionally see this message:
```
Ceph report sent to https://telemetry.ceph.com/report
Unable to send device report: channel is on, but generated report was empty.
```

I also added a few more debug messages in gather_device_report() to make
future debugging easier.

Fixes: https://tracker.ceph.com/issues/54250
Signed-off-by: Laura Flores <lflores@redhat.com>
(cherry picked from commit 54e0e58f1b3f431281df0e2dd2b258f85cbade19)
src/pybind/mgr/telemetry/module.py