feat(agent-filter): equal_to e not_equal_to aceitam conjunto de valores - #24
Merged
Merged
Conversation
A lista de clausulas do endpoint e plana e o SQL liga AND mais forte que OR, entao "(tipo A ou B) e (modelo X ou Y)" so cabia distribuido: uma clausula por combinacao. Com 6 tipos e 5 modelos isso vira 60 clausulas e ~10 KB de querystring, acima do buffer padrao de 8 KB do nginx. Um valor separado por virgula passa a ser lido como conjunto e vira IN/NOT IN, o que reduz o mesmo filtro a duas clausulas. So os operadores de conjunto dividem: contains segue tratando virgula como parte do texto buscado.
Reviewer's GuideThis PR updates the agent filtering logic so that equal_to and not_equal_to operators can interpret comma-separated values as sets, generating SQL IN/NOT IN clauses instead of one clause per combination, while preserving existing behavior for single values, created_at, and contains, and adds tests to validate the new behavior. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Levantado no review da EVO-2231, no lado do front.
O problema
A lista de clausulas do
GET /agentse plana (agent_filter.go) e o SQL ligaANDmais forte que
OR. Entao(tipo A ou B) E (modelo X ou Y)nao tem como seragrupado — so cabe distribuido, uma clausula por combinacao.
Medido com a querystring real:
O default de
large_client_header_buffersdo nginx e 8 KB: acima de ~50 clausulaso usuario toma 414.
O que muda
Um valor separado por virgula passa a ser lido como conjunto e vira
IN/NOT IN. O mesmo filtro cai para 2 clausulas em qualquer combinacao.Só os operadores de conjunto dividem —
containscontinua tratando virgula comoparte do texto buscado, e ha teste para isso.
created_atsegue no formato de valorunico.
Compatibilidade
Aditivo: valor sem virgula produz exatamente o SQL de antes. O front ainda nao usa
este formato de proposito — ele continua mandando a forma distribuida, que funciona
contra as duas versoes. A troca no front vira follow-up seguro depois que esta imagem
subir; antes disso, um shell novo contra um core antigo devolveria lista vazia.
Testes
go build,go vetegofmtlimpos. Os 8 casos que ja existiam seguem passando;+4 cobrindo conjunto,
NOT IN, virgula emcontainse data.Summary by Sourcery
Allow agent filters to interpret comma-separated values as sets for more compact type/model queries while preserving existing behavior for single values and dates.
New Features:
Enhancements:
Tests: