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:
parent
16ace569a0
commit
18fe1a8234
10 changed files with 542 additions and 35 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue