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

사용자의 편의를 위해 제공되는 기계 번역입니다.

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

문제 신고

측정하다

통사론

newrelic.measure(name: string, options?: Object<{ customAttributes?: Object, start?: number|PerformanceMark, end?: number|PerformanceMark }>)

브라우저 BrowserPerformance 이벤트를 보고합니다.

요구 사항

설명

이 API 호출은 사용자가 정의한 이름과 사용자 정의 속성이 포함된 브라우저 BrowserPerformance 이벤트를 보냅니다. 이 기능은 대안으로 이벤트를 수동으로 생성하거나 자동 마크 및 측정 추적과 함께 사용하는 데 유용합니다.

매개변수

매개변수

설명

$name

필수의. 작업의 이름 또는 범주. entryName 속성으로 보고되었습니다.

속성이나 값의 이름을 지정할 때 예약된 NRQL 단어 를 사용하지 마십시오.

$options

JSON 객체

선택 과목. 캡처된 이벤트에 대한 설정을 제공하는 데 사용되는 개체입니다. 객체의 모든 속성은 선택 사항입니다. options.customAttributes 제공된 각 속성에 대해 생성된 이벤트에 최상위 속성과 값을 할당하는 키:값 쌍의 객체입니다. options.start 시작 시간으로 참조할 원점 시간부터 ms 단위의 부동 소수점 값이거나 유효한 PerformanceMark 개체가 될 수 있습니다. options.start 원점 시간에서 종료 시간으로 참조하는 ms 단위의 부동 소수점 값이거나 유효한 PerformanceMark 개체가 될 수 있습니다.

options.start 정의되지 않으면 기본적으로 0 사용됩니다. options.end 정의되지 않으면 기본적으로 performance.now() 사용됩니다.

사용자 정의 속성에 예약된 NRQL 단어를 사용하지 마세요.

반환 값

이 메서드는 측정 세부 정보가 포함된 JSON 객체를 반환합니다. start 은 시작 시간입니다. end 은 종료 시간입니다. duration 시작부터 끝까지의 측정 길이입니다. customAttributes 은 측정 API 호출에 전달된 맞춤 속성입니다. 반환된 맞춤 속성은 사용자가 정의한 맞춤 속성 과 병합되지 않지만, BrowserPerformance 이벤트 생성 시 병합됩니다.

최소한의 예

const myTask = newrelic.measure('checkout')
/** myTask **/
{
start: 0, // page origin time was used since start was not supplied
end: 1234, // performance.now() was used since end was not supplied
duration: 1234, // end - start
customAttributes: { } // no custom attributes were supplied
}
/** the browser agent buffers and later harvests the newly created BrowserPerformance event **/

시작 및/또는 종료 시간에 숫자 인수 사용

const myTask = newrelic.measure('checkout', {
start: 1234,
end: 5678
})
/** myTask **/
{
start: 1234, // options.start time was used directly
end: 5678, // options.end time was used directly
duration: 4444, // end - start
customAttributes: { } // no custom attributes were supplied
}
/** the browser agent buffers and later harvests the newly created BrowserPerformance event **/

PerformanceMark 인수 사용

const startMark = performance.mark('my-start-mark') // startTime = 1234
// later
const endMark = performance.mark('my-end-mark') // startTime = 5678
const myTask = newrelic.measure('checkout', {
start: startMark,
end: endMark
})
/** myTask **/
{
start: 1234, // options.start.startTime was used since it was a BrowserPerformance entry
end: 5678, // options.end.startTime was used since it was a BrowserPerformance entry
duration: 4444, // end - start
customAttributes: { } // no custom attributes were supplied
}
/** the browser agent buffers and later harvests the newly created BrowserPerformance event **/

혼합된 인수 유형

const startMark = performance.mark('my-start-mark') // startTime = 1234
const myTask = newrelic.measure('checkout', {
start: startMark,
end: 5678
})
/** myTask **/
{
start: 1234, // options.start.startTime was used since it was a BrowserPerformance entry
end: 5678, // options.end time was used directly
duration: 4444, // end - start
customAttributes: { } // no custom attributes were supplied
}
/** the browser agent buffers and later harvests the newly created BrowserPerformance event **/

사용자 정의 속성 사용

const myTask = newrelic.measure('checkout', {
start: 1234,
end: 5678,
customAttributes: {
foo: 'bar'
}
})
/** myTask **/
{
start: 1234, // options.start time was used directly
end: 5678, // options.end time was used directly
duration: 4444, // end - start
customAttributes: {
foo: 'bar'
}
}
/** the browser agent buffers and later harvests the newly created BrowserPerformance event **/
Copyright © 2026 New Relic Inc.

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