Add comments to metrics
To improve readability.
This commit is contained in:
parent
181edf589c
commit
83785cc77d
1 changed files with 4 additions and 0 deletions
|
@ -434,9 +434,13 @@ async fn metrics(
|
||||||
metrics: &State<WebhookeyMetrics>,
|
metrics: &State<WebhookeyMetrics>,
|
||||||
config: &State<Config>,
|
config: &State<Config>,
|
||||||
) -> Option<String> {
|
) -> Option<String> {
|
||||||
|
// Are metrics configured?
|
||||||
if let Some(metrics_config) = &config.metrics {
|
if let Some(metrics_config) = &config.metrics {
|
||||||
|
// Are metrics enabled?
|
||||||
if metrics_config.enabled {
|
if metrics_config.enabled {
|
||||||
|
// Is a filter configured?
|
||||||
if let Some(filter) = &metrics_config.ip_filter {
|
if let Some(filter) = &metrics_config.ip_filter {
|
||||||
|
// Does the request match the filter?
|
||||||
if filter.validate(&address.ip()) {
|
if filter.validate(&address.ip()) {
|
||||||
return Some(get_metrics(metrics));
|
return Some(get_metrics(metrics));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue