repo_description: A modern Apache Kafka client for node.js
repo_topics: kafka kafka-client nodejs npm-package
code: const swapObject = require('../utils/swapObject')
  const networkEvents = require('../network/instrumentationEvents')
  const InstrumentationEventType = require('../instrumentation/eventType')
  const producerType = InstrumentationEventType('producer')
  
  const events = {
    CONNECT: producerType('connect'),
    DISCONNECT: producerType('disconnect'),
    REQUEST: producerType(networkEvents.NETWORK_REQUEST),
    REQUEST_TIMEOUT: producerType(networkEvents.NETWORK_REQUEST_TIMEOUT),
    REQUEST_QUEUE_SIZE: producerType(networkEvents.NETWORK_REQUEST_QUEUE_SIZE),
  }
  
  const wrappedEvents = {
    [events.REQUEST]: networkEvents.NETWORK_REQUEST,
    [events.REQUEST_TIMEOUT]: networkEvents.NETWORK_REQUEST_TIMEOUT,
    [events.REQUEST_QUEUE_SIZE]: networkEvents.NETWORK_REQUEST_QUEUE_SIZE,
  }
  
  const reversedWrappedEvents = swapObject(wrappedEvents)
  const unwrap = eventName => wrappedEvents[eventName] || eventName
  const wrap = eventName => reversedWrappedEvents[eventName] || eventName
  
  module.exports = {
    events,
    wrap,
    unwrap,
  }
  