Skip to content

Commit

Permalink
analytics: Don't log on missing X-Region-Name header (#1356)
Browse files Browse the repository at this point in the history
  • Loading branch information
leszko authored Aug 12, 2024
1 parent 3d6ad06 commit 39c4009
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
5 changes: 3 additions & 2 deletions handlers/analytics.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ func (c *AnalyticsHandlersCollection) Log() httprouter.Handle {
}
geo, err := parseAnalyticsGeo(r)
if err != nil {
glog.Warningf("cannot parse geo info from analytics log request header, err=%v", err)
glog.Warningf("cannot parse geo info from analytics log request header, %v", err)
}
extData, err := c.extFetcher.Fetch(log.PlaybackID)
if err != nil {
Expand Down Expand Up @@ -171,7 +171,8 @@ func parseAnalyticsGeo(r *http.Request) (AnalyticsGeo, error) {
res.Country, missingHeader = getOrAddMissing("X-City-Country-Name", r.Header, missingHeader)
res.CountryCode, missingHeader = getOrAddMissing("X-City-Country-Code", r.Header, missingHeader)
res.Continent = analytics.GetContinent(res.CountryCode)
res.Subdivision, missingHeader = getOrAddMissing("X-Region-Name", r.Header, missingHeader)
// X-Region-Name is optional, so we don't add it into missingHeader map if missing
res.Subdivision = r.Header.Get("X-Region-Name")
res.Timezone, missingHeader = getOrAddMissing("X-Time-Zone", r.Header, missingHeader)

lat, missingHeader := getOrAddMissing("X-Latitude", r.Header, missingHeader)
Expand Down
1 change: 0 additions & 1 deletion handlers/analytics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,6 @@ func TestParseAnalyticsGeo(t *testing.T) {
},
wantErrorContains: []string{
"missing geo headers",
"X-Region-Name",
"X-Time-Zone",
},
},
Expand Down

0 comments on commit 39c4009

Please sign in to comment.