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.parser): Allow also non-string fields #13553

Merged
merged 1 commit into from
Jul 10, 2023

Conversation

srebhan
Copy link
Member

@srebhan srebhan commented Jul 5, 2023

resolves #13546

This PR allows to parse non-string fields in the parser processor to e.g. decode binary data. In the example from #13546 the input data looks like

mes,t1=y operating_state=13u,value=42.0 1688556620000000000

and the operating_state should be decoded into its bit-values. With the present PR this can easily be done using

[[processors.parser]]
  parse_fields = ["operating_state"]
  drop_original = false
  merge = "override"
  data_format = "binary"

  [[processors.parser.binary]]
    entries = [
      { name = "alarm_0", type = "bool", bits=1 },
      { name = "alarm_1", type = "bool", bits=1 },
      { name = "alarm_2", type = "bool", bits=1 },
      { name = "alarm_3", type = "bool", bits=1 },
      { name = "alarm_4", type = "bool", bits=1 },
      { name = "alarm_5", type = "bool", bits=1 },
      { name = "alarm_6", type = "bool", bits=1 },
      { name = "alarm_7", type = "bool", bits=1 },
    ]

resulting in the following output

mes,t1=y alarm_0=false,alarm_1=false,alarm_2=false,alarm_3=false,alarm_4=true,alarm_5=true,alarm_6=false,alarm_7=true,operating_state=13i,value=42 1688556620000000000

@telegraf-tiger telegraf-tiger bot added feat Improvement on an existing feature such as adding a new setting/mode to an existing plugin plugin/processor labels Jul 5, 2023
@telegraf-tiger
Copy link
Contributor

telegraf-tiger bot commented Jul 5, 2023

@powersj
Copy link
Contributor

powersj commented Jul 5, 2023

@srebhan assigning to you as well while you wait on feedback

@srebhan srebhan 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 Jul 5, 2023
@srebhan srebhan merged commit c28df89 into influxdata:master Jul 10, 2023
@srebhan srebhan deleted the processor_parser_issue_13546 branch July 10, 2023 11:55
@srebhan srebhan added this to the v1.28.0 milestone Jul 10, 2023
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.

feat(processor.status_decode): Decode integer status codes
2 participants