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

feat(processors.converter): Add support for base64 encoded IEEE floats #16214

Merged

Conversation

vkrasnici
Copy link
Contributor

@vkrasnici vkrasnici commented Nov 20, 2024

Summary

When using Cisco Telemetry MDT (cisco_telemetry_mdt) Input Plugin in combination with OpenConfig power Yang model (openconfig-platform:components/component/power-supply) the data is received but the power values are Base64 Encoded IEEE 754 Float32.
The format received looks like below:

{"fields":{"data_json_content_state_openconfig-platform-psu:input-current":"QWAAAA==","data_json_timestamp":"1731938073759"},"name":"file","tags":{"host":"YJ4"},"timestamp":1732125250}
{"fields":{"data_json_content_state_openconfig-platform-psu:output-current":"QcAAAA==","data_json_timestamp":"1731938073763"},"name":"file","tags":{"host":"YJ4"},"timestamp":1732125250}
{"fields":{"data_json_content_state_openconfig-platform-psu:input-current":"QVAAAA==","data_json_timestamp":"1731938073766"},"name":"file","tags":{"host":"YJ4"},"timestamp":1732125250}
{"fields":{"data_json_content_state_openconfig-platform-psu:output-power":"RKeAAA==","data_json_timestamp":"1731938073773"},"name":"file","tags":{"host":"YJ4"},"timestamp":1732125250}

This makes the data unusable for metrics, as metrics should be represented by float/int (number). Using parser.json and parse_fields_base64 converts b64 to byte/str, but that's not enough to convert it to metrics, hence the motivation to add the converter support.

Checklist

  • No AI generated code was used in this PR

Related issues

Closes #16213

@vkrasnici vkrasnici changed the title Added support for base64 encoded ieee float32 types feat: added support for base64 encoded ieee float32 types Nov 20, 2024
@telegraf-tiger telegraf-tiger bot added the feat Improvement on an existing feature such as adding a new setting/mode to an existing plugin label Nov 20, 2024
@vkrasnici vkrasnici changed the title feat: added support for base64 encoded ieee float32 types feat(processors.converter): added support for base64 encoded ieee float32 types Nov 21, 2024
Copy link
Member

@DStrand1 DStrand1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! I have a preliminary comment about the linter failure on this PR

docs/LICENSE_OF_DEPENDENCIES.md Outdated Show resolved Hide resolved
@DStrand1 DStrand1 self-assigned this Nov 23, 2024
@vkrasnici vkrasnici requested a review from DStrand1 November 25, 2024 12:59
plugins/processors/converter/README.md Outdated Show resolved Hide resolved
plugins/processors/converter/sample.conf Outdated Show resolved Hide resolved
plugins/processors/converter/converter.go Show resolved Hide resolved
@vkrasnici vkrasnici requested a review from DStrand1 November 25, 2024 17:09
@vkrasnici
Copy link
Contributor Author

@DStrand1 is there anything you want me to change?

@telegraf-tiger
Copy link
Contributor

telegraf-tiger bot commented Dec 2, 2024

@DStrand1 DStrand1 assigned srebhan and unassigned DStrand1 Feb 4, 2025
@DStrand1 DStrand1 added the ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review. label Feb 4, 2025
Copy link
Member

@srebhan srebhan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @vkrasnici for your contribution!

plugins/processors/converter/README.md Outdated Show resolved Hide resolved
plugins/processors/converter/sample.conf Outdated Show resolved Hide resolved
@srebhan srebhan changed the title feat(processors.converter): added support for base64 encoded ieee float32 types feat(processors.converter): Add support for base64 encoded IEEE floats Feb 4, 2025
@srebhan
Copy link
Member

srebhan commented Feb 4, 2025

CI errors are unrelated.

@srebhan srebhan merged commit b58c6a4 into influxdata:master Feb 4, 2025
10 of 15 checks passed
@github-actions github-actions bot added this to the v1.34.0 milestone Feb 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat Improvement on an existing feature such as adding a new setting/mode to an existing plugin plugin/processor ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Base64 Encoded IEEE 754 Float32 decoder/converter required
3 participants