function currentSegment(agent) {
  const segment = agent.tracer.getSegment()
  const transaction = agent.tracer.getTransaction()
  return {
    spanId: segment?.id,
    traceId: transaction.traceId,
    sampled: transaction.sampled
  }
}
Returns the span context from active segment.

@param {object} agent instance
@returns {object} active span context from segment