• EnglishEspañol日本語한국어Português
  • 로그인지금 시작하기

이 한글 문서는 사용자의 편의를 위해 기계 번역되었습니다.

영문본과 번역본이 일치하지 않는 경우 영문본이 우선합니다. 보다 자세한 내용은 이 페이지를 방문하시기 바랍니다.

문제 신고

Go 앱에 브라우저 모니터링 추가

앱에 New Relic's Go 에이전트를 설치한 경우 다음을 사용할 수도 있습니다. 브라우저 성능을 모니터링합니다. 브라우저 에이전트를 설치하려면 복사 및 붙여넣기 방법을 사용하거나 Go 에이전트 API를 사용하세요.

Go 에이전트 브라우저 API로 설치

브라우저 모니터링 지원을 활성화하려면 HTML 페이지에 브라우저 에이전트를 로드하고 올바른 애플리케이션 이름으로 구성하는 JavaScript 스니펫이 포함되어야 합니다. 이 스니펫은 Transaction.BrowserTimingHeader 메서드와 함께 사용할 수 있습니다. 브라우저 모니터링의 타이밍 헤더 지원은 Go 에이전트 버전 2.5.0 이상 에서 사용할 수 있습니다.

HTML의 <head> 섹션과 <meta charset> 태그 뒤에 가능한 한 빨리 Transaction.BrowserTimingHeader().WithTags() 에서 반환된 바이트 조각을 포함합니다.

Transaction.BrowserTimingHeader 에서 반환된 JavaScript는 요청에 따라 다릅니다. 그렇기 때문에 각 요청에 대해 호출해야 합니다.

func indexHandler(w http.ResponseWriter, req *http.Request) {
io.WriteString(w, "<html><head>")
// The New Relic browser javascript should be placed as high in the
// HTML as possible. We suggest including it immediately after the
// opening <head> tag and any <meta charset> tags.
txn := newrelic.FromContext(req.Context())
hdr := txn.BrowserTimingHeader()
// BrowserTimingHeader() will always return a header whose methods can
// be safely called.
if js := hdr.WithTags(); js != nil {
w.Write(js)
}
io.WriteString(w, "</head><body>browser header page</body></html>")
}
Copyright © 2024 New Relic Inc.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.