Skip to content

Commit

Permalink
add metrics for admission review responses
Browse files Browse the repository at this point in the history
  • Loading branch information
tluimes committed Feb 2, 2022
1 parent c8ab1f3 commit ec33a33
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions connaisseur/flask_application.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ def handle_alert_config_error(err):


@APP.route("/mutate", methods=["POST"])
@metrics.counter('mutate_requests_total', 'Total number of mutate requests',labels={'allowed': lambda r: r.get_json(silent=True)['response']['allowed'],
'status_code': lambda r: r.get_json(silent=True)['response']['status']['code']})
def mutate():
"""
Handle the '/mutate' path and accept CREATE and UPDATE requests.
Expand Down
8 changes: 8 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,14 @@ http_request_total{method="POST",status="200"} 9.0
http_request_created{method="POST",status="200"} 1.6436681947581613e+09
# HELP http_request_exceptions_total Total number of HTTP requests which resulted in an exception
# TYPE http_request_exceptions_total counter
# HELP mutate_requests_total Total number of mutate requests
# TYPE mutate_requests_total counter
mutate_requests_total{allowed="False",status_code="403"} 4.0
mutate_requests_total{allowed="True",status_code="202"} 5.0
# HELP mutate_requests_created Total number of mutate requests
# TYPE mutate_requests_created gauge
mutate_requests_created{allowed="False",status_code="403"} 1.643760946491879e+09
mutate_requests_created{allowed="True",status_code="202"} 1.6437609592007663e+09
```

## Compatibility
Expand Down

0 comments on commit ec33a33

Please sign in to comment.