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

Feature suggestion: Configuration for translating non float values into float64 #298

Open
delley123 opened this issue Mar 22, 2024 · 0 comments

Comments

@delley123
Copy link

delley123 commented Mar 22, 2024

Sometimes a JSON result is not float value. And thus can not be parsed to an float64.
Example error: (msg="Failed to convert extracted value to float64" path={.state} value=GREEN err="strconv.ParseFloat: parsing "GREEN": invalid syntax; strconv.ParseFloat: parsing "GREEN")

It could be great to be able to configure a "translator" value.
Example:

  • name: example_global_value
    path: '{ .counter }'
    help: Example of a top-level global value scrape in the json
    labels:
    environment: beta # static label
    location: 'planet-{.location}' # dynamic label
    translate:
    GREEN: "0"
    AMBER: "1"
    RED: "2"
@delley123 delley123 changed the title Feature suggestion: Configuration for translating non integer values into integer Feature suggestion: Configuration for translating non float values into float64 Mar 22, 2024
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

No branches or pull requests

1 participant