newrelic / video-agent-roku

New Relic Agent for Roku
Apache License 2.0
18 stars 18 forks source link

Sending each event in a separate request #16

Closed bchelkowski closed 3 years ago

bchelkowski commented 3 years ago

nrEventProcessor function in NRTask in sending one request with one event after another. This creates a bottleneck in the reporting. https://github.com/newrelic/video-agent-roku/blob/9aa887ce187cb51c8a8e40cb98bf1823b7c551e6/components/NewRelicAgent/NRTask.brs#L35-L50 Is there a reason why this is not sending the whole events array at once?

I have two big concerns:

Maybe you can test something like this:


function nrEventProcessor() as Void
  if m.nr <> invalid
    events = m.nr.callFunc("nrExtractAllEvents")
    res = nrInsertInsightsData(events)
    if res <> 200
      m.nr.callFunc("nrLog", "-- nrEventProcessor: FAILED, retry later --")
      m.nr.callFunc("nrGetBackEvents", events)
    end if
  end if
end function

Or maybe at least send events in packs of 10 or 50 if sending big POST requests causing some issues.

asllop commented 3 years ago

Fixed in v1.0.8 (#18)

Now the NRTask sends the events in batches.