-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds activeSpanSource interface and include it as a dependency on tra…
…cer.
- Loading branch information
Showing
9 changed files
with
219 additions
and
39 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,40 @@ | ||
<?php | ||
|
||
namespace OpenTracing; | ||
|
||
/** | ||
* Keeps track of the current active `Span`. | ||
*/ | ||
interface ActiveSpanSource | ||
{ | ||
/** | ||
* Activates an `Span`, so that it is used as a parent when creating new spans. | ||
* The implementation must keep track of the active spans sequence, so | ||
* that previous spans can be resumed after a deactivation. | ||
* | ||
* @param Span $span | ||
*/ | ||
public function activate(Span $span); | ||
|
||
/** | ||
* Returns current active `Span`. | ||
* | ||
* @return Span | ||
*/ | ||
public function getActiveSpan(); | ||
|
||
/** | ||
* Deactivate the given `Span`, restoring the previous active one. | ||
* | ||
* This method must take in consideration that a `Span` may be deactivated | ||
* when it's not really active. In that case, the current active stack | ||
* must not be changed (idempotency). | ||
* | ||
* Do not confuse it with the finish concept: | ||
* - $span->deactivate() -> the span is not active but still "running" | ||
* - $span->finish() -> the span is finished and deactivated | ||
* | ||
* @param Span $span | ||
*/ | ||
public function deactivate(Span $span); | ||
} |
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,24 @@ | ||
<?php | ||
|
||
namespace OpenTracing; | ||
|
||
final class NoopActiveSpanSource implements ActiveSpanSource | ||
{ | ||
public static function create() | ||
{ | ||
return new self(); | ||
} | ||
|
||
public function activate(Span $span) | ||
{ | ||
} | ||
|
||
public function getActiveSpan() | ||
{ | ||
return NoopSpan::create(); | ||
} | ||
|
||
public function deactivate(Span $span) | ||
{ | ||
} | ||
} |
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
Oops, something went wrong.