-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Registration of fake opentelemetry extension to pass its existence ch…
…ecks (#83)
- Loading branch information
Showing
5 changed files
with
88 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
class TestClass { | ||
function userspace($arg1, $arg2, $arg3) { | ||
echo "* userspace() body start.\n"; | ||
echo "args:\n"; | ||
var_dump(func_get_args()); | ||
echo "* userspace() body end\n"; | ||
return "userspace_rv"; | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
prod/native/extension/phpt/tests/instrumentation_user_method_retry.phpt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
--TEST-- | ||
instrumentation - user method - retry to instrument after class loads | ||
--ENV-- | ||
ELASTIC_OTEL_LOG_LEVEL_STDERR=INFO | ||
--INI-- | ||
extension=/elastic/elastic_otel_php.so | ||
elastic_otel.bootstrap_php_part_file={PWD}/includes/bootstrap_mock.inc | ||
--FILE-- | ||
<?php | ||
declare(strict_types=1); | ||
|
||
echo "Hooking class doesn't exist:".PHP_EOL; | ||
|
||
var_dump(elastic_otel_hook("testclass", "userspace", function () { | ||
echo "*** prehook userspace()\n"; | ||
}, function () : string { | ||
echo "*** posthook userspace()\n"; | ||
})); | ||
|
||
require("includes/test_class.inc"); | ||
|
||
echo "Hooking class loaded:".PHP_EOL; | ||
|
||
var_dump(elastic_otel_hook("testclass", "userspace", function () { | ||
echo "*** prehook userspace()\n"; | ||
}, function () : string { | ||
echo "*** posthook userspace()\n"; | ||
})); | ||
|
||
echo "Test completed\n"; | ||
?> | ||
--EXPECTF-- | ||
Hooking class doesn't exist: | ||
bool(false) | ||
Hooking class loaded: | ||
bool(true) | ||
Test completed |