Implementation of ExactMatch (and Substring) is broken
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 38/100
Direzione di ricerca
Inizia da datadog_sync/utils/filter.py intorno alla riga 150 e leggi la sezione del README relativa alla deprecazione di substring e ExactMatch. Determina se la risoluzione prevista consiste nel correggere gli operatori deprecati o nel chiarire nella documentazione l’escaping richiesto; il lavoro è completo quando il comportamento scelto è coperto dai controlli esistenti del progetto e corrisponde alle indicazioni documentate.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Hello,
I was experimenting with datadog-sync and the filter option.
I wanted to exactly match a single Synthetics Test with name [Synthetics][Multilocator] Browser test to test multilocator in org 2 for Conductor gates.
I took the recommended approach and wrote a Regular expression, wrapping the name with ^ and $.
--filter "Type=synthetics_tests;Name=name;Value=^[Synthetics][Multilocator] Browser test to test multilocator in org 2 for Conductor gates$"
It didn't work.
I realized I had [ and ] in the name, so I escaped them.
--filter "Type=synthetics_tests;Name=name;Value=^\[Synthetics\]\[Multilocator\] Browser test to test multilocator in org 2 for Conductor gates$"
Since it's a pain and a pitfall to escape chars for a simple exact match, I gave a try at the ExactMatch Operator despite it being deprecated.
--filter "Type=synthetics_tests;Name=name;Value=[Synthetics][Multilocator] Browser test to test multilocator in org 2 for Conductor gates;Operator=ExactMatch"
It didn't work.
Because of the deprecation, I had an idea what could be the cause, and indeed, it's a bug in the code, simply wrapping the string without RegExp escaping the content:
elif operator_lower == EXACT_MATCH_OPERATOR:
reg_exp = f"^{f_dict[FILTER_VALUE_KEY]}$"
On the bug itself
I understand the rational for maintainers to try and have a single implementation and it's nice to have put a deprecation notice.
The feature is only deprecated at the moment, it believe should still work (a reasonable expectation from a user perspective), and, as a user, I would expect a fix.
However, the feature is deprecated, so depending on when it will be effectively deleted, possibly the best option is to update documentation and warn users that strings must be Regexp-escaped regardless of the operator.
WDYT?
Let me know when it's going to be deleted and I can offer to contribute the doc fix in the meantime if it helps.
On the deprecation of operators ExactMatch and Substring
I would like to challenge the deprecation of these operators.
I understand maintainers would like to simplify the code and I agree the Regexp operator covers all needs in one shot.
However, I would like to point that this choice puts an expectation, a responsibility and extra complexity on users that I don't find reasonable.
Yes, the tool is probably intended for devs, yes they can certainly figure how to escape their strings.
However, I doubt going beyond exact match or substring is so common of a use case (and it's only an opinion, happy to be proven wrong with data and numbers).
This means the escaping problem I faced will be solved numerous times at DD (wasting time and resources) while it could be solved just once with an improvement (revert?) to this tool and not using a regexp implementation (also slower) for everything.
WDYT?
- Lingua principale
- Python
- Stelle
- 79
- Fork
- 26
- Merge medio
- 22h 1m
- PR unite (30g)
- 25
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di DataDog/datadog-sync-cli
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 52/100
DataDog/datadog-sync-cli#698 · 1 reazione ·
-
CCM Resources Aperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
DataDog/datadog-sync-cli#697 ·
-
All security_monitoring_rules fail to sync: cases.condition is stripped from the create payload Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 68/100
DataDog/datadog-sync-cli#598 ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 55/100
DataDog/datadog-sync-cli#597 · 1 commento · 1 reazione ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 48/100
DataDog/datadog-sync-cli#501 ·
Tutte le issue di DataDog/datadog-sync-cli
Issue simili
-
agent-ready documentation needs-triage
Difficoltà 1/5 1-3 ore Idoneità per principianti 88/100
-
documentation
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 91/100
-
workflow-status page template still says reusable workflows are "triggered only by workflow_call:" Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 92/100
-
instance instance add
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 72/100
searxng/searx-instances#939 · 1 commento ·
-
area-deployment area-integrations triage:bot-seen
Difficoltà 2/5 Mezza giornata Idoneità per principianti 86/100