Short URL: Change default expiration to never (#115029)

* Short Links: Change default expiration to never expire (-1)

Previously, short links defaulted to expiring after 7 days. This change
updates the default to -1 (never expire) to prevent automatic deletion
of shared dashboard links.

Changes:
- conf/defaults.ini: Set expire_time = -1 and update comment
- conf/sample.ini: Set expire_time = -1 and update comment
- pkg/setting/setting.go: Update MustInt default from 7 to -1

The cleanup logic already handles -1 correctly (only runs when > 0),
so no changes needed there.

This unblocks progress on short URL feature improvements by ensuring
shared links remain accessible indefinitely by default.

* fix go

* update docs / comments

* update missed comment in sample.ini

* Revert "fix go"

This reverts commit e0d099ae31.

* chore: update workspace dependencies

Run 'make update-workspace' to sync Go workspace dependencies.
This updates go.mod and go.sum files to match the current workspace state.

* chore: add modowner for apps/quotas dependency

Assign @grafana/grafana-search-and-storage as owner for apps/quotas
dependency to satisfy modowners CI check.
This commit is contained in:
Nathan Marrs
2025-12-09 20:23:27 +00:00
committed by GitHub
parent 83b0b14af6
commit 6bbb00d0a2
4 changed files with 9 additions and 14 deletions
+2 -3
View File
@@ -1747,9 +1747,8 @@ enabled = true
#################################### Short Links #############################
[short_links]
# Short links that are never accessed will be deleted as cleanup. Time is set up in days. The default is 7 days. Maximum value is 365.
# 0 means they will be deleted approximately every 10 minutes. A negative value (such as -1) will disable expiration.
expire_time = 7
# Short links that are never accessed will be deleted as cleanup. Time is set up in days. The default is -1 (never expire). Maximum value is 365.
expire_time = -1
#################################### Internal Grafana Metrics ############
# Metrics available at HTTP URL /metrics and /metrics/plugins/:pluginId
+2 -2
View File
@@ -1689,8 +1689,8 @@ default_datasource_uid =
#################################### Short Links #############################
[short_links]
# Short links which are never accessed will be deleted as cleanup. Time is in days. Default is 7 days. Max is 365. 0 means they will be deleted approximately every 10 minutes.
;expire_time = 7
# Short links that are never accessed will be deleted as cleanup. Time is set up in days. The default is -1 (never expire). Maximum value is 365.
;expire_time = -1
#################################### Internal Grafana Metrics ##########################
# Metrics available at HTTP URL /metrics and /metrics/plugins/:pluginId
@@ -2142,17 +2142,13 @@ Configures settings around the short link feature.
#### `expire_time`
Short links that are never accessed are considered expired or stale and are deleted as cleanup.
Short links that are never accessed are considered expired or stale and can be deleted as cleanup.
Set the expiration time in days.
The default is `7` days.
The default is `-1` days (never expire).
The maximum is `365` days.
A setting above the maximum uses the value `365` instead.
Setting `0` means the short links are cleaned up approximately every 10 minutes.
A negative value such as `-1` disables expiry.
{{< admonition type="caution" >}}
Short links without an expiration increase the size of the database and can't be deleted. Grafana recommends setting a duration based on your specific use case
{{< /admonition >}}
A setting above the maximum uses the value `365` instead.
A negative value such as `-1` disables expiry.
<hr>
+1 -1
View File
@@ -1330,7 +1330,7 @@ func (cfg *Cfg) parseINIFile(iniFile *ini.File) error {
cfg.QueryHistoryEnabled = queryHistory.Key("enabled").MustBool(true)
shortLinks := iniFile.Section("short_links")
cfg.ShortLinkExpiration = shortLinks.Key("expire_time").MustInt(7)
cfg.ShortLinkExpiration = shortLinks.Key("expire_time").MustInt(-1)
if cfg.ShortLinkExpiration > 365 {
cfg.Logger.Warn("short_links expire_time must be less than 366 days. Setting to 365 days")