Skip to content

Make AttributesInterface immutable#542

Closed
Nevay wants to merge 6 commits into
open-telemetry:mainfrom
Nevay:feature/attributes-immutable
Closed

Make AttributesInterface immutable#542
Nevay wants to merge 6 commits into
open-telemetry:mainfrom
Nevay:feature/attributes-immutable

Conversation

@Nevay

@Nevay Nevay commented Jan 6, 2022

Copy link
Copy Markdown
Contributor

Makes AttributesInterface immutable by introducing AttributesBuilderInterface as mutable builder.

Related:
#521 (comment)
#520

@codecov

codecov Bot commented Jan 6, 2022

Copy link
Copy Markdown

Codecov Report

Merging #542 (0cb861f) into main (c7f3361) will increase coverage by 0.09%.
The diff coverage is 98.98%.

❗ Current head 0cb861f differs from pull request most recent head 89c510a. Consider uploading reports for the commit 89c510a to get more accurate results
Impacted file tree graph

@@             Coverage Diff              @@
##               main     #542      +/-   ##
============================================
+ Coverage     95.18%   95.28%   +0.09%     
- Complexity      934      951      +17     
============================================
  Files            94       96       +2     
  Lines          2286     2334      +48     
============================================
+ Hits           2176     2224      +48     
  Misses          110      110              
Flag Coverage Δ
7.4 94.75% <98.98%> (+0.11%) ⬆️
8.0 94.77% <98.98%> (+0.10%) ⬆️
8.1 95.27% <98.98%> (+0.09%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/SDK/Trace/Sampler/ParentBased.php 75.00% <ø> (ø)
src/SDK/Trace/Span.php 97.14% <94.11%> (+1.80%) ⬆️
src/API/Trace/NonRecordingSpan.php 100.00% <100.00%> (ø)
src/SDK/Attributes.php 100.00% <100.00%> (ø)
src/SDK/AttributesBuilder.php 100.00% <100.00%> (ø)
src/SDK/AttributesFactory.php 100.00% <100.00%> (ø)
src/SDK/Resource/ResourceInfo.php 100.00% <100.00%> (ø)
src/SDK/Trace/Event.php 100.00% <100.00%> (ø)
src/SDK/Trace/ImmutableSpan.php 100.00% <100.00%> (ø)
src/SDK/Trace/Link.php 80.00% <100.00%> (ø)
... and 9 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 c7f3361...89c510a. Read the comment docs.

Comment thread src/SDK/AttributesBuilder.php
Comment thread src/SDK/Trace/Span.php
(null === $this->attributes) ? 0 : $this->attributes->getTotalAddedValues(),
$this->totalRecordedEvents,
$this->attributes->build(),
max(0, $this->droppedEventsCount),

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've spent a while to understand why the count could be negative number. Very interesting approach to store the limit value.

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 I revert this change or is adding a comment to the droppedLinksCount and droppedEventsCount properties sufficient?

Comment thread src/SDK/Trace/SpanBuilder.php Outdated
Comment thread src/SDK/Trace/SpanLimits.php Outdated
Comment thread src/SDK/Trace/Event.php
Comment thread src/SDK/Trace/Sampler/TraceIdRatioBasedSampler.php
Comment thread src/SDK/Trace/Span.php Outdated
@Nevay
Nevay force-pushed the feature/attributes-immutable branch from 0d44b43 to 89c510a Compare January 8, 2022 13:51
@bobstrecansky

Copy link
Copy Markdown
Contributor

Hey @Nevay - are you still planning on updating this PR?

@bobstrecansky

Copy link
Copy Markdown
Contributor

Closing this due to inactivity; please feel free to reopen if you'd like to!

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.

4 participants