Skip to content

Refactor span context#801

Merged
bobstrecansky merged 46 commits into
open-telemetry:mainfrom
amber0612:RefactorSpanContext
Sep 21, 2022
Merged

Refactor span context#801
bobstrecansky merged 46 commits into
open-telemetry:mainfrom
amber0612:RefactorSpanContext

Conversation

@amber0612

@amber0612 amber0612 commented Aug 18, 2022

Copy link
Copy Markdown
Contributor

PR for #618
Remove use OpenTelemetry\API\Trace as API;
Move factory methods into dedicated factory
Move validation methods into dedicated validatoe
Move constructor and properties to the top

@amber0612
amber0612 marked this pull request as ready for review August 26, 2022 14:53
Comment thread src/API/Trace/SpanContextInterface.php
Comment thread src/API/Trace/SpanContext.php
Comment thread src/API/Trace/SpanContextValidator.php Outdated
Comment thread src/API/Trace/SpanContext.php Outdated
@amber0612
amber0612 requested a review from a team September 7, 2022 14:15
Comment thread tests/Unit/API/Trace/Propagation/TraceContextValidatorTest.php Outdated
Comment thread tests/Unit/API/Trace/SpanContextValidatorTest.php Outdated
Comment thread src/API/Trace/SpanContext.php Outdated
Comment thread src/API/Trace/SpanContext.php Outdated
Comment thread tests/Unit/API/Trace/Propagation/TraceContextValidatorTest.php Outdated
Comment thread tests/Unit/API/Trace/Propagation/TraceContextValidatorTest.php Outdated
Comment thread tests/Unit/API/Trace/Propagation/TraceContextValidatorTest.php Outdated
Comment thread tests/Unit/API/Trace/SpanContextValidatorTest.php Outdated
@amber0612
amber0612 requested review from kishannsangani and removed request for bobstrecansky, tidal and zsistla September 9, 2022 11:11
Comment thread src/API/Trace/SpanContextFactory.php Outdated
public const TRACE_FLAG_DEFAULT = 0x00;

/** @inheritDoc */
public static function createFromRemoteParent(string $traceId, string $spanId, int $traceFlags= self::TRACE_FLAG_DEFAULT, ?TraceStateInterface $traceState = null): SpanContextInterface

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still think that these methods should stay in SpanContext.

Comment thread src/API/Trace/SpanContext.php Outdated
$this->isSampled = ($traceFlags & self::TRACE_FLAG_SAMPLED) === self::TRACE_FLAG_SAMPLED;
$this->traceFlags = $traceFlags;
$this->isValid = self::isValidTraceId($this->traceId) && self::isValidSpanId($this->spanId);
$this->isValid = SpanContextValidator::isValidTraceId($this->traceId) && SpanContextValidator::isValidSpanId($this->spanId);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be moved into if-block above / should be moved into factory method to be able to reuse ::getInvalid() singleton.

@bobstrecansky
bobstrecansky dismissed kishannsangani’s stale review September 21, 2022 12:07

Changes have been made

@bobstrecansky
bobstrecansky merged commit c0a6279 into open-telemetry:main Sep 21, 2022
@amber0612
amber0612 deleted the RefactorSpanContext branch September 26, 2022 06:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants