-
Notifications
You must be signed in to change notification settings - Fork 192
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* First pass at updating Span API * First pass at updated Span implementation * Update SDK Span return types to `ReadWriteSpan` Drop support for PHP 7.3 * Finish initial implementation * Implement `SpanData` * Implement `StatusData` * Re-implement and rename `NoopSpan` to `NonRecordingSpan` * Updates to support `SpanData` in exporters/span processors * Add timestamp conversion helper methods Update Exporters to use `SpanData` Start updating Exporter tests Implement non immutable `SpanData` test helper class * Finish updating exporters/converters * Fix next batch of tests * First pass at `Tracer` refactor Leverage a `SpanBuilder` to create the span Use a dedicated object to share state * Just use `NonRecordingSpan` constructor versus `create` Start of adding tests for new Tracer implementation * Remove some unneeded `max` Make `Sampler` the 2nd arg to `TraceProvider` Fix Integration tests * Add `NoopSpanProcessor` Continue updating/adding tests * Install mockery Ensure span processor is called with expected contexts/spans * Update `SpanData` to directly return dropped amounts Make `SpanProcessor#onStart` take a `ReadWriteSpan` Update empty span fallback name * Revamp `Clock` interface/implementation * Add some additional doc comments Continued work on updating test coverage * Add more `Span` tests * Get tests to a passing state * Fix type errors * Make CI happy * Apply limits within `Span` constructor and `SpanBuilder` logic Add test coverage for these cases
- Loading branch information
1 parent
0be91c2
commit 6cffcbe
Showing
112 changed files
with
4,159 additions
and
5,136 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
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,57 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace OpenTelemetry\Trace; | ||
|
||
use OpenTelemetry\Context\Context; | ||
|
||
/** | ||
* Obtained from a {@see Tracer} and used to construct a {@see Span}. | ||
* | ||
* NOTE: A span builder may only be used to construct a single span. | ||
* Calling {@see SpanBuilder::startSpan} multiple times will lead to undefined behavior. | ||
*/ | ||
interface SpanBuilder | ||
{ | ||
/** | ||
* Sets the parent {@see Context} to use. | ||
* | ||
* If no {@see Span} is available in the provided context, the resulting span will become a root span, | ||
* as if {@see SpanBuilder::setNoParent} was called. | ||
* | ||
* Defaults to {@see Context::getCurrent} when {@see SpanBuilder::startSpan} was called if not explicitly set. | ||
*/ | ||
public function setParent(Context $parentContext): SpanBuilder; | ||
|
||
/** | ||
* Makes the to be created {@see Span} a root span of a new trace. | ||
*/ | ||
public function setNoParent(): SpanBuilder; | ||
public function addLink(SpanContext $context, Attributes $attributes = null): SpanBuilder; | ||
public function setAttribute(string $key, $value): SpanBuilder; | ||
public function setAttributes(Attributes $attributes): SpanBuilder; | ||
|
||
/** | ||
* Sets an explicit start timestamp for the newly created {@see Span}. | ||
* The provided *$timestamp* is assumed to be in nanoseconds. | ||
* | ||
* Defaults to the timestamp when {@see SpanBuilder::startSpan} was called if not explicitly set. | ||
*/ | ||
public function setStartTimestamp(int $timestamp): SpanBuilder; | ||
|
||
/** | ||
* @psalm-param SpanKind::KIND_* $spanKind | ||
*/ | ||
public function setSpanKind(int $spanKind): SpanBuilder; | ||
|
||
/** | ||
* Starts and returns a new {@see Span}. | ||
* | ||
* The user _MUST_ manually end the span by calling {@see Span::end}. | ||
* | ||
* This method does _NOT_ automatically install the span into the current context. | ||
* The user is responsible for calling {@see Span::activate} when they wish to do so. | ||
*/ | ||
public function startSpan(): 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
Oops, something went wrong.