mirror of
https://github.com/NotAShelf/watchdog.git
synced 2026-04-17 23:58:19 +00:00
internal/aggregate: handle empty country labels; default to 'unknown'
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: Ib35708154ba06816817f094698799b7c6a6a6964
This commit is contained in:
parent
81e7168a61
commit
d1d450ec11
1 changed files with 5 additions and 1 deletions
|
|
@ -162,7 +162,11 @@ func (m *MetricsAggregator) RecordPageview(path, country, device, referrer, doma
|
||||||
labels := prometheus.Labels{"path": sanitizeLabel(path)}
|
labels := prometheus.Labels{"path": sanitizeLabel(path)}
|
||||||
|
|
||||||
if m.cfg.Site.Collect.Country {
|
if m.cfg.Site.Collect.Country {
|
||||||
labels["country"] = sanitizeLabel(country)
|
if country == "" {
|
||||||
|
labels["country"] = "unknown"
|
||||||
|
} else {
|
||||||
|
labels["country"] = sanitizeLabel(country)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if m.cfg.Site.Collect.Device {
|
if m.cfg.Site.Collect.Device {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue