-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcustomize_handlers.phpt
More file actions
41 lines (37 loc) · 914 Bytes
/
customize_handlers.phpt
File metadata and controls
41 lines (37 loc) · 914 Bytes
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
--TEST--
Check if WithSpan handlers can be changed via config
--SKIPIF--
<?php if (PHP_VERSION_ID < 80100) die('skip requires PHP >= 8.1'); ?>
--EXTENSIONS--
opentelemetry
--INI--
opentelemetry.attr_hooks_enabled = On
opentelemetry.attr_pre_handler_function = custom_pre
opentelemetry.attr_post_handler_function = custom_post
--FILE--
<?php
include dirname(__DIR__) . '/mocks/WithSpan.php';
use OpenTelemetry\API\Instrumentation\WithSpan;
function custom_pre(): void
{
var_dump('custom_pre handler');
}
function custom_post(): void
{
var_dump('custom_post handler');
}
#[WithSpan]
function foo(): void
{
var_dump('test');
}
var_dump(ini_get('opentelemetry.attr_pre_handler_function'));
var_dump(ini_get('opentelemetry.attr_post_handler_function'));
foo();
?>
--EXPECT--
string(10) "custom_pre"
string(11) "custom_post"
string(18) "custom_pre handler"
string(4) "test"
string(19) "custom_post handler"