Add tags for ip blocklisted metric

This commit is contained in:
9seconds
2022-03-21 13:42:13 +03:00
parent aa7e488a3a
commit 534d5b755e
7 changed files with 68 additions and 16 deletions
+12 -1
View File
@@ -156,7 +156,18 @@ func (suite *PrometheusTestSuite) TestEventIPBlocklisted() {
data, err := suite.Get()
suite.NoError(err)
suite.Contains(data, `mtg_ip_blocklisted 1`)
suite.Contains(data, `mtg_ip_blocklisted{ip_list="blocklist"} 1`)
}
func (suite *PrometheusTestSuite) TestEventIPAllowlisted() {
suite.prometheus.EventIPBlocklisted(
mtglib.NewEventIPAllowlisted(net.ParseIP("2001:db8::68")))
time.Sleep(100 * time.Millisecond)
data, err := suite.Get()
suite.NoError(err)
suite.Contains(data, `mtg_ip_blocklisted{ip_list="allowlist"} 1`)
}
func (suite *PrometheusTestSuite) TestEventReplayAttack() {