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

Allow using regexp for model_map and group_map keys #3362

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ytti
Copy link
Owner

@ytti ytti commented Jan 9, 2025

Use case is that the source returns string which has unrelated and variant data but the actual model is included somewhere in this data

For example source could have space separated list of tags and one of these tags could be model name. Eg 'procurve switch'.

Closes #3360

Use case is that the source returns string which has unrelated and variant data
but the actual model is included somewhere in this data

For example source could have space separated list of tags and one of these
tags could be model name. Eg 'procurve switch'.

Closes #3360
We want to retain regexp keys for #3360
@ytti
Copy link
Owner Author

ytti commented Jan 9, 2025

I honestly cannot remember why I am normalising all keys to strings, but tests at least pass even if we don't normalise them.

@ytti ytti marked this pull request as ready for review January 9, 2025 21:03
@ytti
Copy link
Owner Author

ytti commented Jan 11, 2025

Another option, which doesn't require changing the key_to_s would be to introduce new config stanza like.

source:
  map:
    model:
       "oxidized_model": "source_model"

By swapping the order, we would guarantee the key is string, and value could be potentially any other class.

How we could transition to this new config stanza is that we could check existence of old, if old is found, we could emit warning that it's being deprecated and removed later in X, potentially link to documentation. Then we swap key/value and process the old and new stanza the same way.
We could even replace the user config with new version, however this would remove their formatting and comments as we don't preserve those when we write.

I don't feel strongly.

@ytti ytti requested a review from robertcheramy January 11, 2025 08:02
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.

Oxidized unable to parse/search multiple tags in http api call from PRTG
1 participant