mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-13 20:11:19 -04:00
Add metrics for tracking rendezvous method
Update tests for metrics Add rendezvous_method to Prometheus metrics Update broker spec docs with rendezvous method metrics Bug fix
This commit is contained in:
parent
b8df42a377
commit
26ceb6e20d
8 changed files with 355 additions and 30 deletions
|
@ -21,8 +21,9 @@ import (
|
|||
func TestSQS(t *testing.T) {
|
||||
|
||||
Convey("Context", t, func() {
|
||||
ctx := NewBrokerContext(NullLogger())
|
||||
i := &IPC{ctx}
|
||||
buf := new(bytes.Buffer)
|
||||
ipcCtx := NewBrokerContext(log.New(buf, "", 0))
|
||||
i := &IPC{ipcCtx}
|
||||
|
||||
var logBuffer bytes.Buffer
|
||||
log.SetOutput(&logBuffer)
|
||||
|
@ -187,6 +188,25 @@ func TestSQS(t *testing.T) {
|
|||
numTimes += 1
|
||||
if numTimes == 1 {
|
||||
c.So(input.MessageBody, ShouldEqual, aws.String("{\"answer\":\"fake answer\"}"))
|
||||
// Ensure that match is correctly recorded in metrics
|
||||
ipcCtx.metrics.printMetrics()
|
||||
c.So(buf.String(), ShouldContainSubstring, `client-denied-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 0
|
||||
client-sqs-denied-count 0
|
||||
client-sqs-restricted-denied-count 0
|
||||
client-sqs-unrestricted-denied-count 0
|
||||
client-snowflake-sqs-match-count 8
|
||||
`)
|
||||
wg.Done()
|
||||
}
|
||||
return &sqs.SendMessageOutput{}, nil
|
||||
|
@ -194,7 +214,7 @@ func TestSQS(t *testing.T) {
|
|||
)
|
||||
runSQSHandler(sqsHandlerContext)
|
||||
|
||||
snowflake := ctx.AddSnowflake("fake", "", NATUnrestricted, 0)
|
||||
snowflake := ipcCtx.AddSnowflake("fake", "", NATUnrestricted, 0)
|
||||
|
||||
offer := <-snowflake.offerChannel
|
||||
So(offer.sdp, ShouldResemble, []byte("fake"))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue