Skip to content

Span Refactor#422

Merged
bobstrecansky merged 25 commits into
open-telemetry:mainfrom
Blacksmoke16:span-api-revamp
Sep 29, 2021
Merged

Span Refactor#422
bobstrecansky merged 25 commits into
open-telemetry:mainfrom
Blacksmoke16:span-api-revamp

Conversation

@Blacksmoke16

@Blacksmoke16 Blacksmoke16 commented Sep 21, 2021

Copy link
Copy Markdown
Contributor

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

Comment thread sdk/Trace/Span.php
Comment thread sdk/Trace/Span.php Outdated
Comment thread sdk/Trace/TracerProvider.php
use OpenTelemetry\Sdk\Trace\StatusData;
use OpenTelemetry\Trace as API;

class SpanData implements SDK\SpanData

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor

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.

@bobstrecansky bobstrecansky left a comment

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.

A couple initial comments but I don't think I have any comments that are blockers currently.

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

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.

Copy link
Copy Markdown
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.

Comment thread sdk/Trace/ImmutableSpan.php
Make `SpanProcessor#onStart` take a `ReadWriteSpan`
Update empty span fallback name
Comment thread composer.json
Comment thread api/Trace/Events.php
@codecov

codecov Bot commented Sep 29, 2021

Copy link
Copy Markdown

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.

Comment thread contrib/OtlpGrpc/SpanConverter.php
Comment thread phpstan.neon.dist
Comment thread psalm.xml.dist
Comment thread tests/Sdk/Integration/SpanLimitsTest.php
@Blacksmoke16
Blacksmoke16 marked this pull request as ready for review September 29, 2021 03:40
Comment thread sdk/Trace/SpanBuilder.php
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