mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-13 20:11:19 -04:00
Prune metrics that are reported for rendezvous
Signed-off-by: Cecylia Bocovich <cohosh@torproject.org>
This commit is contained in:
parent
dbecefa7d2
commit
5f5cbe6431
4 changed files with 50 additions and 202 deletions
|
@ -189,7 +189,11 @@ func (m *Metrics) logMetrics() {
|
|||
|
||||
func (m *Metrics) printMetrics() {
|
||||
m.lock.Lock()
|
||||
m.logger.Println("snowflake-stats-end", time.Now().UTC().Format("2006-01-02 15:04:05"), fmt.Sprintf("(%d s)", int(metricsResolution.Seconds())))
|
||||
m.logger.Println(
|
||||
"snowflake-stats-end",
|
||||
time.Now().UTC().Format("2006-01-02 15:04:05"),
|
||||
fmt.Sprintf("(%d s)", int(metricsResolution.Seconds())),
|
||||
)
|
||||
m.logger.Println("snowflake-ips", m.countryStats.Display())
|
||||
total := len(m.countryStats.unknown)
|
||||
for pType, addresses := range m.countryStats.proxies {
|
||||
|
@ -207,11 +211,14 @@ func (m *Metrics) printMetrics() {
|
|||
m.logger.Println("client-unrestricted-denied-count", binCount(sumMapValues(&m.clientUnrestrictedDeniedCount)))
|
||||
m.logger.Println("client-snowflake-match-count", binCount(sumMapValues(&m.clientProxyMatchCount)))
|
||||
|
||||
for _, rendezvousMethod := range [3]messages.RendezvousMethod{messages.RendezvousHttp, messages.RendezvousAmpCache, messages.RendezvousSqs} {
|
||||
m.logger.Printf("client-%s-denied-count %d\n", rendezvousMethod, binCount(m.clientDeniedCount[rendezvousMethod]))
|
||||
m.logger.Printf("client-%s-restricted-denied-count %d\n", rendezvousMethod, binCount(m.clientRestrictedDeniedCount[rendezvousMethod]))
|
||||
m.logger.Printf("client-%s-unrestricted-denied-count %d\n", rendezvousMethod, binCount(m.clientUnrestrictedDeniedCount[rendezvousMethod]))
|
||||
m.logger.Printf("client-snowflake-%s-match-count %d\n", rendezvousMethod, binCount(m.clientProxyMatchCount[rendezvousMethod]))
|
||||
for _, rendezvousMethod := range [3]messages.RendezvousMethod{
|
||||
messages.RendezvousHttp,
|
||||
messages.RendezvousAmpCache,
|
||||
messages.RendezvousSqs,
|
||||
} {
|
||||
m.logger.Printf("client-%s-count %d\n", rendezvousMethod, binCount(
|
||||
m.clientDeniedCount[rendezvousMethod]+m.clientProxyMatchCount[rendezvousMethod],
|
||||
))
|
||||
}
|
||||
|
||||
m.logger.Println("snowflake-ips-nat-restricted", len(m.countryStats.natRestricted))
|
||||
|
|
|
@ -157,18 +157,9 @@ func TestBroker(t *testing.T) {
|
|||
client-restricted-denied-count 8
|
||||
client-unrestricted-denied-count 0
|
||||
client-snowflake-match-count 0
|
||||
client-http-denied-count 8
|
||||
client-http-restricted-denied-count 8
|
||||
client-http-unrestricted-denied-count 0
|
||||
client-snowflake-http-match-count 0
|
||||
client-ampcache-denied-count 0
|
||||
client-ampcache-restricted-denied-count 0
|
||||
client-ampcache-unrestricted-denied-count 0
|
||||
client-snowflake-ampcache-match-count 0
|
||||
client-sqs-denied-count 0
|
||||
client-sqs-restricted-denied-count 0
|
||||
client-sqs-unrestricted-denied-count 0
|
||||
client-snowflake-sqs-match-count 0
|
||||
client-http-count 8
|
||||
client-ampcache-count 0
|
||||
client-sqs-count 0
|
||||
`)
|
||||
})
|
||||
|
||||
|
@ -193,18 +184,9 @@ client-snowflake-sqs-match-count 0
|
|||
client-restricted-denied-count 0
|
||||
client-unrestricted-denied-count 0
|
||||
client-snowflake-match-count 8
|
||||
client-http-denied-count 0
|
||||
client-http-restricted-denied-count 0
|
||||
client-http-unrestricted-denied-count 0
|
||||
client-snowflake-http-match-count 8
|
||||
client-ampcache-denied-count 0
|
||||
client-ampcache-restricted-denied-count 0
|
||||
client-ampcache-unrestricted-denied-count 0
|
||||
client-snowflake-ampcache-match-count 0
|
||||
client-sqs-denied-count 0
|
||||
client-sqs-restricted-denied-count 0
|
||||
client-sqs-unrestricted-denied-count 0
|
||||
client-snowflake-sqs-match-count 0
|
||||
client-http-count 8
|
||||
client-ampcache-count 0
|
||||
client-sqs-count 0
|
||||
`)
|
||||
})
|
||||
|
||||
|
@ -278,18 +260,9 @@ client-snowflake-sqs-match-count 0
|
|||
client-restricted-denied-count 8
|
||||
client-unrestricted-denied-count 0
|
||||
client-snowflake-match-count 0
|
||||
client-http-denied-count 8
|
||||
client-http-restricted-denied-count 8
|
||||
client-http-unrestricted-denied-count 0
|
||||
client-snowflake-http-match-count 0
|
||||
client-ampcache-denied-count 0
|
||||
client-ampcache-restricted-denied-count 0
|
||||
client-ampcache-unrestricted-denied-count 0
|
||||
client-snowflake-ampcache-match-count 0
|
||||
client-sqs-denied-count 0
|
||||
client-sqs-restricted-denied-count 0
|
||||
client-sqs-unrestricted-denied-count 0
|
||||
client-snowflake-sqs-match-count 0
|
||||
client-http-count 8
|
||||
client-ampcache-count 0
|
||||
client-sqs-count 0
|
||||
`)
|
||||
})
|
||||
|
||||
|
@ -314,18 +287,9 @@ client-snowflake-sqs-match-count 0
|
|||
client-restricted-denied-count 0
|
||||
client-unrestricted-denied-count 0
|
||||
client-snowflake-match-count 8
|
||||
client-http-denied-count 0
|
||||
client-http-restricted-denied-count 0
|
||||
client-http-unrestricted-denied-count 0
|
||||
client-snowflake-http-match-count 8
|
||||
client-ampcache-denied-count 0
|
||||
client-ampcache-restricted-denied-count 0
|
||||
client-ampcache-unrestricted-denied-count 0
|
||||
client-snowflake-ampcache-match-count 0
|
||||
client-sqs-denied-count 0
|
||||
client-sqs-restricted-denied-count 0
|
||||
client-sqs-unrestricted-denied-count 0
|
||||
client-snowflake-sqs-match-count 0
|
||||
client-http-count 8
|
||||
client-ampcache-count 0
|
||||
client-sqs-count 0
|
||||
`)
|
||||
})
|
||||
|
||||
|
@ -376,18 +340,9 @@ client-snowflake-sqs-match-count 0
|
|||
client-restricted-denied-count 8
|
||||
client-unrestricted-denied-count 0
|
||||
client-snowflake-match-count 0
|
||||
client-http-denied-count 0
|
||||
client-http-restricted-denied-count 0
|
||||
client-http-unrestricted-denied-count 0
|
||||
client-snowflake-http-match-count 0
|
||||
client-ampcache-denied-count 8
|
||||
client-ampcache-restricted-denied-count 8
|
||||
client-ampcache-unrestricted-denied-count 0
|
||||
client-snowflake-ampcache-match-count 0
|
||||
client-sqs-denied-count 0
|
||||
client-sqs-restricted-denied-count 0
|
||||
client-sqs-unrestricted-denied-count 0
|
||||
client-snowflake-sqs-match-count 0
|
||||
client-http-count 0
|
||||
client-ampcache-count 8
|
||||
client-sqs-count 0
|
||||
`)
|
||||
})
|
||||
|
||||
|
@ -414,18 +369,9 @@ client-snowflake-sqs-match-count 0
|
|||
client-restricted-denied-count 0
|
||||
client-unrestricted-denied-count 0
|
||||
client-snowflake-match-count 8
|
||||
client-http-denied-count 0
|
||||
client-http-restricted-denied-count 0
|
||||
client-http-unrestricted-denied-count 0
|
||||
client-snowflake-http-match-count 0
|
||||
client-ampcache-denied-count 0
|
||||
client-ampcache-restricted-denied-count 0
|
||||
client-ampcache-unrestricted-denied-count 0
|
||||
client-snowflake-ampcache-match-count 8
|
||||
client-sqs-denied-count 0
|
||||
client-sqs-restricted-denied-count 0
|
||||
client-sqs-unrestricted-denied-count 0
|
||||
client-snowflake-sqs-match-count 0
|
||||
client-http-count 0
|
||||
client-ampcache-count 8
|
||||
client-sqs-count 0
|
||||
`)
|
||||
})
|
||||
|
||||
|
@ -782,18 +728,9 @@ client-denied-count 0
|
|||
client-restricted-denied-count 0
|
||||
client-unrestricted-denied-count 0
|
||||
client-snowflake-match-count 0
|
||||
client-http-denied-count 0
|
||||
client-http-restricted-denied-count 0
|
||||
client-http-unrestricted-denied-count 0
|
||||
client-snowflake-http-match-count 0
|
||||
client-ampcache-denied-count 0
|
||||
client-ampcache-restricted-denied-count 0
|
||||
client-ampcache-unrestricted-denied-count 0
|
||||
client-snowflake-ampcache-match-count 0
|
||||
client-sqs-denied-count 0
|
||||
client-sqs-restricted-denied-count 0
|
||||
client-sqs-unrestricted-denied-count 0
|
||||
client-snowflake-sqs-match-count 0
|
||||
client-http-count 0
|
||||
client-ampcache-count 0
|
||||
client-sqs-count 0
|
||||
snowflake-ips-nat-restricted 0
|
||||
snowflake-ips-nat-unrestricted 0
|
||||
snowflake-ips-nat-unknown 1
|
||||
|
@ -815,18 +752,9 @@ snowflake-ips-nat-unknown 1
|
|||
client-restricted-denied-count 8
|
||||
client-unrestricted-denied-count 0
|
||||
client-snowflake-match-count 0
|
||||
client-http-denied-count 8
|
||||
client-http-restricted-denied-count 8
|
||||
client-http-unrestricted-denied-count 0
|
||||
client-snowflake-http-match-count 0
|
||||
client-ampcache-denied-count 0
|
||||
client-ampcache-restricted-denied-count 0
|
||||
client-ampcache-unrestricted-denied-count 0
|
||||
client-snowflake-ampcache-match-count 0
|
||||
client-sqs-denied-count 0
|
||||
client-sqs-restricted-denied-count 0
|
||||
client-sqs-unrestricted-denied-count 0
|
||||
client-snowflake-sqs-match-count 0
|
||||
client-http-count 8
|
||||
client-ampcache-count 0
|
||||
client-sqs-count 0
|
||||
`)
|
||||
|
||||
// Test reset
|
||||
|
@ -846,18 +774,9 @@ client-denied-count 0
|
|||
client-restricted-denied-count 0
|
||||
client-unrestricted-denied-count 0
|
||||
client-snowflake-match-count 0
|
||||
client-http-denied-count 0
|
||||
client-http-restricted-denied-count 0
|
||||
client-http-unrestricted-denied-count 0
|
||||
client-snowflake-http-match-count 0
|
||||
client-ampcache-denied-count 0
|
||||
client-ampcache-restricted-denied-count 0
|
||||
client-ampcache-unrestricted-denied-count 0
|
||||
client-snowflake-ampcache-match-count 0
|
||||
client-sqs-denied-count 0
|
||||
client-sqs-restricted-denied-count 0
|
||||
client-sqs-unrestricted-denied-count 0
|
||||
client-snowflake-sqs-match-count 0
|
||||
client-http-count 0
|
||||
client-ampcache-count 0
|
||||
client-sqs-count 0
|
||||
snowflake-ips-nat-restricted 0
|
||||
snowflake-ips-nat-unrestricted 0
|
||||
snowflake-ips-nat-unknown 0
|
||||
|
|
|
@ -194,18 +194,9 @@ func TestSQS(t *testing.T) {
|
|||
client-restricted-denied-count 0
|
||||
client-unrestricted-denied-count 0
|
||||
client-snowflake-match-count 8
|
||||
client-http-denied-count 0
|
||||
client-http-restricted-denied-count 0
|
||||
client-http-unrestricted-denied-count 0
|
||||
client-snowflake-http-match-count 0
|
||||
client-ampcache-denied-count 0
|
||||
client-ampcache-restricted-denied-count 0
|
||||
client-ampcache-unrestricted-denied-count 0
|
||||
client-snowflake-ampcache-match-count 0
|
||||
client-sqs-denied-count 0
|
||||
client-sqs-restricted-denied-count 0
|
||||
client-sqs-unrestricted-denied-count 0
|
||||
client-snowflake-sqs-match-count 8
|
||||
client-http-count 0
|
||||
client-ampcache-count 0
|
||||
client-sqs-count 8
|
||||
`)
|
||||
wg.Done()
|
||||
}
|
||||
|
|
|
@ -82,96 +82,27 @@ Metrics data from the Snowflake broker can be retrieved by sending an HTTP GET r
|
|||
A count of the number of times a client successfully received a
|
||||
proxy from the broker, rounded up to the nearest multiple of 8.
|
||||
|
||||
"client-http-denied-count" NUM NL
|
||||
"client-http-count" NUM NL
|
||||
[At most once.]
|
||||
|
||||
A count of the number of times a client has requested a proxy using
|
||||
the HTTP rendezvous method from the broker but no proxies were
|
||||
available, rounded up to the nearest multiple of 8.
|
||||
|
||||
"client-http-restricted-denied-count" NUM NL
|
||||
[At most once.]
|
||||
|
||||
A count of the number of times a client with a restricted or
|
||||
unknown NAT type has requested a proxy using the HTTP rendezvous
|
||||
method from the broker but no proxies were available, rounded up to
|
||||
the nearest multiple of 8.
|
||||
|
||||
"client-http-unrestricted-denied-count" NUM NL
|
||||
[At most once.]
|
||||
|
||||
A count of the number of times a client with an unrestricted NAT
|
||||
type has requested a proxy using the HTTP rendezvous method from
|
||||
the broker but no proxies were available, rounded up to the nearest
|
||||
the HTTP rendezvous method from the broker, rounded up to the nearest
|
||||
multiple of 8.
|
||||
|
||||
"client-snowflake-http-match-count" NUM NL
|
||||
[At most once.]
|
||||
|
||||
A count of the number of times a client successfully received a
|
||||
proxy using the HTTP rendezvous method from the broker, rounded
|
||||
up to the nearest multiple of 8.
|
||||
|
||||
"client-ampcache-denied-count" NUM NL
|
||||
"client-ampcache-count" NUM NL
|
||||
[At most once.]
|
||||
|
||||
A count of the number of times a client has requested a proxy using
|
||||
the ampcache rendezvous method from the broker but no proxies were
|
||||
available, rounded up to the nearest multiple of 8.
|
||||
the ampcache rendezvous method from the broker, rounded up to the
|
||||
nearest multiple of 8.
|
||||
|
||||
"client-ampcache-restricted-denied-count" NUM NL
|
||||
[At most once.]
|
||||
|
||||
A count of the number of times a client with a restricted or
|
||||
unknown NAT type has requested a proxy using the ampcache rendezvous
|
||||
method from the broker but no proxies were available, rounded up to
|
||||
the nearest multiple of 8.
|
||||
|
||||
"client-ampcache-unrestricted-denied-count" NUM NL
|
||||
[At most once.]
|
||||
|
||||
A count of the number of times a client with an unrestricted NAT
|
||||
type has requested a proxy using the ampcache rendezvous method from
|
||||
the broker but no proxies were available, rounded up to the nearest
|
||||
multiple of 8.
|
||||
|
||||
"client-snowflake-ampcache-match-count" NUM NL
|
||||
[At most once.]
|
||||
|
||||
A count of the number of times a client successfully received a
|
||||
proxy using the ampcache rendezvous method from the broker, rounded
|
||||
up to the nearest multiple of 8.
|
||||
|
||||
"client-sqs-denied-count" NUM NL
|
||||
"client-sqs-count" NUM NL
|
||||
[At most once.]
|
||||
|
||||
A count of the number of times a client has requested a proxy using
|
||||
the sqs rendezvous method from the broker but no proxies were
|
||||
available, rounded up to the nearest multiple of 8.
|
||||
|
||||
"client-sqs-restricted-denied-count" NUM NL
|
||||
[At most once.]
|
||||
|
||||
A count of the number of times a client with a restricted or
|
||||
unknown NAT type has requested a proxy using the sqs rendezvous
|
||||
method from the broker but no proxies were available, rounded up to
|
||||
the nearest multiple of 8.
|
||||
|
||||
"client-sqs-unrestricted-denied-count" NUM NL
|
||||
[At most once.]
|
||||
|
||||
A count of the number of times a client with an unrestricted NAT
|
||||
type has requested a proxy using the sqs rendezvous method from
|
||||
the broker but no proxies were available, rounded up to the nearest
|
||||
the sqs rendezvous method from the broker, rounded up to the nearest
|
||||
multiple of 8.
|
||||
|
||||
"client-snowflake-sqs-match-count" NUM NL
|
||||
[At most once.]
|
||||
|
||||
A count of the number of times a client successfully received a
|
||||
proxy using the sqs rendezvous method from the broker, rounded
|
||||
up to the nearest multiple of 8.
|
||||
|
||||
"snowflake-ips-nat-restricted" NUM NL
|
||||
[At most once.]
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue