This repository has been archived by the owner on Oct 3, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Failing test for default timestamp * Add phpt tests for extension when you provide invalid startTime options * Extension ignores invalid startTime options (only allow int/float) * Extension tracer sets default startTime * Fix test description
- Loading branch information
Showing
5 changed files
with
70 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
--TEST-- | ||
OpenCensus Trace: Bug 131: Providing integer start time should work | ||
--FILE-- | ||
<?php | ||
|
||
opencensus_trace_begin('foo', ['startTime' => (int) microtime(true)]); | ||
opencensus_trace_finish(); | ||
$spans = opencensus_trace_list(); | ||
|
||
echo 'Number of spans: ' . count($spans) . PHP_EOL; | ||
$span = $spans[0]; | ||
var_dump($span->startTime()); | ||
|
||
$test = microtime(true) - 1 < $span->startTime(); | ||
echo 'Start time just happened: ' . $test; | ||
|
||
?> | ||
--EXPECTF-- | ||
Number of spans: 1 | ||
float(%d) | ||
Start time just happened: 1 |
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,21 @@ | ||
--TEST-- | ||
OpenCensus Trace: Bug 131: Providing null start time defaults to a current time | ||
--FILE-- | ||
<?php | ||
|
||
opencensus_trace_begin('foo', ['startTime' => null]); | ||
opencensus_trace_finish(); | ||
$spans = opencensus_trace_list(); | ||
|
||
echo 'Number of spans: ' . count($spans) . PHP_EOL; | ||
$span = $spans[0]; | ||
var_dump($span->startTime()); | ||
|
||
$test = microtime(true) - 1 < $span->startTime(); | ||
echo 'Start time just happened: ' . $test; | ||
|
||
?> | ||
--EXPECTF-- | ||
Number of spans: 1 | ||
float(%d.%d) | ||
Start time just happened: 1 |
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