Skip to content

Comments

feat: add globbing support to collector refs in config#194

Merged
burningalchemist merged 2 commits intoburningalchemist:masterfrom
hhromic:add-collrefs-glob
Jan 31, 2023
Merged

feat: add globbing support to collector refs in config#194
burningalchemist merged 2 commits intoburningalchemist:masterfrom
hhromic:add-collrefs-glob

Conversation

@hhromic
Copy link
Contributor

@hhromic hhromic commented Jan 31, 2023

This PR implements support for glob patterns (see linked issue) in the collectors configuration of target (and jobs).

This change is almost non-breaking because glob patterns without matching terms act as exact string matchers, i.e. the previous behaviour for the collectors configuration. However, the catch is that users using matching terms, e.g. *, ?, [, ] or ^, in their collector names (a very unlikely but possible case) must now escape those characters.

The implementation is not perfectly efficient as it adds an inner for-loop and uses a map during collector resolving to ensure that collectors matching multiple patterns are only added once to the output resolved array. However, I don't think this is a big issue in practice. In any case let me know if you have any feedback.

Resolves #184

@burningalchemist
Copy link
Owner

Hey @hhromic, looks good to me! 👍 Let me play with it a bit before approving. 🙂
The edge case also looks unrealistic to me, and if it happens, I'd rather call it a bad practice. 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for globbing to resolveCollectorRefs()

2 participants