Skip to content

Commit a577307

Browse files
authored
Ignora URI (#21)
1 parent c435545 commit a577307

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/Aspect/HttpClientMetricAspect.php

+9-2
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,11 @@ public function process(ProceedingJoinPoint $proceedingJoinPoint)
4444
$method = strtoupper($arguments['keys']['method'] ?? '');
4545
$uri = $arguments['keys']['uri'] ?? '';
4646
$host = $base_uri === null ? (parse_url($uri, PHP_URL_HOST) ?? '') : $base_uri->getHost();
47-
47+
$uri = $this->shouldIgnoreUri($instance)
48+
? '<IGNORED>'
49+
: SupportUri::sanitize(parse_url($uri, PHP_URL_PATH) ?? '/');
4850
$labels = [
49-
'uri' => SupportUri::sanitize(parse_url($uri, PHP_URL_PATH) ?? '/'),
51+
'uri' => $uri,
5052
'host' => $host,
5153
'method' => $method,
5254
'http_status_code' => '200',
@@ -90,4 +92,9 @@ private function onRejected(Timer $timer, array $labels): callable
9092
return Create::rejectionFor($exception);
9193
};
9294
}
95+
96+
private function shouldIgnoreUri(Client $instance): bool
97+
{
98+
return $instance->getConfig('ignore_uri') === true;
99+
}
93100
}

0 commit comments

Comments
 (0)