Skip to content

add raw_expression #162

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

Merged
merged 1 commit into from
Jan 7, 2025
Merged

add raw_expression #162

merged 1 commit into from
Jan 7, 2025

Conversation

fatpat
Copy link
Contributor

@fatpat fatpat commented Dec 30, 2024

add raw_expression in metric config in order to handle dynamic string MQTT values. It runs without type conversion while expressiondoes.

here is a use case: a MQTT metric returned a string with the current datetime using the format H20241227104456 and it would be nice to be able to convert this to the corresponding unix time() to make it a prometheus valid value. Currently mqtt2prometheus is not able to handle this usecase.

With raw_expression, I would set the following:

raw_expression: 'date(string(raw_value), "H060102150405", "Europe/Paris").Unix()'

Note: this PR must be merged after #157 and after #161

@hikhvar
Copy link
Owner

hikhvar commented Dec 31, 2024

Merged #157 and #161, can you rebase?

@fatpat fatpat force-pushed the raw_expression branch 2 times, most recently from bc98ca8 to 4eb5c02 Compare January 1, 2025 06:11
@fatpat
Copy link
Contributor Author

fatpat commented Jan 6, 2025

@hikhvar

I'd like to merge this one if possible as there's another one coming after that depend on this one

thank you

@hikhvar
Copy link
Owner

hikhvar commented Jan 7, 2025

Thank you for your patience. Life happened!

@hikhvar hikhvar merged commit ce8ad07 into hikhvar:master Jan 7, 2025
15 of 16 checks passed
@fatpat fatpat deleted the raw_expression branch January 8, 2025 08:30
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.

2 participants