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:
Michael Pu 2024-01-28 17:09:08 -05:00 committed by Cecylia Bocovich
parent b8df42a377
commit 26ceb6e20d
No known key found for this signature in database
GPG key ID: 009DE379FD9B7B90
8 changed files with 355 additions and 30 deletions

View file

@ -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"))