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): added support for base64 encoded ieee float32 types #16214

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

Conversation

vkrasnici
Copy link

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

This resolves issue #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
@telegraf-tiger
Copy link
Contributor

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

@@ -8,6 +8,7 @@ following works:
- collectd.org [ISC License](https://github.com/collectd/go-collectd/blob/master/LICENSE)
- dario.cat/mergo [BSD 3-Clause "New" or "Revised" License](https://github.com/imdario/mergo/blob/master/LICENSE)
- filippo.io/edwards25519 [BSD 3-Clause "New" or "Revised" License](https://github.com/FiloSottile/edwards25519/blob/main/LICENSE)
- github.com/99designs/go-keychain [MIT License](https://github.com/99designs/go-keychain/blob/master/LICENSE)
Copy link
Member

Choose a reason for hiding this comment

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

Could you remove these changes? They don't seem to be needed and are causing a linter test failure

@DStrand1 DStrand1 self-assigned this Nov 23, 2024
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants