influxdata / telegraf

Agent for collecting, processing, aggregating, and writing metrics, logs, and other arbitrary data.
https://influxdata.com/telegraf
MIT License
14.63k stars 5.58k forks source link

output/postgresql: Expose time column name as config option #13744

Closed jcpunk closed 1 year ago

jcpunk commented 1 year ago

Use Case

My site has standardized on the timestamp column being named timestamp and time to just record the current clock (HH:MM:SS.xx). I'd like to be able to rename the time column to match our standards.

Expected behavior

Ability to set name of timestamp column.

Actual behavior

Hard coded to the value time at https://github.com/influxdata/telegraf/blob/master/plugins/outputs/postgresql/columns.go#L7

Additional info

No response

powersj commented 1 year ago

@phemmer any thoughts on exposing the time column name to the user? Are there any unintentional consequences of doing so?

phemmer commented 1 year ago

@phemmer any thoughts on exposing the time column name to the user? Are there any unintentional consequences of doing so?

That should be fine. Any consequence will be downstream (e.g. Grafana requires the column be named time), but that's irrelevant to telegraf. As long as the default value stays time, it should be fine to allow it to be customized.

srebhan commented 1 year ago

@jcpunk can you please test #13750 and let me know if that is what you want!?!

jcpunk commented 1 year ago

That seems to work for me and do what I'd expect.