]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
mgr/telemetry: handle empty device report when "send" is triggered 44994/head
authorLaura Flores <lflores@redhat.com>
Fri, 11 Feb 2022 19:37:26 +0000 (19:37 +0000)
committerLaura Flores <lflores@redhat.com>
Wed, 16 Feb 2022 19:38:53 +0000 (19:38 +0000)
commit54e0e58f1b3f431281df0e2dd2b258f85cbade19
tree0b5d253a37bdf3f91bb93de259d588f11553f021
parent2bd3dd512ab42f6e5d5d0dd5f5428b783681802e
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>
src/pybind/mgr/telemetry/module.py