0

I'm using the newrelic synthetics scripted browser to check some user transaction flows for reliability and performance.

However the tracked duration is only about 8-10s which matches initial page load time, but not the async lazy loading of a large dataset (which is approx. 40s).

  • How can I make new relic synthetics scripted browser tests to show actual test execution duration and not only the duration of inital request?
  • How can I track actual synthetics scripted browser test execution time and plot on a diagram with new relic?

The following I already tried and seems not to fix the issue:

Using a custom insight

See new relic docs for custom insights.

In script use:

var timeStart = Date.now();
var timeEnd = Date.now();
$util.insights.set('testDuration', (timeEnd - timeStart) );

with NRQL:

FROM SyntheticCheck SELECT numeric(custom.testDurration) WHERE numeric(custom.testDurration) > 0 SINCE 1 day ago

However in newrelic browser this data is shown as strings and thus cannot be plot on a chart as measurement.

  • What do I need to do to be able to make this a numeric measurement to be drawable as chart?

Timetracking with $har

New relic docs recommend using $har

const testTimer = $har.addResource('Test Timer');
testTimer.startTimer();
await sleep(100);
testTimer.endTimer();

However $har is resulting in error: Check failed with reference error. $har is not defined;

  • How do I use $har correctly?

** Checking KeySet, the custom properties show us stings**

As proposed on new relic forum I checked the field type and it appears to be registered as string

NRQL FROM SyntheticCheck SELECT keyset() returns

[
  {
    "results": [
      {
        "stringKeys": [
          "custom.duration"
          "custom.testDuration",

Any other ideas how to achieve this?

Thx in advance, I really appreciate your expertise!

Manuel
  • 9,112
  • 13
  • 70
  • 110

1 Answers1

0

You can log values with

$util.insights.set('testDuration', (timeEnd - timeStart) )

And when convert them within the query with

SELECT average(numeric(custom.testDuration)) FROM SyntheticCheck WHERE monitorName ='myMonitor' SINCE 7 days AGO TIMESERIES AUTO

However you cannot report this within the synthetics monitor and always need the query builder or a custom dashboard for analysis.

Would rather prefer a solution which properly reports within the synthetics monitor.

Manuel
  • 9,112
  • 13
  • 70
  • 110