opentelemetry-js icon indicating copy to clipboard operation
opentelemetry-js copied to clipboard

Disallow `new Span()`

Open dyladan opened this issue 2 years ago • 4 comments
trafficstars

Currently it is possible to call new Span(). We should make the constructor private to disallow this.

Current test usages:

  • 1 use of new span in contrib tests: https://github.com/open-telemetry/opentelemetry-js-contrib/blob/main/plugins/node/opentelemetry-instrumentation-dns/test/functionals/utils.test.ts#L150
  • ? uses of new Span in JS tests
  • honeycomb distro is known to use Span in tests
  • dd-trace may also use new Span in tests? @dyladan will look into this

Possible additional goals:

  • do not use a class for span (improve minification)
  • create test utility library

dyladan avatar Feb 08 '23 22:02 dyladan