• /
  • EnglishEspañolFrançais日本語한국어Português
  • Se connecterDémarrer

Cette traduction automatique est fournie pour votre commodité.

En cas d'incohérence entre la version anglaise et la version traduite, la version anglaise prévaudra. Veuillez visiter cette page pour plus d'informations.

Créer un problème

Arrêter une interaction

Syntaxe

Java

NewRelic.endInteraction(string $interactionID)

Kotlin [#kotlin]

NewRelic. endInteraction(id : String!)

Description [#description]

New Relic met fin automatiquement à toutes les interactions, mais vous pouvez utiliser endInteraction() pour mettre fin plus tôt à une interaction personnalisée. L'ID de chaîne est renvoyé lorsque vous utilisez l'appel startInteraction() .

Cet appel n'a aucun effet si l'interaction est déjà terminée.

Paramètres [#parameters]

paramètres

Type

Description

interactionID

string

Requis. La valeur renvoyée par startInteraction. Il est nécessaire de passer cette chaîne pour compléter manuellement la trace d'interaction.

Exemple [#example]

Voici un exemple de fin d'une interaction personnalisée 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);
}
}
...
}

Syntaxe

Objectif-C

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

Swift [#swift]

NewRelic.stopInteraction(string: "myInteractionName")

Description [#description]

Cette méthode arrêtera la trace d'interaction associée au interactionIdentifier (qui est renvoyé par la méthode startInteractionWithName: ). Il n'est pas nécessaire d'appeler cette méthode pour compléter une trace d'interaction (une trace d'interaction se complétera intelligemment d'elle-même). Cependant, utilisez cette méthode si vous souhaitez une période d’interaction plus discrète.

Paramètres [#parameters]

paramètres

Type

Description

interactionIdentifier

string

Requis. La valeur renvoyée par startInteractionWithName: . Il est nécessaire de passer cette chaîne pour compléter manuellement la trace d'interaction.

Exemples [#examples]

Objective-C [#obj-c]

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

Swift [#swift]

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

Syntaxe

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

Description [#description]

Ceci utilise l'ID de chaîne pour l'interaction que vous souhaitez terminer. Cette chaîne est renvoyée lorsque vous utilisez startInteraction().

Paramètres [#parameters]

paramètres

Type

Description

interactionID

string

Requis. La valeur renvoyée par startInteraction. Il est nécessaire de passer cette chaîne pour compléter manuellement la trace d'interaction.

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

Syntaxe

endInteraction(id: InteractionId): void;

Description [#description]

Ceci utilise l'ID de chaîne pour l'interaction que vous souhaitez terminer. Cette chaîne est renvoyée lorsque vous utilisez startInteraction().

Paramètres [#parameters]

paramètres

Type

Description

id

InteractionId

Requis. La valeur renvoyée par startInteraction. Il est nécessaire de passer cette chaîne pour compléter manuellement la trace d'interaction.

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

Syntaxe

EndInteraction(string interactionId): void;

Description [#description]

Ceci utilise l'ID de chaîne pour l'interaction que vous souhaitez terminer. Cette chaîne est renvoyée lorsque vous utilisez startInteraction().

Paramètres [#parameters]

paramètres

Type

Description

interactionId

string

Requis. La valeur renvoyée par startInteraction. Il est nécessaire de passer cette chaîne pour compléter manuellement la trace d'interaction.

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

Syntaxe

endInteraction(String interactionId): void;

Description [#description]

Ceci utilise l'ID de chaîne pour l'interaction que vous souhaitez terminer. Cette chaîne est renvoyée lorsque vous utilisez startInteraction().

Paramètres [#parameters]

paramètres

Type

Description

interactionId

string

Requis. La valeur renvoyée par startInteraction. Il est nécessaire de passer cette chaîne pour compléter manuellement la trace d'interaction.

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

Syntaxe

endInteraction(id: InteractionId): void;

Description [#description]

Ceci utilise l'ID de chaîne pour l'interaction que vous souhaitez terminer. Cette chaîne est renvoyée lorsque vous utilisez startInteraction().

Paramètres [#parameters]

paramètres

Type

Description

InteractionID

string

Requis. La valeur renvoyée par startInteraction. Il est nécessaire de passer cette chaîne pour compléter manuellement la trace d'interaction.

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

Syntaxe

StopCurrentInteraction(string interactionId): void;

Description [#description]

Ceci utilise l'ID de chaîne pour l'interaction que vous souhaitez terminer. Cette chaîne est renvoyée lorsque vous utilisez startInteraction().

Paramètres [#parameters]

paramètres

Type

Description

interactionId

string

Requis. La valeur renvoyée par startInteraction. Il est nécessaire de passer cette chaîne pour compléter manuellement la trace d'interaction.

Exemple [#example]

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

Syntaxe

endInterAction(FString interActionId): void;

Description [#description]

Ceci utilise l'ID de chaîne pour l'interaction que vous souhaitez terminer. Cette chaîne est renvoyée lorsque vous utilisez startInteraction().

Paramètres [#parameters]

paramètres

Type

Description

interactionId

FString

Requis. La valeur renvoyée par startInteraction. Il est nécessaire de passer cette chaîne pour compléter manuellement la trace d'interaction.

Exemple [#example]

#include "NewRelicBPLibrary.h"
FString id = UNewRelicBPLibrary::startInterAction("test Unreal InterAction");
FPlatformProcess::Sleep(6.0);
UNewRelicBPLibrary::endInterAction(id);
Screenshot of the Unreal Engine Plugin Stop InterAction

Syntaxe

EndInteraction(string interactionId): void;

Description [#description]

Ceci utilise l'ID de chaîne pour l'interaction que vous souhaitez terminer. Cette chaîne est renvoyée lorsque vous utilisez startInteraction().

Paramètres [#parameters]

paramètres

Type

Description

interactionId

string

Requis. La valeur renvoyée par startInteraction. Il est nécessaire de passer cette chaîne pour compléter manuellement la trace d'interaction.

Exemple [#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);
Droits d'auteur © 2025 New Relic Inc.

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