重要
This is an experimental browser feature and is subject to change. Use this feature with caution. It's available only with the browser agent installed via copy/paste or NPM.
Marks and measures are standard methods to observe and report on the performance of your webpages. They're generic events native to the browser. You can use them to measure the duration of any task. The New Relic browser agent can automatically track marks and measures as store them as BrowserPerformance
events.
Enable marks and measures monitoring
To enable this feature:
Make sure you're using browser agent 1.272.0 or later.
Locate the agent code in your webpage HTML or JS application.
In the
init
configuration object, and add theperformance
feature configuration.Here's an example to enable both marks and measures detection:
<script type="text/javascript"> ;window.NREUM||(NREUM={});init={ …, performance: {capture_marks: true, capture_measures: true} }:Deploy your app.
Find your data in New Relic
Once enabled, the agent stores marks and measures data under the BrowserPerformance
event type in New Relic. To find this data, try the following queries and then create custom dashboards to track performance.
Query 1: This NRQL query retrieves all BrowserPerformance
events for the specified appName
("My Application") where the entryName
is either mark
or measure
.
FROM BrowserPerformance SELECT * WHERE appName = 'My Application' AND entryName = 'mark' OR entryName = 'measure'
Query 2: This NRQL query calculates the average entryDuration
for mark and measure events within the specified appName
. The FACET entryName
clause groups the results by the entryName
field, providing separate average durations for mark and measure events. This can be useful for comparing the average performance of marks versus measures.
FROM BrowserPerformance SELECT average(entryDuration) WHERE appName = 'My Application' AND entryName = 'mark' OR entryName = 'measure' FACET entryName