-
Notifications
You must be signed in to change notification settings - Fork 60
Expand file tree
/
Copy pathHttpClientTracing.php
More file actions
55 lines (45 loc) · 1.12 KB
/
HttpClientTracing.php
File metadata and controls
55 lines (45 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php
declare(strict_types=1);
namespace Zipkin\Instrumentation\Http\Client;
use Zipkin\Tracing;
use Zipkin\Instrumentation\Http\Request;
/**
* ClientTracing includes all the elements needed to instrument a
* HTTP client.
*/
class HttpClientTracing
{
private Tracing $tracing;
private HttpClientParser $parser;
/**
* function that decides to sample or not an unsampled
* request.
*
* @var callable(Request):?bool|null
*/
private $requestSampler;
public function __construct(
Tracing $tracing,
?HttpClientParser $parser = null,
?callable $requestSampler = null
) {
$this->tracing = $tracing;
$this->parser = $parser ?? new DefaultHttpClientParser();
$this->requestSampler = $requestSampler;
}
public function getTracing(): Tracing
{
return $this->tracing;
}
/**
* @return (callable(Request):?bool)|null
*/
public function getRequestSampler(): ?callable
{
return $this->requestSampler;
}
public function getParser(): HttpClientParser
{
return $this->parser;
}
}