Class DelegatingEmitter


  • public class DelegatingEmitter
    extends Emitter
    An Emitter which delegates all calls to another Emitter. Extend from this class to customize when segments and subsegments are sent.
    
     class CircuitBreakingEmitter extends DelegatingEmitter {
    
         private final CircuitBreaker circuitBreaker;
    
         CircuitBreakingEmitter() {
             super(Emitter.create());
             circuitBreaker = CircuitBreaker.create();
         }
    
         {@literal @}Override
         public boolean sendSegment(Segment segment) {
             if (circuitBreaker.isOpen()) {
                 return super.sendSegment(segment);
             }
             return false;
         }
     }
     
    • Constructor Detail

      • DelegatingEmitter

        protected DelegatingEmitter​(Emitter delegate)
        Constructs a new DelegatingEmitter that delegates all calls to the provided Emitter.
    • Method Detail

      • sendSegment

        public boolean sendSegment​(Segment segment)
        Description copied from class: Emitter
        Sends a segment to the X-Ray daemon.
        Specified by:
        sendSegment in class Emitter
        Parameters:
        segment - the segment to send
        Returns:
        true if the send operation was successful
      • sendSubsegment

        public boolean sendSubsegment​(Subsegment subsegment)
        Description copied from class: Emitter
        Sends a subsegment to the X-Ray daemon.
        Specified by:
        sendSubsegment in class Emitter
        Parameters:
        subsegment - the subsegment to send
        Returns:
        true if the send operation was successful