-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Expand time units for ttl
config option
#33686
Comments
Pinging code owners for exporter/clickhouse: @hanjm @dmitryax @Frapschen @SpencerTorres. See Adding Labels via Comments if you do not have permissions to add labels yourself. |
I don't have super strong opinions here, just sharing some thoughts. It looks like the reason Another option for users is to simply add a comment when setting the config option. Something like: I'll defer to code owners though. |
This issue has been inactive for 60 days. It will be closed in 60 days if there is no activity. To ping code owners by adding a component label, see Adding Labels via Comments, or if you are unsure of which component this issue relates to, please ping Pinging code owners:
See Adding Labels via Comments if you do not have permissions to add labels yourself. |
Component(s)
exporter/clickhouse
Describe the issue you're reporting
When I saw we had two config options,
ttl_days
andttl
, it made sense to pick one (as we did recently by removingttl_days
in #33648)Unfortunately when I approved this, I didn't realize that the largest unit of time for
time.Duration
is hours (h
)For telemetry use cases (mainly logging), data is kept for much longer than most people measure in hours. For example, I know a day is
24h
, but what if I want to keep my log data for 6 months? While configuring my exporter I thought I could simply do180d
, but this of course fails to parse. It's not that doing the calculation to write4320h
is hard, it's just incredibly unintuitive. It's an easy mistake to make to typed
there, especially for those who don't know Go and thetime
package.The majority of units in
time.ParseDuration
are too small to be usable for a Database TTL config.I believe it would be convenient to expand this to at least include days (
d
), but if we were to do this, where would be the best place?Here are the different options, in order of least complexity:
ttl_days
. We can still mark it as deprecated, but it is very convenient.clickhouseexporter
: we can changettl
fromtime.Duration
tostring
and parse it in the local config parser function. We would add some logic for when the time containsd
, but otherwise fallback to totime.ParseDuration
.time.Duration
does not haveUnmarshal*
functions declared, so this module adds a hook to include it. We could add a new function calledStringToTimeDurationExtendedHookFunc
to expand the current behavior, and then use it in OTel confmap.This would be a non-breaking change since it doesn't affect any of the existing units. This change could benefit all OTel configs, not just ClickHouse exporter. Let me know what you think.
Thanks!
Note in case anyone points it out: This convenience is for users on Earth, and the conventional understanding that a day is 24 hours, rounded for convenience.
The text was updated successfully, but these errors were encountered: