Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RabbitMQQueueDetails parsing doesn't account for duplicated elements #848

Merged
merged 4 commits into from
Oct 3, 2024

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
@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