Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor span context #801

Merged
merged 46 commits into from
Sep 21, 2022
Merged

Conversation

amber0612
Copy link
Contributor

@amber0612 amber0612 commented Aug 18, 2022

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
src/API/Trace/SpanContextValidator.php Outdated Show resolved Hide resolved
src/API/Trace/SpanContext.php Outdated Show resolved Hide resolved
@amber0612 amber0612 requested a review from a team as a code owner September 7, 2022 14:15
src/API/Trace/SpanContext.php Outdated Show resolved Hide resolved
src/API/Trace/SpanContext.php Outdated Show resolved Hide resolved
tests/Unit/API/Trace/SpanContextValidatorTest.php Outdated Show resolved Hide resolved
@amber0612 amber0612 requested review from kishannsangani and removed request for tidal, bobstrecansky and zsistla September 9, 2022 11:11
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
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.

$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
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 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.

None yet

5 participants