如何使用Newrelic Syntethics脚本测量测试执行持续时间?

发布于 2025-01-30 08:30:57 字数 1626 浏览 3 评论 0原文

我正在使用NewRelic Synthetics脚本浏览器来检查一些用户交易流,以了解可靠性和性能。

但是,跟踪的持续时间仅为8-10,与初始页面加载时间匹配,但不符合大型数据集的异步懒惰加载(约为40s)。

  • 我如何才能使新的Relic合成脚本浏览器测试显示实际的测试执行持续时间,而不仅仅是Inital请求的持续时间?
  • 我如何跟踪实际合成脚本脚本浏览器测试执行时间和绘图带有新遗物的图表?

以下我已经尝试过,并且似乎没有解决问题:

使用自定义Insight

参见

在脚本使用中:

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

使用NRQL:

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

但是,在NewRelic浏览器中,此数据显示为字符串,因此不能在图表上绘制作为测量。

  • 我需要做什么才能使它成为一个数字测量值,可以作为图表

绘制

? newrelic.com/docs/synthetics/synthetic-monitoring/scripting-monitors/custom-timing-details/“ rel =“ nofollow noreferrer”>新的文档建议使用$

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

har代码>与参考错误的检查失败。 $ har未定义;

  • 我该如何正确使用$ har?

**检查按键,自定义属性显示了我们的sting ** **

新的relic论坛我检查了字段类型,并且似乎已注册为

SynthettheticCheck的字符串nrql sealtthettheticcheck select keyset()返回

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

还有其他想法如何实现这一目标?

提前,我非常感谢您的专业知识!

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!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

以为你会在 2025-02-06 08:30:57

您可以

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

在查询中与它们在查询中转换时,

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

但是您不能在合成器监视器中报告此问题,并且始终需要查询构建器或自定义仪表板进行分析。

宁愿希望在合成监视器中正确报告的解决方案。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文