Bug 2229267

Summary: Labeled Perf Counters "counter dump" asok command emits invalid JSON
Product: [Red Hat Storage] Red Hat Ceph Storage Reporter: Ali Maredia <amaredia>
Component: Ceph-DashboardAssignee: Ali Maredia <amaredia>
Status: CLOSED ERRATA QA Contact: Sunil Angadi <sangadi>
Severity: urgent Docs Contact: Akash Raj <akraj>
Priority: unspecified    
Version: 6.1CC: akraj, athakkar, ceph-eng-bugs, cephqe-warriors, idryomov, sangadi, saraut, tserlin, vereddy
Target Milestone: ---   
Target Release: 6.1z2   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: ceph-17.2.6-105.el9cp Doc Type: Bug Fix
Doc Text:
. JSON entries emitted by `counter dump` and `counter schema` no longer repeat, can be parsed, and are valid Previously, the JSON emitted by the `counter dump` and `counter schema` commands would have repeated entries with the same name, due to which the commands became invalid. With this fix, each entry in the JSON emitted by the `counter dump` and `counter schema` has an array of labeled counters or schemas. The entries are no longer repeated, can be parsed, and are valid JSON.
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-10-12 16:34:36 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2235257    

Description Ali Maredia 2023-08-04 16:42:23 UTC
Description of problem:

Copied from: https://tracker.ceph.com/issues/61587

{
...
    "rbd_mirror_snapshot_image": {
        "labels": {
            "image": "b1",
            "namespace": "",
            "pool": "data" 
        },
        "counters": {
            "snapshots": 1,
            "sync_time": {
                "avgcount": 1,
                "sum": 0.394751259,
                "avgtime": 0.394751259
            },
            "sync_bytes": 3203072,
            "remote_timestamp": 1685658580.065694857,
            "local_timestamp": 1685658580.065694857,
            "last_sync_time": 0.394751259,
            "last_sync_bytes": 3203072
        }
    },
    "rbd_mirror_snapshot_image": {
        "labels": {
            "image": "b2",
            "namespace": "",
            "pool": "data" 
        },
        "counters": {
            "snapshots": 1,
            "sync_time": {
                "avgcount": 1,
                "sum": 0.383831520,
                "avgtime": 0.383831520
            },
            "sync_bytes": 4182016,
            "remote_timestamp": 1685659196.821769027,
            "local_timestamp": 1685659196.821769027,
            "last_sync_time": 0.383831520,
            "last_sync_bytes": 4182016
        }
    },
...
}

needs to become

{
...
    "rbd_mirror_snapshot_image": [
        {
            "labels": {
                "image": "b1",
                "namespace": "",
                "pool": "data" 
            },
            "counters": {
                "snapshots": 1,
                "sync_time": {
                    "avgcount": 1,
                    "sum": 0.394751259,
                    "avgtime": 0.394751259
                },
                "sync_bytes": 3203072,
                "remote_timestamp": 1685658580.065694857,
                "local_timestamp": 1685658580.065694857,
                "last_sync_time": 0.394751259,
                "last_sync_bytes": 3203072
            }
        },
        {
            "labels": {
                "image": "b2",
                "namespace": "",
                "pool": "data" 
            },
            "counters": {
                "snapshots": 1,
                "sync_time": {
                    "avgcount": 1,
                    "sum": 0.383831520,
                    "avgtime": 0.383831520
                },
                "sync_bytes": 4182016,
                "remote_timestamp": 1685659196.821769027,
                "local_timestamp": 1685659196.821769027,
                "last_sync_time": 0.383831520,
                "last_sync_bytes": 4182016
            }
        },
    ],
...
}

Otherwise a compliant JSON parser is free to pick up only one of the mirrored images, at random, since they are dumped in the same dictionary under the same "rbd_mirror_snapshot_image" key.

This was missed in https://github.com/ceph/ceph/pull/48657 (mentioned but lost in backwards compatibility discussions). The exporter daemon would need be adjusted accordingly.



Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

This issue has already been resolved upstream but was not backported to Quincy. This BZ is to track the backport to RHCS 6.

Comment 12 errata-xmlrpc 2023-10-12 16:34:36 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Moderate: Red Hat Ceph Storage 6.1 security, enhancement, and bug fix update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2023:5693