뉴웰릭 Roku 에이전트는 시스템 수준 및 비디오 관련 이벤트에 초점을 맞춰 Roku의 동작을 모니터링하도록 설계되었습니다. REST 인터페이스를 통해 데이터를 전송하기 위해 이벤트 API 사용하며 다섯 가지 유형의 이벤트를 지원합니다.
- ConnectedDeviceSystem: 시스템 이벤트
- VideoAction: 비디오 이벤트
- VideoErrorAction: 오류 이벤트
- VideoAdAction: 광고 이벤트
- VideoCustomAction: 맞춤형 대시보드
전제 조건
Roku용 스트리밍 비디오 및 광고 에이전트를 설치하기 전에 다음 사항을 확인하십시오.
- 귀하의 New Relic 계정 ID
- 너의 뉴렐릭
- 스트리밍 비디오 및 광고 에이전트 호환성 요구 사항을검토했습니다.
Roku 에이전트를 설치하세요
패키지를 다운로드하고 압축을 해제하세요.
Roku Video 에이전트 패키지를 다운로드하고 압축을 풀어 다음 파일 구조에 접근하세요.
components/NewRelicAgent/ NRAgent.brs NRAgent.xml NRTask.brs NRTask.xmlsource/ NewRelicAgent.brs파일을 프로젝트에 복사하세요
NewRelicAgent 폴더를 components 디렉토리에 복사하고 NewRelicAgent.brs 파일을 Roku 앱 프로젝트의 source 디렉토리에 복사합니다.
에이전트 초기화
기본 BrightScript 파일(예: Main.brs)에서 뉴렐릭 에이전트를 초기화합니다.
m.nr = NewRelic("ACCOUNT ID", "LICENSE KEY")팁
고급 설정: 선택적으로 앱 이름, 삽입 포인트 영역 및 로깅을 지정할 수 있습니다.
m.nr = NewRelic("ACCOUNT ID", "LICENSE KEY", "APP NAME", "APPLICATION TOKEN", "US", true)기본 엔드포인트는 US 입니다. EU 데이터센터의 경우 EU 사용하세요.
이벤트 캡처 활성화
Roku 장치용 뉴렐릭 미디어 에이전트는 비디오 콘텐츠 재생 중에 발생하는 이벤트를 캡처합니다. 자동 이벤트 캡처를 활성화하려면 애플리케이션에 다음 호출을 추가하세요.
로그 애플리케이션 시작
에이전트를 초기화한 후 애플리케이션 시작 이벤트를 로그에 기록합니다.
nrAppStarted(m.nr, aa)시스템 및 비디오 추적을 활성화합니다.
시스템 및 비디오 이벤트 추적을 활성화합니다.
m.syslog = NewRelicSystemStart(m.port)비디오 추적을 위해서는 장면 구성 요소에서 NewRelicVideoStart(m.nr, m.video) 호출하십시오.
대기 루프에서 메시지 처리
메인 대기 루프에서 시스템 이벤트를 처리하세요.
if nrProcessMessage(m.nr, msg) = false ' Process other messagesend if전체 예시
다음은 뉴렐릭 에이전트를 Roku 로그에 통합하는 완전한 예입니다.
메인.brs
sub Main(aa as Object) screen = CreateObject("roSGScreen") m.port = CreateObject("roMessagePort") screen.setMessagePort(m.port)
'Create the main scene that contains a video player scene = screen.CreateScene("VideoScene") screen.show()
'Init New Relic Agent m.nr = NewRelic("ACCOUNT ID", "LICENSE KEY")
'Send APP_STARTED event nrAppStarted(m.nr, aa)
'Pass NewRelicAgent object to the main scene scene.setField("nr", m.nr)
'Activate system tracking m.syslog = NewRelicSystemStart(m.port)
while (true) msg = wait(0, m.port) if nrProcessMessage(m.nr, msg) = false 'It is not a system message captured by New Relic Agent if type(msg) = "roPosterScreenEvent" if msg.isScreenClosed() exit while end if end if end if end whileend sub비디오씬.xml
<?xml version="1.0" encoding="utf-8" ?><component name="VideoScene" extends="Scene"> <interface> <!-- Field used to pass the NewRelicAgent object to the scene --> <field id="nr" type="node" onChange="nrRefUpdated" /> </interface>
<children> <Video id="myVideo" translation="[0,0]" /> </children>
<!-- New Relic Agent Interface --> <script type="text/brightscript" uri="pkg:/source/NewRelicAgent.brs"/>
<script type="text/brightscript" uri="pkg:/components/VideoScene.brs"/></component>비디오씬.brs
sub init() m.top.setFocus(true) setupVideoPlayer()end sub
function nrRefUpdated() m.nr = m.top.nr
'Activate video tracking NewRelicVideoStart(m.nr, m.video)end function
function setupVideoPlayer() videoUrl = "http://..." videoContent = createObject("RoSGNode", "ContentNode") videoContent.url = videoUrl videoContent.title = "Any Video" m.video = m.top.findNode("myVideo") m.video.content = videoContent m.video.control = "play"end function다음은 뭐지?
Roku 에이전트를 설치한 후, 다음 자료들을 참고하여 스트리밍 비디오 모니터링을 최대한 활용해 보세요.
- Roku 에이전트 API 참조: 맞춤형 대시보드, 지표 및 고급 설정을 위한 전체 API 살펴보세요.
- Roku 광고 추적: RAF 및 Google IMA 광고 이벤트 모니터링 설정
- 뉴렐릭에서 데이터 보기: 모든 플랫폼에서 비디오 및 광고 재생을 탐색하세요.