Skip to content

Commit bbdf582

Browse files
committed
feat(inputs.dds_consumer): Add support for string fields to capture boolean and string values
1 parent 479958a commit bbdf582

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

plugins/inputs/dds_consumer/dds_consumer.go

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ type DDSConsumer struct {
3535
// XML configuration names for DDS Readers
3636
ReaderConfig string `toml:"reader_config"`
3737
TagKeys []string `toml:"tag_keys"`
38+
// String fields to capture (includes booleans and strings)
39+
StringFields []string `toml:"string_fields"`
3840

3941
// RTI Connext Connector entities
4042
connector *rti.Connector
@@ -64,6 +66,11 @@ var sampleConfig = `
6466
## Tag key is an array of keys that should be added as tags.
6567
tag_keys = ["color"]
6668
69+
## String fields is an array of keys that should be added as string fields.
70+
## Use this to capture boolean and string values from DDS samples.
71+
## Supports wildcard glob matching (e.g., "*" to capture all strings/booleans).
72+
string_fields = ["*"]
73+
6774
## Override the base name of the measurement
6875
name_override = "shapes"
6976
`
@@ -115,10 +122,11 @@ func (d *DDSConsumer) Start(acc telegraf.Accumulator) error {
115122
return err
116123
}
117124

118-
// Initialize JSON parser
125+
// Initialize JSON parser with string fields support for booleans and strings
119126
d.parser = &json.Parser{
120-
MetricName: "dds",
121-
TagKeys: d.TagKeys,
127+
MetricName: "dds",
128+
TagKeys: d.TagKeys,
129+
StringFields: d.StringFields,
122130
}
123131
err = d.parser.Init()
124132
if err != nil {

0 commit comments

Comments
 (0)