function TraceSegment({ id, config, name, collect, parentId, root, isRoot = false }) {
  this.isRoot = isRoot
  this.root = root
  this.name = name
  this.attributes = new Attributes(ATTRIBUTE_SCOPE)
  this.spansEnabled = config?.distributed_tracing?.enabled && config?.span_events?.enabled

  // Generate a unique id for use in span events.
  this.id = id || hashes.makeId()
  this.parentId = parentId
  this.timer = new Timer()

  this.internal = false
  this.opaque = false
  this.shimId = null

  // hidden class optimization
  this.partialName = null
  this._exclusiveDuration = null
  this._collect = collect
  this.host = null
  this.port = null
  this.state = STATE.EXTERNAL
  this.async = true
  this.ignore = false
  // only use to specify spanKind on segments created with `api.startBackgroundTransaction` and `api.startWebTransaction`
  // we typically determine the span kind based on the segment name
  this.spanKind = null
}
Initializes the segment and binds the recorder to itself, if provided.

@class
@classdesc
TraceSegments are inserted to track instrumented function calls. They
are reported as part of a transaction trace. It has name (used only internally to the framework
for now), and has one or more children (that are also part of the same
transaction trace), as well as an associated timer.
@param {object} params to function
@param {number} params.id id if passed in used as segment id. only used in otel bridge mode to ensure span id is same as segment
@param {object} params.config agent config
@param {string} params.name Human-readable name for this segment (e.g. 'http', 'net', 'express',
 'mysql', etc).
 @param {number} params.parentId parent id of segment
@param {boolean} params.collect flag to collect as part of transaction trace
@param {TraceSegment} params.root root segment
@param {boolean} params.isRoot flag to indicate it is the root segment