source/plugins/ruby/out_mdm.rb
# This method is called every flush interval. Send the buffer chunk to MDM.
# 'chunk' is a buffer chunk that includes multiple formatted records
This method is called every flush interval. Send the buffer chunk to MDM.
'chunk' is a buffer chunk that includes multiple formatted records
This method is called every flush interval . Send the buffer chunk to MDM . ' chunk ' is a buffer chunk that includes multiple formatted records
def write(chunk)
      begin
        if (!@first_post_attempt_made || (Time.now > @last_post_attempt_time + retry_mdm_post_wait_minutes * 60)) && @can_send_data_to_mdm
          post_body = []
          chunk.msgpack_each { |(tag, record)|
            post_body.push(record.to_json)
          }
          count = post_body.size
          while count > 0
            current_batch = post_body.first(@@record_batch_size)
            post_body = post_body.drop(current_batch.size)
            count -= current_batch.size
            send_to_mdm current_batch
          end
        else
          if !@can_send_data_to_mdm
            @log.info "Cannot send data to MDM since all required conditions were not met"
          else
            @log.info "Last Failed POST attempt to MDM was made #{((Time.now - @last_post_attempt_time) / 60).round(1)} min ago. This is less than the current retry threshold of #{@retry_mdm_post_wait_minutes} min. NO-OP"
          end
        end
      rescue Exception => e
        ApplicationInsightsUtility.sendExceptionTelemetry(e)
        @log.info "Exception when writing to MDM: #{e}"
        raise e
      end
    end
def write ( chunk ) begin if ( ! @first_post_attempt_made || ( Time . now > @last_post_attempt_time + retry_mdm_post_wait_minutes * 60 ) ) && @can_send_data_to_mdm post_body = [ ] chunk . msgpack_each { | ( tag , record ) | post_body . push ( record . to_json ) } count = post_body . size while count > 0 current_batch = post_body . first ( @@record_batch_size ) post_body = post_body . drop ( current_batch . size ) count -= current_batch . size send_to_mdm current_batch end else if ! @can_send_data_to_mdm @log . info "Cannot send data to MDM since all required conditions were not met" else @log . info "Last Failed POST attempt to MDM was made #{((Time.now - @last_post_attempt_time) / 60).round(1)} min ago. This is less than the current retry threshold of #{@retry_mdm_post_wait_minutes} min. NO-OP" end end rescue Exception => e ApplicationInsightsUtility . sendExceptionTelemetry ( e ) @log . info "Exception when writing to MDM: #{e}" raise e end end
This method is called every flush interval.
This method is called every flush interval .
# the limit of the payload is 1MB. Each record is ~300 bytes. using a batch size of 2600, so that # the pay load size becomes approximately 800 Kb.
chunk
<not_specific>