• 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.startInteraction(string $interactionName)

コトリン [#kotlin]

NewRelic.startInteraction(actionName: String)

説明 [#description]

Androidアプリのコードで、メソッドをインストルメントするためのインタラクションを作成します。

すでに存在し、すでに追跡されているインタラクションに名前を付けるには、 setInteractionName()を参照してください。

パラメーター [#parameters]

パラメータ

タイプ

説明

$interactionName

string

必須項目です。インタラクションにつけたい名前。

戻り値 [#return-values]

特定の時点で インタラクションを終了する ために使用できるインタラクション ID 番号を返します。

[#example]

RefreshContactsという名前のインタラクションの追跡を開始する例を次に示します。

Java [#java]

public class MainActivity extends Activity {
...
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.action_refresh:
NewRelic.startInteraction("RefreshContacts");
……
return true;
default:
return super.onOptionsItemSelected(item);
}
}
...
}

コトリン [#kotlin]

class MainActivity : AppCompatActivity() {
.....
var client: OkHttpClient = OkHttpClient();
binding.fab.setOnClickListener { view ->
val interActionId = NewRelic.startInteraction("Getting Data From Server")
lifecycleScope.launch(Dispatchers.IO) {
val result = getRequest()
NewRelic.endInteraction(interActionId)
}
}
}
....
}

構文

目的-c

+ (NSString*) startInteractionWithName:(NSString*)interactionName;

迅速 [#swift]

NewRelic.startInteraction(string: "myInteractionName")

説明 [#description]

このメソッドは、 interactionNameを名前として使用して対話トレースを開始します。インタラクションは、タイムアウトが発生するかstopCurrentInteractionが呼び出されるまで、計測されたすべてのメソッドを記録します。

すでに存在し、すでに追跡されているインタラクションに名前を付けるには、 setInteractionName()を参照してください。

ヒント

これらのメソッドを使用する場合、インストゥルメントされたインタラクションは[インタラクション]ページに表示されませんが、次のような NRQL クエリで見つけることができます。

query SELECT name FROM Mobile SINCE 7 DAYS AGO

パラメーター [#parameters]

パラメータ

タイプ

説明

interactionName

string

必須項目です。インタラクションにつけたい名前。

戻り値 [#return-values]

startInteractionWithNameが呼び出された場合、戻り値はstopCurrentInteractionに渡す必要があるinteractionIdentifierです。ただし、 startInteractionWithNameは最終的にインテリジェントに完了するため、start の呼び出し後にstopCurrentInteractionを呼び出す必要はありません。

[#examples]

Objective-C [#obj-c]

NSString *identifier = [NewRelic startInteractionWithName: @"myInteractionName"];
[NewRelic stopCurrentInteraction: identifier];

迅速 [#swift]

let identifier = NewRelic.startInteraction(withName: "myInteractionName")
NewRelic.stopCurrentInteraction(identifier)

構文

startInteraction(options: { value: string; }) => Promise<{ value: string; }>

説明 [#description]

メソッドをインタラクションとして追跡します。

パラメーター [#parameters]

パラメータ

タイプ

説明

options

{ value: string; }

必須項目です。インタラクションにつけたい名前。

[#example]

const badApiLoad = async () => {
const id = await NewRelicCapacitorPlugin.startInteraction({ value: 'StartLoadBadApiCall' });
console.log(id);
const url = 'https://fakewebsite.com/moviessssssssss.json';
fetch(url)
.then((response) => response.json())
.then((responseJson) => {
console.log(responseJson);
NewRelicCapacitorPlugin.endInteraction({ interactionId: id.value });
}) .catch((error) => {
NewRelicCapacitorPlugin.endInteraction({ interactionId: id.value });
console.error(error);
});
};

構文

startInteraction(interactionName: string, cb?: function): Promise<InteractionId>;

説明 [#description]

メソッドをインタラクションとして追跡します。

パラメーター [#parameters]

パラメータ

タイプ

説明

Interactioname

string

必須項目です。インタラクションにつけたい名前。

[#example]

const badApiLoad = async () => {
const interactionId = await NewRelic.startInteraction('StartLoadBadApiCall');
console.log(interactionId);
const url = 'https://cordova.apache.org/moviessssssssss.json';
fetch(url)
.then((response) => response.json())
.then((responseJson) => {
console.log(responseJson);
NewRelic.endInteraction(interactionId);
}) .catch((error) => {
NewRelic.endInteraction(interactionId);
console.error(error);
});

構文

StartInteraction(string interactionName): string;

説明 [#description]

メソッドをインタラクションとして追跡します。

パラメーター [#parameters]

パラメータ

タイプ

説明

options

{ value: string; }

必須項目です。インタラクションにつけたい名前。

[#example]

HttpClient myClient = new HttpClient(CrossNewRelic.Current.GetHttpMessageHandler());
string interactionId = CrossNewRelic.Current.StartInteraction("Getting data from service");
var response = await myClient.GetAsync(new Uri("https://jsonplaceholder.typicode.com/todos/1"));
if (response.IsSuccessStatusCode)
{
var content = await response.Content.ReadAsStringAsync();
} else
{
Console.WriteLine("Unsuccessful response code");
}
CrossNewRelic.Current.EndInteraction(interactionId);

構文

startInteraction(String actionName);

説明 [#description]

メソッドをインタラクションとして追跡します。

パラメーター [#parameters]

パラメータ

タイプ

説明

string actionName

string

必須項目です。インタラクションにつけたい名前。

[#example]

var id = await NewrelicMobile.instance.startInteraction("Getting Data from Service");
try {
var dio = Dio();
var response = await dio.get(
'https://reqres.in/api/users?delay=15');
print(response);
NewrelicMobile.instance.endInteraction(id);
Timeline.finishSync();
} catch (e) {
print(e);
}

構文

startInteraction(interactionName: string): Promise<InteractionId>;

説明 [#description]

メソッドをインタラクションとして追跡します。

パラメーター [#parameters]

パラメータ

タイプ

説明

interactionName

string

必須項目です。インタラクションにつけたい名前。

[#example]

const badApiLoad = async () => {
const interactionId = await NewRelic.startInteraction('StartLoadBadApiCall');
console.log(interactionId);
const url = 'https://facebook.github.io/react-native/moviessssssssss.json';
fetch(url)
.then((response) => response.json())
.then((responseJson) => {
console.log(responseJson);
NewRelic.endInteraction(interactionId);
}) .catch((error) => {
NewRelic.endInteraction(interactionId);
console.error(error);
});;
};

構文

StartInteractionWithName((string interactionName): string;

説明 [#description]

メソッドをインタラクションとして追跡します。

パラメーター [#parameters]

パラメータ

タイプ

説明

interactionName

string

必須項目です。インタラクションにつけたい名前。

[#example]

string interActionId = NewRelicAgent.StartInteractionWithName("Unity InterAction Example");
for(int i =0; i < 4;i++)
{
Thread.Sleep(1000);
}
NewRelicAgent.StopCurrentInteraction(interActionId);

構文

startInterAction(FString interActionName):FString;

説明 [#description]

メソッドをインタラクションとして追跡します。

パラメーター [#parameters]

パラメータ

タイプ

説明

interActionName

FString

必須項目です。インタラクションにつけたい名前。

[#example]

#include "NewRelicBPLibrary.h"
FString id = UNewRelicBPLibrary::startInterAction("test Unreal InterAction");
FPlatformProcess::Sleep(6.0);
UNewRelicBPLibrary::endInterAction(id);

構文

StartInteraction(string interactionName): string;

説明 [#description]

メソッドをインタラクションとして追跡します。

パラメーター [#parameters]

パラメータ

タイプ

説明

interactionName

string

必須項目です。インタラクションにつけたい名前。

[#example]

HttpClient myClient = new HttpClient(CrossNewRelicClient.Current.GetHttpMessageHandler());
string interactionId = CrossNewRelicClient.Current.StartInteraction("Getting data from service");
var response = await myClient.GetAsync(new Uri("https://jsonplaceholder.typicode.com/todos/1"));
if (response.IsSuccessStatusCode)
{
var content = await response.Content.ReadAsStringAsync();
} else
{
Console.WriteLine("Unsuccessful response code");
}
CrossNewRelicClient.Current.EndInteraction(interactionId);
Copyright © 2024 New Relic株式会社。

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