Updated broker specification and comments

This commit is contained in:
Cecylia Bocovich 2019-11-26 10:44:40 -05:00
parent 97554e03e4
commit 94de69aa36
3 changed files with 22 additions and 59 deletions

View file

@ -1,66 +1,11 @@
/* /*
We export metrics in the following format: We export metrics in the format specified in our broker spec:
https://gitweb.torproject.org/pluggable-transports/snowflake.git/tree/doc/broker-spec.txt
"snowflake-stats-end" YYYY-MM-DD HH:MM:SS (NSEC s) NL
[At most once.]
YYYY-MM-DD HH:MM:SS defines the end of the included measurement
interval of length NSEC seconds (86400 seconds by default).
"snowflake-ips" CC=NUM,CC=NUM,... NL
[At most once.]
List of mappings from two-letter country codes to the number of
unique IP addresses of snowflake proxies that have polled.
"snowflake-ips-total" NUM NL
[At most once.]
A count of the total number of unique IP addresses of snowflake
proxies that have polled.
"snowflake-ips-standalone" NUM NL
[At most once.]
A count of the total number of unique IP addresses of snowflake
proxies of type "standalone" that have polled.
"snowflake-ips-badge" NUM NL
[At most once.]
A count of the total number of unique IP addresses of snowflake
proxies of type "badge" that have polled.
"snowflake-ips-webext" NUM NL
[At most once.]
A count of the total number of unique IP addresses of snowflake
proxies of type "webext" that have polled.
"snowflake-idle-count" NUM NL
[At most once.]
A count of the number of times a proxy has polled but received
no client offer, rounded up to the nearest multiple of 8.
"client-denied-count" NUM NL
[At most once.]
A count of the number of times a client has requested a proxy
from the broker but no proxies were available, rounded up to
the nearest multiple of 8.
"client-snowflake-match-count" NUM NL
[At most once.]
A count of the number of times a client successfully received a
proxy from the broker, rounded up to the nearest multiple of 8.
*/ */
package main package main
import ( import (
// "golang.org/x/net/internal/timeseries"
"fmt" "fmt"
"log" "log"
"math" "math"

View file

@ -17,7 +17,7 @@ const version = "1.1"
{ {
Sid: [generated session id of proxy], Sid: [generated session id of proxy],
Version: 1.1, Version: 1.1,
Type: [badge|webext|standalone] Type: ["badge"|"webext"|"standalone"]
} }
== ProxyPollResponse == == ProxyPollResponse ==
@ -87,7 +87,7 @@ func EncodePollRequest(sid string, proxyType string) ([]byte, error) {
} }
// Decodes a poll message from a snowflake proxy and returns the // Decodes a poll message from a snowflake proxy and returns the
// sid of the proxy on success and an error if it failed // sid and proxy type of the proxy on success and an error if it failed
func DecodePollRequest(data []byte) (string, string, error) { func DecodePollRequest(data []byte) (string, string, error) {
var message ProxyPollRequest var message ProxyPollRequest

View file

@ -31,6 +31,24 @@ Metrics data from the Snowflake broker can be retrieved by sending an HTTP GET r
A count of the total number of unique IP addresses of Snowflake A count of the total number of unique IP addresses of Snowflake
proxies that have polled. proxies that have polled.
"snowflake-ips-standalone" NUM NL
[At most once.]
A count of the total number of unique IP addresses of snowflake
proxies of type "standalone" that have polled.
"snowflake-ips-badge" NUM NL
[At most once.]
A count of the total number of unique IP addresses of snowflake
proxies of type "badge" that have polled.
"snowflake-ips-webext" NUM NL
[At most once.]
A count of the total number of unique IP addresses of snowflake
proxies of type "webext" that have polled.
"snowflake-idle-count" NUM NL "snowflake-idle-count" NUM NL
[At most once.] [At most once.]