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

この機械翻訳は参考用に提供されます。

英語版と翻訳版に矛盾がある場合は、英語版が優先されます。詳細については、 を参照してください。

問題を作成する

インタラクションを停止する

構文

Java

NewRelic.endInteraction(string $interactionID)

コトリン [#kotlin]

NewRelic. endInteraction(id : String!)

説明 [#description]

New Relic はすべてのインタラクションを自動的に終了しますが、 endInteraction() を使用してカスタム インタラクションを早期に終了することができます。startInteraction() 呼び出しを使用すると、文字列 ID が返されます。

この呼び出しは、インタラクションがすでに終了している場合には効果がありません。

パラメーター [#parameters]

パラメータ

タイプ

説明

interactionID

string

必須。startInteractionによって返される値。インタラクション トレースを手動で完了するには、この文字列を渡す必要があります。

[#example]

カスタム インタラクション RefreshContactsを終了する例を次に示します。

Java [#java]

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

構文

目的-c

+ (void) stopCurrentInteraction:(NSString*)interactionIdentifier;

迅速 [#swift]

NewRelic.stopInteraction(string: "myInteractionName")

説明 [#description]

このメソッドは、 interactionIdentifier ( startInteractionWithName: メソッドによって返される) に関連付けられたインタラクション トレースを停止します。インタラクション トレースを完了するためにこのメソッドを呼び出す必要はありません (インタラクション トレースは自動的にインテリジェントに完了します)。ただし、より離散的なインタラクション期間が必要な場合は、この方法を使用してください。

パラメーター [#parameters]

パラメータ

タイプ

説明

interactionIdentifier

string

必須。startInteractionWithName: によって返される値。インタラクション トレースを手動で完了するには、この文字列を渡す必要があります。

[#examples]

Objective-C [#obj-c]

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

迅速 [#swift]

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

構文

endInteraction(options: { interactionId: string; }) => void

説明 [#description]

これには、終了するインタラクションの文字列 ID が使用されます。この文字列は、 startInteraction()を使用すると返されます。

パラメーター [#parameters]

パラメータ

タイプ

説明

interactionID

string

必須。startInteractionによって返される値。インタラクション トレースを手動で完了するには、この文字列を渡す必要があります。

[#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);
});
};

構文

endInteraction(id: InteractionId): void;

説明 [#description]

これには、終了するインタラクションの文字列 ID が使用されます。この文字列は、 startInteraction()を使用すると返されます。

パラメーター [#parameters]

パラメータ

タイプ

説明

id

InteractionId

必須。startInteractionによって返される値。インタラクション トレースを手動で完了するには、この文字列を渡す必要があります。

[#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);
});

構文

EndInteraction(string interactionId): void;

説明 [#description]

これには、終了するインタラクションの文字列 ID が使用されます。この文字列は、 startInteraction()を使用すると返されます。

パラメーター [#parameters]

パラメータ

タイプ

説明

interactionId

string

必須。startInteractionによって返される値。インタラクション トレースを手動で完了するには、この文字列を渡す必要があります。

[#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);

構文

endInteraction(String interactionId): void;

説明 [#description]

これには、終了するインタラクションの文字列 ID が使用されます。この文字列は、 startInteraction()を使用すると返されます。

パラメーター [#parameters]

パラメータ

タイプ

説明

interactionId

string

必須。startInteractionによって返される値。インタラクション トレースを手動で完了するには、この文字列を渡す必要があります。

[#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);
}

構文

endInteraction(id: InteractionId): void;

説明 [#description]

これには、終了するインタラクションの文字列 ID が使用されます。この文字列は、 startInteraction()を使用すると返されます。

パラメーター [#parameters]

パラメータ

タイプ

説明

InteractionID

string

必須。startInteractionによって返される値。インタラクション トレースを手動で完了するには、この文字列を渡す必要があります。

[#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);
});;
};

構文

StopCurrentInteraction(string interactionId): void;

説明 [#description]

これには、終了するインタラクションの文字列 ID が使用されます。この文字列は、 startInteraction()を使用すると返されます。

パラメーター [#parameters]

パラメータ

タイプ

説明

interactionId

string

必須。startInteractionによって返される値。インタラクション トレースを手動で完了するには、この文字列を渡す必要があります。

[#example]

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

構文

EndInteraction(string interactionId): void;

説明 [#description]

これには、終了するインタラクションの文字列 ID が使用されます。この文字列は、 startInteraction()を使用すると返されます。

パラメーター [#parameters]

パラメータ

タイプ

説明

interactionId

string

必須。startInteractionによって返される値。インタラクション トレースを手動で完了するには、この文字列を渡す必要があります。

[#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.