Skip to content

Commit

Permalink
Fix missing config fields in prometheus serializer (influxdata#6823)
Browse files Browse the repository at this point in the history
  • Loading branch information
ibspoof authored and idohalevi committed Sep 23, 2020
1 parent a515f52 commit 5e29f1c
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -1988,6 +1988,42 @@ func buildSerializer(name string, tbl *ast.Table) (serializers.Serializer, error
}
}

if node, ok := tbl.Fields["prometheus_export_timestamp"]; ok {
if kv, ok := node.(*ast.KeyValue); ok {
if b, ok := kv.Value.(*ast.Boolean); ok {
var err error
c.PrometheusExportTimestamp, err = b.Boolean()
if err != nil {
return nil, err
}
}
}
}

if node, ok := tbl.Fields["prometheus_sort_metrics"]; ok {
if kv, ok := node.(*ast.KeyValue); ok {
if b, ok := kv.Value.(*ast.Boolean); ok {
var err error
c.PrometheusSortMetrics, err = b.Boolean()
if err != nil {
return nil, err
}
}
}
}

if node, ok := tbl.Fields["prometheus_string_as_label"]; ok {
if kv, ok := node.(*ast.KeyValue); ok {
if b, ok := kv.Value.(*ast.Boolean); ok {
var err error
c.PrometheusStringAsLabel, err = b.Boolean()
if err != nil {
return nil, err
}
}
}
}

delete(tbl.Fields, "influx_max_line_bytes")
delete(tbl.Fields, "influx_sort_fields")
delete(tbl.Fields, "influx_uint_support")
Expand All @@ -2000,6 +2036,9 @@ func buildSerializer(name string, tbl *ast.Table) (serializers.Serializer, error
delete(tbl.Fields, "splunkmetric_multimetric")
delete(tbl.Fields, "wavefront_source_override")
delete(tbl.Fields, "wavefront_use_strict")
delete(tbl.Fields, "prometheus_export_timestamp")
delete(tbl.Fields, "prometheus_sort_metrics")
delete(tbl.Fields, "prometheus_string_as_label")
return serializers.NewSerializer(c)
}

Expand Down

0 comments on commit 5e29f1c

Please sign in to comment.