internal/api: better multi-sites support; validate events against allowed domains

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: Iff1ced4966b4d42cfd6dfefb0cfd97696a6a6964
This commit is contained in:
raf 2026-03-01 14:27:20 +03:00
commit 18fe1a8234
Signed by: NotAShelf
GPG key ID: 29D95B64378DB4BF
10 changed files with 542 additions and 35 deletions

View file

@ -25,7 +25,7 @@ func TestMetricsAggregator_RecordPageview(t *testing.T) {
agg := NewMetricsAggregator(registry, NewCustomEventRegistry(100), cfg)
// Record pageview with all dimensions
agg.RecordPageview("/home", "US", "desktop", "google.com")
agg.RecordPageview("/home", "US", "desktop", "google.com", "")
// Verify metric was recorded
expected := `
@ -54,7 +54,7 @@ func TestMetricsAggregator_RecordPageview_MinimalDimensions(t *testing.T) {
agg := NewMetricsAggregator(registry, NewCustomEventRegistry(100), cfg)
// Record pageview with only path
agg.RecordPageview("/home", "", "", "")
agg.RecordPageview("/home", "", "", "", "")
// Verify metric was recorded
expected := `
@ -176,7 +176,7 @@ func TestMetricsAggregator_MustRegister(t *testing.T) {
agg.MustRegister(promRegistry)
// Record some metrics to ensure they show up
agg.RecordPageview("/test", "", "", "")
agg.RecordPageview("/test", "", "", "", "")
agg.RecordPathOverflow()
// Verify metrics can be gathered