Skip to content

Commit

Permalink
Don't track proxied_bytes in instrument
Browse files Browse the repository at this point in the history
  • Loading branch information
oxtoacart committed Sep 22, 2022
1 parent c28f782 commit 942c6e9
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions instrument/instrument.go
Original file line number Diff line number Diff line change
Expand Up @@ -387,28 +387,28 @@ func (p *promInstrument) ProxiedBytes(sent, recv int, platform, version, app, da
by_isp := prometheus.Labels{"country": country, "isp": "omitted"}
// We care about ISPs within these countries only, to reduce cardinality of the metrics
if country == "CN" || country == "IR" || country == "AE" || country == "TK" {
by_isp["isp"] = p.ispLookup.ISP(clientIP)
by_isp["isp"] = isp
}
p.bytesSentByISP.With(by_isp).Add(float64(sent))
p.bytesRecvByISP.With(by_isp).Add(float64(recv))

// Record the proxied bytes for later reporting
p.proxiedBytesMX.Lock()
k := proxiedBytesKey{
platform: platform,
appVersion: version,
deviceID: deviceID,
geoCountry: country,
isp: isp,
}
v := p.proxiedBytes[k]
if v == nil {
v = &proxiedBytes{}
}
v.sent += sent
v.recv += recv
p.proxiedBytes[k] = v
p.proxiedBytesMX.Unlock()
// p.proxiedBytesMX.Lock()
// k := proxiedBytesKey{
// platform: platform,
// appVersion: version,
// deviceID: deviceID,
// geoCountry: country,
// isp: isp,
// }
// v := p.proxiedBytes[k]
// if v == nil {
// v = &proxiedBytes{}
// }
// v.sent += sent
// v.recv += recv
// p.proxiedBytes[k] = v
// p.proxiedBytesMX.Unlock()
}

func (p *promInstrument) reportProxiedBytes() {
Expand Down

0 comments on commit 942c6e9

Please sign in to comment.