github.com/anycable/anycable-go@v1.5.1/features/metrics.testfile (about) 1 launch :rpc, "bundle exec anyt --only-rpc" 2 wait_tcp 50051 3 4 launch :anycable, 5 "./dist/anycable-go --disconnect_mode=never --metrics_rotate_interval=3 --ping_interval=1 --metrics_log --metrics_log_filter=rpc_call_total,failed_auths_total", 6 capture_output: true 7 wait_tcp 8080 8 9 scenario = [ 10 client: { 11 multiplier: 2, 12 actions: [ 13 { 14 receive: { 15 "data>": { 16 type: "welcome" 17 } 18 } 19 }, 20 { 21 receive: { 22 "data>": { 23 type: "ping" 24 } 25 } 26 }, 27 { 28 receive: { 29 "data>": { 30 type: "ping" 31 } 32 } 33 } 34 ] 35 } 36 ] 37 38 TEST_COMMAND = <<~CMD 39 bundle exec wsdirector ws://localhost:8080/cable -i #{scenario.to_json} 40 CMD 41 42 run :wsdirector, TEST_COMMAND 43 44 result = stdout(:wsdirector) 45 46 if result !~ /2 clients, 0 failures/ 47 fail "Unexpected scenario result:\n#{result}" 48 end 49 50 # Wait for metrics to be logged 51 sleep 2 52 53 stop :anycable 54 55 logs = stdout(:anycable) 56 # We disabled disconnector, so there should be just 2 RPC calls (Connect) 57 unless logs =~ /failed_auths_total=0/ && logs =~ /rpc_call_total=2/ 58 fail "Metrics logs not found:\n#{logs}" 59 end