File tree 4 files changed +12
-11
lines changed
4 files changed +12
-11
lines changed Original file line number Diff line number Diff line change 1
- 1.3.1 (TBD):
2
- - Support finer granularity timeouts and milliseconds granularity
1
+ 1.4.0 (TBD):
2
+ - Add support for a custom tracer for client methods.
3
+ - Support finer granularity timeouts and milliseconds granularity.
3
4
4
5
1.3.0 (Nov 10, 2023):
5
6
- Added in-memory evaluation cache for the duration of a request.
Original file line number Diff line number Diff line change 3
3
require_once '../vendor/autoload.php ' ;
4
4
5
5
use \SplitIO \ThinSdk \Factory ;
6
- use \SplitIO \ThinSdk \Utils \Tracer ;
7
- use \SplitIO \ThinSdk \Utils \TracerHook ;
6
+ use \SplitIO \ThinSdk \Utils \Tracing \ Tracer ;
7
+ use \SplitIO \ThinSdk \Utils \Tracing \ TracerHook ;
8
8
9
9
class CustomTracer implements TracerHook
10
10
{
11
11
12
12
private $ events = [];
13
13
14
- public function on (int $ method , int $ event , ? array $ arguments )
14
+ public function on (array $ event )
15
15
{
16
16
// assume we only care about getTreatment() calls...
17
- if ($ method != Tracer::METHOD_GET_TREATMENT ) {
17
+ if ($ event [ ' method ' ] != Tracer::METHOD_GET_TREATMENT ) {
18
18
return ;
19
19
}
20
20
21
- switch ($ event ) {
21
+ switch ($ event[ ' event ' ] ) {
22
22
case Tracer::EVENT_START :
23
- array_push ($ this ->events , "start ( " . json_encode ($ arguments ) . ") -- " . microtime (true ));
23
+ array_push ($ this ->events , "start ( " . json_encode ($ event [ ' arguments ' ] ) . ") -- " . microtime (true ));
24
24
break ;
25
25
case Tracer::EVENT_RPC_START :
26
26
array_push ($ this ->events , "about to send rpc -- " . microtime (true ));
@@ -54,7 +54,7 @@ public function getEvents(): array
54
54
'level ' => \Psr \Log \LogLevel::INFO ,
55
55
],
56
56
'utils ' => [
57
- '__tracer ' => [
57
+ 'tracer ' => [
58
58
'hook ' => $ ct ,
59
59
'forwardArgs ' => true ,
60
60
]
Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ public static function fromArray(array $config): Utils
39
39
return new Utils (
40
40
$ config ['impressionListener ' ] ?? $ d ->impressionListener (),
41
41
EvaluationCache::fromArray ($ config ['evaluationCache ' ] ?? []),
42
- Tracer::fromArray ($ config ['__tracer ' ] ?? []),
42
+ Tracer::fromArray ($ config ['tracer ' ] ?? []),
43
43
);
44
44
}
45
45
Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ public function testConfigParsing()
35
35
'maxSize ' => 1234 ,
36
36
'customHash ' => $ ihMock ,
37
37
],
38
- '__tracer ' => [
38
+ 'tracer ' => [
39
39
'hook ' => $ tMock ,
40
40
'forwardArgs ' => true ,
41
41
],
You can’t perform that action at this time.
0 commit comments