Skip to content

Conversation

danielmarbach
Copy link
Contributor

@danielmarbach danielmarbach commented Oct 1, 2024

In some cases, RabbitMQ management API might return json elements with duplicated keys.

For example, with one of the customers it returned a duplicated memory element

{
    "filtered_count": 44,
    "item_count": 44,
    "items": [
        {
            "arguments": {
                "x-queue-type": "quorum"
            },
            "auto_delete": false,
            "consumer_capacity": 1,
            "consumer_utilisation": 1,
            "consumers": 1,
            "durable": true,
            "effective_policy_definition": {},
            "exclusive": false,
            "leader": "rabbit@7509bf5e7b2a",
            "members": [
                "rabbit@7509bf5e7b2a"
            ],
            "memory": 112564,
            "memory": 112564,

By accessing the json object dictionary, the dictionary is initialized and cannot contain multiple keys. JsonElement is more flexible in that regard.

Both this tool and ServiceControl lack proper testing infrastructure in place to reproduce these problems so I ended up manually loading a fake Json payload from a filestream into the parser.

@danielmarbach danielmarbach marked this pull request as ready for review October 2, 2024 12:57
@danielmarbach danielmarbach requested a review from jpalac October 2, 2024 12:57
@danielmarbach danielmarbach force-pushed the fix-queue_detail_parsing branch from 47991a4 to 5949e1a Compare October 2, 2024 15:27
@jpalac jpalac added the bug Something isn't working label Oct 2, 2024
@danielmarbach danielmarbach changed the title Fix the RabbitMQQueueDetails parsing to account for duplicated elements RabbitMQQueueDetails parsing doesn't account for duplicated elements Oct 3, 2024
@danielmarbach danielmarbach merged commit b3fbe0a into main Oct 3, 2024
3 checks passed
@danielmarbach danielmarbach deleted the fix-queue_detail_parsing branch October 3, 2024 07:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants