Fix missing config fields in prometheus serializer (#6823)

This commit is contained in:
Brad Vernon 2019-12-26 10:15:25 -08:00 committed by Daniel Nelson
parent 2f943e97b7
commit 40311dcd7a
1 changed files with 39 additions and 0 deletions

View File

@ -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_max_line_bytes")
delete(tbl.Fields, "influx_sort_fields") delete(tbl.Fields, "influx_sort_fields")
delete(tbl.Fields, "influx_uint_support") delete(tbl.Fields, "influx_uint_support")
@ -2000,6 +2036,9 @@ func buildSerializer(name string, tbl *ast.Table) (serializers.Serializer, error
delete(tbl.Fields, "splunkmetric_multimetric") delete(tbl.Fields, "splunkmetric_multimetric")
delete(tbl.Fields, "wavefront_source_override") delete(tbl.Fields, "wavefront_source_override")
delete(tbl.Fields, "wavefront_use_strict") 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) return serializers.NewSerializer(c)
} }