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: avan <athakkar>
Status: ON_QA --- QA Contact: Sayalee <saraut>
Severity: urgent Docs Contact: Anjana Suparna Sriram <asriram>
Priority: unspecified    
Version: 6.1CC: ceph-eng-bugs, cephqe-warriors, idryomov, 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: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 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:

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.