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

Span Refactor #422

Merged
merged 25 commits into from
Sep 29, 2021
Merged

Conversation

Blacksmoke16
Copy link
Contributor

@Blacksmoke16 Blacksmoke16 commented Sep 21, 2021

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:

What still needs to be done:

  • Finish updating tests
  • Ensure everything still functions
    • Will need to update all the examples, probably will do one just to help test, but others can prob be done in a follow up PR
  • Merge in Add AttributeLimits, SpanLimits and dropped event/links counting #417 and fix conflicts
    • Pretty much have todos where they were needed so shouldn't be too bad
  • Address any PR feedback

sdk/Trace/Span.php Outdated Show resolved Hide resolved
use OpenTelemetry\Sdk\Trace\StatusData;
use OpenTelemetry\Trace as API;

class SpanData implements SDK\SpanData
Copy link
Contributor Author

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.

Copy link
Contributor Author

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.

Copy link
Collaborator

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.

Copy link
Collaborator

@bobstrecansky bobstrecansky left a 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.

.github/workflows/php.yml Show resolved Hide resolved
api/Trace/Span.php Show resolved Hide resolved
api/Trace/Span.php Show resolved Hide resolved
contrib/Otlp/SpanConverter.php Show resolved Hide resolved
contrib/Zipkin/SpanConverter.php Show resolved Hide resolved
contrib/ZipkinToNewrelic/SpanConverter.php Outdated Show resolved Hide resolved
sdk/Trace/SpanBuilder.php Outdated Show resolved Hide resolved
sdk/Trace/SpanBuilder.php Outdated Show resolved Hide resolved
sdk/Trace/Tracer.php Show resolved Hide resolved
sdk/Trace/Tracer.php Show resolved Hide resolved
Make `Sampler` the 2nd arg to `TraceProvider`
Fix Integration tests
Continue updating/adding tests
Ensure span processor is called with expected contexts/spans
api/Trace/Span.php Outdated Show resolved Hide resolved
sdk/Trace/SpanBuilder.php Outdated Show resolved Hide resolved
sdk/Trace/Tracer.php Outdated Show resolved Hide resolved
sdk/InstrumentationLibrary.php Show resolved Hide resolved
Comment on lines +40 to +43
API\Events $events,
API\Attributes $attributes,
int $totalAttributeCount,
int $totalRecordedEvents,
Copy link
Contributor

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

Copy link
Contributor Author

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.

sdk/Trace/ImmutableSpan.php Show resolved Hide resolved
Make `SpanProcessor#onStart` take a `ReadWriteSpan`
Update empty span fallback name
@codecov
Copy link

codecov bot commented Sep 29, 2021

Codecov Report

Merging #422 (2ed6256) into main (0be91c2) will decrease coverage by 3.02%.
The diff coverage is 88.03%.

Impacted file tree graph

@@             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     
Impacted Files Coverage Δ
sdk/Trace/Links.php 93.33% <ø> (ø)
sdk/Trace/NonRecordingSpan.php 42.85% <42.85%> (ø)
contrib/Otlp/Exporter.php 89.36% <66.66%> (+1.86%) ⬆️
sdk/Trace/SpanProcessor/NoopSpanProcessor.php 66.66% <66.66%> (ø)
sdk/Trace/Test/TestClock.php 66.66% <66.66%> (ø)
sdk/Trace/Test/SpanData.php 73.33% <73.33%> (ø)
sdk/Trace/TracerProvider.php 75.00% <73.33%> (-18.34%) ⬇️
sdk/Trace/SpanProcessor/SpanMultiProcessor.php 26.31% <75.00%> (-23.69%) ⬇️
sdk/Trace/SystemClock.php 75.00% <75.00%> (ø)
sdk/Trace/Tracer.php 85.71% <83.33%> (-10.72%) ⬇️
... and 32 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0be91c2...2ed6256. Read the comment docs.

@Blacksmoke16 Blacksmoke16 marked this pull request as ready for review September 29, 2021 03:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants