• /
  • ログイン
  • 無料アカウント

addToTrace (browser agent API)

Syntax

newrelic.addToTrace(JavaScript object $custom_object)

Adds a JavaScript object with a custom name, start time, etc. to an in-progress session trace.

Requirements

Agent version nr-593 or higher.

Description

Custom events within browser session traces can provide context for other user actions, errors, and default events within the trace. This event will appear in the browser session trace details.

  • If a session trace currently is in progress, this adds an object with a user-defined name, start time, and other optional fields.
  • If you make this call and a session trace is not already in progress, this will not cause browser to capture a trace.

Note that the number of events shared this way is limited by the Browser agent harvest cycle. Here is the last update on that limit.

Parameters

Parameter

Description

$custom_object

JavaScript object

Required. Supply a JavaScript object with these required and optional name/value pairs:

  • Required name/value pairs: NAME, START

  • Optional name/value pairs: END, ORIGIN, TYPE

    If you are sending the same event object to New Relic One as a PageAction, omit the TYPE attribute. (TYPE is a string to describe what type of event you are marking inside of a session trace.) If included, it will override the event type and cause the PageAction event to be sent incorrectly. Instead, use the NAME attribute for event information.

Examples

var obj = {
  // REQUIRED
  name: 'Event Name',
  start: 1417044274239, // Time in ms since epoch

  // OPTIONAL
  end: 1417044274252,
  // Time in ms since epoch. Defaults to same as start resulting in trace object with a duration of zero.
  origin: 'Origin of event',
  // Defaults to empty string
  type: 'What type of event was this'
  // Defaults to empty string
}

その他のヘルプ

さらに支援が必要な場合は、これらのサポートと学習リソースを確認してください:

問題を作成する
Copyright © 2020 New Relic Inc.