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

fix: handle tags for old consumer-groups implementation #1088

Closed
wants to merge 1 commit into from

Conversation

GGabriele
Copy link
Collaborator

Tags support for Consumer Groups was introduced in 3.2. Before that, making a request with a tag would have no effect in the Gateway:


$ http :8001/plugins\?tags=foo
HTTP/1.1 200 OK
{
    "data": [],
    "next": null
}

$ http :8001/consumer_groups\?tags=foo
HTTP/1.1 200 OK
{
    "data": [
        {
            "created_at": 1699337744,
            "id": "d241ee7f-875a-41f1-84fb-c509df9e716e",
            "name": "my-cg"
        }
    ],
    "next": null
}

For this reason, when a Consumer Group is present and a sync with select_tags is ran, the existing Consumer Group is wiped out.

This commit introduces a custom way to handle tags for Consumer Groups when the select_tags is present in the input. This doesn't mean we are implementing tags support for older versions of the Gateway, but it means that if a Consumer Group (without a tag) exists, it won't be wiped out when a sync with select_tags is ran.

Tags support for Consumer Groups was introduced in 3.2.
Before that, making a request with a tag would have no
effect in the Gateway:

```

$ http :8001/plugins\?tags=foo
HTTP/1.1 200 OK
{
    "data": [],
    "next": null
}

$ http :8001/consumer_groups\?tags=foo
HTTP/1.1 200 OK
{
    "data": [
        {
            "created_at": 1699337744,
            "id": "d241ee7f-875a-41f1-84fb-c509df9e716e",
            "name": "my-cg"
        }
    ],
    "next": null
}
```

For this reason, when a Consumer Group is present and a `sync` with
`select_tags` is ran, the existing Consumer Group is wiped out.

This commit introduces a custom way to handle tags for Consumer Groups
when the `select_tags` is present in the input. This doesn't mean
we are implementing tags support for older versions of the Gateway,
but it means that if a Consumer Group (without a tag) exists, it won't
be wiped out when a `sync` with `select_tags` is ran.
@GGabriele GGabriele requested a review from a team November 7, 2023 07:44
@codecov-commenter
Copy link

Codecov Report

Attention: 37 lines in your changes are missing coverage. Please review.

Comparison is base (b3ccdd5) 32.87% compared to head (73dcaed) 32.78%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1088      +/-   ##
==========================================
- Coverage   32.87%   32.78%   -0.09%     
==========================================
  Files         103      103              
  Lines       12850    12885      +35     
==========================================
  Hits         4224     4224              
- Misses       8217     8252      +35     
  Partials      409      409              
Files Coverage Δ
cmd/common.go 3.93% <0.00%> (-0.02%) ⬇️
utils/utils.go 24.40% <0.00%> (-1.22%) ⬇️
dump/dump.go 1.38% <0.00%> (-0.07%) ⬇️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants