-
Notifications
You must be signed in to change notification settings - Fork 192
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
Span Refactor #422
Span Refactor #422
Conversation
Drop support for PHP 7.3
Update Exporters to use `SpanData` Start updating Exporter tests Implement non immutable `SpanData` test helper class
Leverage a `SpanBuilder` to create the span Use a dedicated object to share state
Start of adding tests for new Tracer implementation
use OpenTelemetry\Sdk\Trace\StatusData; | ||
use OpenTelemetry\Trace as API; | ||
|
||
class SpanData implements SDK\SpanData |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a mutable version of SpanData
, mainly useful in tests as a mini builder so you don't have to provide every span constructor argument.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should probably do some composer something or other so this doesn't get shipped when installing the package. I.e. should be a development type only.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might need to move it into its own separate file and ignore it if that's what you'd like to do. I'm sure there is a way to do it for a particular class but I don't know that answer off the top of my head.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple initial comments but I don't think I have any comments that are blockers currently.
Make `Sampler` the 2nd arg to `TraceProvider` Fix Integration tests
Continue updating/adding tests
Ensure span processor is called with expected contexts/spans
API\Events $events, | ||
API\Attributes $attributes, | ||
int $totalAttributeCount, | ||
int $totalRecordedEvents, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to have count($events) !== $totalRecordedEvents
?
A Span should report a number of Events dropped: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/sdk.md#additional-span-interfaces
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to have
count($events) !== $totalRecordedEvents
?
Yea, in the case more events were added than the allowed limit. $totalRecordedEvents
would be incremented but they wouldn't be actually added to the list of events. Using this method it's possible to calculate the amount of dropped events
But thanks for that link, maybe we could change the interface a bit to expose the dropped count based on total - events.size
instead of just the total amount. That would probably be a bit more spec compliant.
Make `SpanProcessor#onStart` take a `ReadWriteSpan` Update empty span fallback name
Continued work on updating test coverage
Slightly updates the implementation to get things working with new `Span` implementation
Codecov Report
@@ Coverage Diff @@
## main #422 +/- ##
============================================
- Coverage 94.33% 91.30% -3.03%
- Complexity 758 799 +41
============================================
Files 63 67 +4
Lines 1854 1979 +125
============================================
+ Hits 1749 1807 +58
- Misses 105 172 +67
Continue to review full report at Codecov.
|
Add test coverage for these cases
Still some work to be done to ensure everything is in an actual working state, but wanted to get this created to start a discussion around the approaches and such.
Sorry for the large PR, but it's kinda core and touches a lot of stuff :/
What this PR does:
Span
constructor and how you create a spanSpanData
interface that represents an immutable snapshot of a span mainly for use as part of span exportersTracer
implementation to leverage aSpanBuilder
versus relying on multiple methods with variable amount of argumentsNoopSpan
toNonRecordingSpan
and makes it only implementSpan
, notReadWriteSpan
. Fixes Implement no-op span behavior per spec #266TracerProvider
andTracer
now leverage aTracerSharedState
in order to share the instances of idGenerator, sampler, etc.Clock
interface, rename SDKClock
toSystemClock
and introduceTestClock
Clock
instance to use by default, e.g. for testingSpanContext
constructor methods into 2, one for remote and one for non remote contextsWhat still needs to be done:
todo
s where they were needed so shouldn't be too bad