-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch '5-prometheus-metrics' into 'master'
#5 Add prometheus metrics See merge request ix.ai/csp!7
- Loading branch information
Showing
5 changed files
with
114 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/usr/bin/env python3 | ||
# -*- coding: utf-8 -*- | ||
""" Initializes the prometheus metrics """ | ||
|
||
from prometheus_client import Counter, Info, make_wsgi_app | ||
|
||
# Prometheus metrics | ||
PROM_VALID_VIOLATION_REPORTS_COUNTER = Counter( | ||
'csp_valid_violation_reports', 'Counts the number of valid violation reports', [ | ||
'blocked_uri', | ||
'document_uri', | ||
'original_policy', | ||
'violated_directive', | ||
'line_number', | ||
'source_file', | ||
] | ||
) | ||
PROM_INVALID_VIOLATION_REPORTS_COUNTER = Counter( | ||
'csp_invalid_violation_reports', 'Counts the number of invalid violation reports', [ | ||
'reason', | ||
] | ||
) | ||
PROM_VERSION_INFO = Info('csp_version', 'Information about CSP') | ||
|
||
|
||
def init(): | ||
""" Initializes Prometheus """ | ||
return make_wsgi_app() |