golang / go

The Go programming language
https://go.dev
BSD 3-Clause "New" or "Revised" License
123.57k stars 17.61k forks source link

x/telemetry: add garbage collection #63884

Open findleyr opened 11 months ago

findleyr commented 11 months ago

An interesting point that came up in the context of discussing #63832 is that in some organizations data that is persisted "forever" is treated differently from data that is transient. Right now, local telemetry data is persisted until it is manually deleted (see also #63142).

We don't need local data forever: it is only needed for (1) weekly uploading, if telemetry uploading is enabled, (2) local viewing, to see what would be uploaded while making the decision to opt in, and (3) local debugging. For all of those use cases, keeping a few months of recent data is sufficient.

We should therefore garbage collect old data by default.

hyangah commented 11 months ago

Another interesting point from https://github.com/golang/go/issues/63832#issuecomment-1791125627

This data is necessary for the operation of the tool. It is also stored in a directory that is designed to hold ephemeral data, so it can be removed without issue and excluded by name from backups.

I think telemetry metadata files like mode and weekends fit well to the purpose of os.UserConfigDir(), but I am not sure about the collected data. Should we eventually consider to move them to other place outside the config dir?

findleyr commented 3 months ago

https://github.com/golang/go/issues/68406#issue-2406350422 has more commentary.

Milestoning this for Go 1.24.