• EnglishEspañol日本語한국어Português
  • ログイン今すぐ開始

この機械翻訳は、参考として提供されています。

In the event of any inconsistency between the English version and the translated version, the English versionwill take priority. Please visit this page for more information.

問題を作成する

カスタム属性を作成する

構文

Java

NewRelic.setAttribute(string $name, string or float $value)

コトリン [#kotlin]

NewRelic.setAttribute(name: String?, value: String?)
NewRelic.setAttribute(name: String?, value: Double)
NewRelic.setAttribute(name: String?, value: Boolean)

説明 [#description]

この静的メソッドは、セッションレベルのカスタム 属性 を、指定された名前と値で作成します。このメソッドは、呼び出されるたびに、以前の値とタイプを上書きします。作成された属性は、複数の モバイルイベントタイプ で共有されます。

以下を除く、 MobileSessionのデフォルト属性をオーバーライドできます。

  • appId
  • appName
  • accountId
  • carrier
  • category
  • deviceManufacturer
  • deviceModel
  • eventType
  • install
  • lastInteraction
  • memUsageMb
  • newRelicVersion
  • osMajorVersion
  • osName
  • osVersion
  • platform
  • platformVersion
  • sessionDuration
  • sessionId
  • timestamp
  • type
  • upgradeFrom
  • uuid
  • 接頭辞が付いているもの NewRelic

パラメーター [#parameters]

パラメータ

タイプ

説明

$name

string

は必須項目です。属性の名前。

$value

string または float

必要。渡される 2 番目のパラメータは、 string 値または float 値のいずれかです。

戻り値 [#return-values]

正常に記録された場合はtrueを返し、記録されなかった場合はfalseを返します。

[#example]

以下は、指定したテキスト名とテキスト値を持つ属性を作成する例です。setAttribute 呼び出されるたびに、以前の値と型を上書きします。

Java [#java]

boolean attributeSet = NewRelic.setAttribute("storeId", "SampleStoreId000");

コトリン [#kotlin]

val attributeSet = NewRelic.setAttribute("storeId", "SampleStoreId000")

次に、指定したテキスト名と数値を使用して属性を作成する例を示します。

Java [#java]

boolean attributeSet = NewRelic.setAttribute("rate", 9999.99);

コトリン [#kotlin]

val attributeSet = NewRelic.setAttribute("rate", 9999.99)

構文

目的-c

setAttribute:(NSString*)name value:(id) value;

迅速 [#swift]

NewRelic.setAttribute(string $name, string or float $value)

説明 [#description]

この静的メソッドは、セッションレベルのカスタム 属性 を、指定された名前と値で作成します。このメソッドが呼び出されると、以前の値とタイプが上書きされます。作成された属性は、複数の Mobile monitoring event type で共有されます。

以下を除く、 MobileSessionのデフォルト属性をオーバーライドできます。

  • appId
  • appName
  • accountId
  • carrier
  • category
  • deviceManufacturer
  • deviceModel
  • eventType
  • install
  • lastInteraction
  • memUsageMb
  • newRelicVersion
  • osMajorVersion
  • osName
  • osVersion
  • platform
  • platformVersion
  • sessionDuration
  • sessionId
  • timestamp
  • type
  • upgradeFrom
  • uuid
  • 接頭辞が付いているもの NewRelic

パラメーター [#parameters]

パラメータ

タイプ

説明

$name

string

必須項目です。セッション属性の名前。

$value

string または float

必要。渡される 2 番目のパラメータは、 string 値または float 値のいずれかです。

戻り値 [#return-values]

正常に記録された場合はtrueを返し、記録されなかった場合はfalseを返します。

[#examples]

Objective-C [#obj-c]

BOOL attributeSet = [NewRelic setAttribute:@"buildConfiguration" value:@"AppStore-release"];
BOOL attributeSet = [NewRelic setAttribute:@"rate" value:@9999.99];

迅速 [#swift]

var attributeSet = NewRelic.setAttribute("buildConfiguration", value: "AppStore-release")
attributeSet = NewRelic.setAttribute("rate", value: 9999.99)

構文

setAttribute(options: { name: string; value: string; }) => void

説明 [#description]

複数のモバイルイベントタイプで共有されるセッションレベルの属性を作成します。この属性が呼び出されるたびに、以前の値とタイプが上書きされます。

パラメーター [#parameters]

パラメータ

タイプ

説明

name

string

必須項目です。属性の名前です。

value

string または float

必要。属性の値。

[#example]

NewRelicCapacitorPlugin.setAttribute({ name: "CapacitorAttribute", value: "123" });

構文

setAttribute(attributeName: string, value: boolean | number | string): void;

説明 [#description]

複数のモバイルイベントタイプで共有されるセッションレベルの属性を作成します。この属性が呼び出されるたびに、以前の値とタイプが上書きされます。

パラメーター [#parameters]

パラメータ

タイプ

説明

attributeName

string

必須項目です。属性の名前です。

value

bool

必要。属性の値。

[#example]

NewRelic.setAttribute(Name: "CordovaAttribute", value: "123"): void;

構文

SetAttribute(string name, string value) : bool;
SetAttribute(string name, double value) : bool;
SetAttribute(string name, bool value) : bool;

説明 [#description]

複数のモバイルイベントタイプで共有されるセッションレベルの属性を作成します。この属性が呼び出されるたびに、以前の値とタイプが上書きされます。

パラメーター [#parameters]

パラメータ

タイプ

説明

name

string

必須項目です。属性の名前です。

value

stringdouble 、または bool

必要。属性の値。

[#example]

CrossNewRelic.Current.SetAttribute("MAUIBoolAttr", false);
CrossNewRelic.Current.SetAttribute("MAUIStrAttr", "Cat");
CrossNewRelic.Current.SetAttribute("MAUINumAttr", 13.5);

構文

setAttribute (String name, dynamic value) : void;

説明 [#description]

複数のモバイルイベントタイプで共有されるセッションレベルの属性を作成します。この属性が呼び出されるたびに、以前の値とタイプが上書きされます。

パラメーター [#parameters]

パラメータ

タイプ

説明

name

string

必須項目です。属性の名前です。

dynamic value

string

必要。属性の値。

[#example]

NewrelicMobile.instance.setAttribute('RNCustomAttrNumber', 37);

構文

setAttribute(name: string, value: boolean | number | string): void;

説明 [#description]

複数のモバイルイベントタイプで共有されるセッションレベルの属性を作成します。この属性が呼び出されるたびに、以前の値とタイプが上書きされます。

パラメーター [#parameters]

パラメータ

タイプ

説明

name

string

必須項目です。属性の名前です。

value

boolnumber 、または string

必要。属性の値。

[#example]

NewRelic.setAttribute('RNCustomAttrNumber', 37);

構文

setAttribute(string name, string value) : bool;
setAttribute(string name, double value) : bool;
setAttribute(string name, bool value) : bool;

説明 [#description]

複数のモバイルイベントタイプで共有されるセッションレベルの属性を作成します。この属性が呼び出されるたびに、以前の値とタイプが上書きされます。

パラメーター [#parameters]

パラメータ

タイプ

説明

name

string

必須項目です。属性の名前です。

value

stringdouble 、または bool

必要。属性の値。

[#example]

NewRelicAgent.SetAttribute("UnityBoolCustomAttr", false);
NewRelicAgent.SetAttribute("UnityStringCustomAttr", "Cat");
NewRelicAgent.SetAttribute('UnityCustomAttrNumber', 37);

構文

setStringAttribute(FString name,FString value) : void;
setDoubleAttribute(FString name,double value):void;
setBooleanAttribute(FString name ,bool value):void;

説明 [#description]

複数のモバイルイベントタイプで共有されるセッションレベルの属性を作成します。この属性が呼び出されるたびに、以前の値とタイプが上書きされます。

パラメーター [#parameters]

パラメータ

タイプ

説明

name

string

必須項目です。属性の名前です。

value

stringdouble 、または bool

必要。属性の値。

[#example]

#include "NewRelicBPLibrary.h"
UNewRelicBPLibrary::setBooleanAttribute("From Unreal",true);
UNewRelicBPLibrary::setDoubleAttribute("Unreal Double", 15.0);
UNewRelicBPLibrary::setStringAttribute("Unreal String","From UnReal");

構文

SetAttribute(string name, string value) : bool;
SetAttribute(string name, double value) : bool;
SetAttribute(string name, bool value) : bool;

説明 [#description]

複数のモバイルイベントタイプで共有されるセッションレベルの属性を作成します。この属性が呼び出されるたびに、以前の値とタイプが上書きされます。

パラメーター [#parameters]

パラメータ

タイプ

説明

name

string

必須項目です。属性の名前です。

value

stringdouble 、または bool

必要。属性の値。

[#example]

CrossNewRelicClient.Current.SetAttribute("XamarinBoolAttr", false);
CrossNewRelicClient.Current.SetAttribute("XamarinStrAttr", "Cat");
CrossNewRelicClient.Current.SetAttribute("XamarinNumAttr", 13.5);
Copyright © 2024 New Relic株式会社。

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