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(sdk-trace-base)!: remove Span class from exports #5048

Merged

Conversation

david-luna
Copy link
Contributor

@david-luna david-luna commented Oct 7, 2024

Which problem is this PR solving?

Removes the Span constructor from the exports so users are compelled to use tracer.startSpan API which is safer. Instead of the class the SDK exports now a type with the same properties.

Ref: #3597

Short description of the changes

  • make Span a type and not a class
  • rename span class to SpanImpl
  • use the SpanImpl constructor internally (src & tests)
  • export only the Span type in index.ts

Type of change

Please delete options that are not relevant.

  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

How Has This Been Tested?

  • compiled all packages
  • ran tests for all packages

Checklist:

@david-luna david-luna requested a review from a team as a code owner October 7, 2024 14:55
@david-luna david-luna changed the title refactor(sdk-trace-base): remove Span class from exports refactor(sdk-trace-base)!: remove Span class from exports Oct 7, 2024
@pichlermarc pichlermarc added the target:next-major-release This PR targets the next major release (`next` branch) label Oct 8, 2024
Copy link

codecov bot commented Oct 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.24%. Comparing base (b057c93) to head (d0ace50).
Report is 3 commits behind head on next.

Additional details and impacted files
@@           Coverage Diff           @@
##             next    #5048   +/-   ##
=======================================
  Coverage   93.24%   93.24%           
=======================================
  Files         318      318           
  Lines        8231     8231           
  Branches     1651     1651           
=======================================
  Hits         7675     7675           
  Misses        556      556           
Files with missing lines Coverage Δ
packages/opentelemetry-sdk-trace-base/src/Span.ts 97.61% <100.00%> (ø)
...ackages/opentelemetry-sdk-trace-base/src/Tracer.ts 98.57% <100.00%> (ø)

@@ -108,7 +108,6 @@ describe('NodeTracerProvider', () => {
sampler: new AlwaysOnSampler(),
});
const span = provider.getTracer('default').startSpan('my-span');
assert.ok(span instanceof Span);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note for reviewer: Span is not a class anymore but a type. If necessary we could check that conforms to the api.Span & ReadableSpan interfaces.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's fine to leave it out, I think.

@david-luna
Copy link
Contributor Author

@pichlermarc sorry to bother. Is there a way to stop/relaunch the codecov check? seems to be stuck for a day now

@pichlermarc
Copy link
Member

@pichlermarc sorry to bother. Is there a way to stop/relaunch the codecov check? seems to be stuck for a day now

no worries, it looks like it actually kind of un-stuck itself just now. 🙂

Copy link
Member

@pichlermarc pichlermarc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks for working on this 👍

@pichlermarc pichlermarc merged commit 508946c into open-telemetry:next Oct 21, 2024
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
target:next-major-release This PR targets the next major release (`next` branch)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants