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

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

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

問題を作成する

失敗したHTTPトランザクションを追跡する

構文

Java

NewRelic.noticeNetworkFailure(string $url, string $httpMethod, long $startTime, long $endTime, exception $exception OR enum $networkFailure)

コトリン [#kotlin]

NewRelic.noticeNetworkFailure(
url: String?,
httpMethod: String?,
startTime: Long,
endTime: Long,
failure: NetworkFailure?,
)

説明 [#description]

New Relic Android SDK API は、 ネットワーク リクエストを追跡するためのいくつかのメソッドを提供します。ネットワーク リクエストが失敗した場合は、 noticeNetworkFailureを使用して失敗に関する詳細を記録できます。ほとんどの場合、この呼び出しは、catch ブロックなどの例外ハンドラー内に配置します。

パラメーター [#parameters]

パラメータ

タイプ

説明

$url

string

必須です。リクエストのURLです。

$httpMethod

string

必要です。GETやPOSTなど、使用するHTTPメソッドです。

$startTime

long

必須。リクエストの開始時刻をエポックからのミリ秒で表したもの。

$endTime

long

必須。リクエストの終了時刻をエポックからのミリ秒で表したもの。

$exception

string

このパラメーターまたは$failureパラメーターのいずれかが必要です。これが発生した例外です。New Relic は、多くの一般的な例外をネットワーク障害の種類に自動的に変換できます。

$failure

enum

このパラメーターまたは$exceptionパラメーターのいずれかが必要です。発生したネットワーク障害のタイプ。例外をネットワーク障害に自動的に解決できない場合は、この方法を使用して障害を正確に分類できます。値はNetworkFailure列挙によって定義されます。有効な値には、 UnknownBadURLTimedOutCannotConnectToHostDNSLookupFailedBadServerResponse 、およびSecureConnectionFailedが含まれます。

[#examples]

ここでは、New Relic に通知されるネットワーク障害の一部としてエラーを使用するエラーリスナーの例を示します。

Java [#java]

new Response.ErrorListener() {
@Override
public void onErrorResponse(Error error) {
NewRelic.noticeNetworkFailure(badUrl, "GET", System.nanoTime(), System.nanoTime(), NetworkFailure.exceptionToNetworkFailure(error));
}

コトリン [#kotlin]

NewRelic.noticeNetworkFailure(badUrl, "GET", System.nanoTime(), System.nanoTime(), NetworkFailure.exceptionToNetworkFailure(error))

構文

目的-c

+ (void)noticeNetworkFailureForURL:(NSURL*)url
httpMethod:(NSString*)httpMethod
withTimer:(NRTimer*)timer
andFailureCode:(NSInteger)iOSFailureCode;

迅速 [#swift]

func noticeNetworkFailure(for: URL, httpMethod: String, with: NRTimer, andFailureCode: Int)

説明 [#description]

失敗したリクエストとは、TCP タイムアウト、SSL の失敗、接続の閉鎖などによってサーバーから完全な応答を受信できなかったリクエストです。

パラメーター [#parameters]

パラメータ

タイプ

説明

$url

NSURL

必須です。リクエストのURLです。

$httpMethod

string

必須。リクエストの HTTP メソッド。

$timer

NRTimer

必須。リクエストの開始と終了をキャプチャするタイマー。

$iOSFailureCode

NSInteger

必須。このメソッドに渡す失敗コードは、 Apple の文書化された NSURLConnection 失敗コードに関連付ける必要があります。

[#examples]

Objective-C [#obj-c]

[NewRelic noticeNetworkFailureForURL:[NSURL URLWithString:@"https://www.newrelic.com"]
httpMethod:@"GET"
withTimer:[[NRTimer alloc] init]
andFailureCode:NSURLErrorTimedOut];

迅速

NewRelic.noticeNetworkFailure(for: URL(string: "https://www.newrelic.com"), httpMethod: "GET",
with: NRTimer(), andFailureCode: NSURLErrorTimedOut)

構文

noticeNetworkFailure(url: string, httpMethod: string, startTime: number, endTime: number, failure: string): void;

説明 [#description]

ネットワーク障害を記録します。ネットワーク要求が失敗した場合は、この方法を使用して失敗に関する詳細を記録します。

パラメーター [#parameters]

パラメータ

タイプ

説明

url

string

必須です。リクエストのURLです。

httpMethod

string

必須。リクエストの HTTP メソッド。

startTime

number

オプション。エポックからのリクエストの開始時刻 (ミリ秒単位)。startTimeendTime timerの代わりに使用できます。

endTime

number

オプション。エポックからのリクエストの終了時刻 (ミリ秒単位)。startTimeendTime timerの代わりに使用できます。

failure

string

オプション。ほとんどの場合、この呼び出しは、catch ブロックなどの例外ハンドラー内に配置します。サポートされている障害は次のとおりです: UnknownBadURLTimedOutCannotConnectToHostDNSLookupFailedBadServerResponseSecureConnectionFailed

[#example]

NewRelic.noticeNetworkFailure('https://fakewebsite.com', 'GET', Date.now(), Date.now(), 'BadURL');

構文

void NoticeNetworkFailure(string url, string httpMethod, long startTime, long endTime, NetworkFailure failure);

説明 [#description]

ネットワーク障害を記録します。ネットワーク要求が失敗した場合は、この方法を使用して失敗に関する詳細を記録します。

パラメーター [#parameters]

パラメータ

タイプ

説明

url

string

必須です。リクエストのURLです。

httpMethod

string

必須。リクエストの HTTP メソッド。

startTime

number

オプション。エポックからのリクエストの開始時刻 (ミリ秒単位)。startTimeendTime timerの代わりに使用できます。

endTime

number

オプション。エポックからのリクエストの終了時刻 (ミリ秒単位)。startTimeendTime timerの代わりに使用できます。

failure

string

オプション。ほとんどの場合、この呼び出しは、catch ブロックなどの例外ハンドラー内に配置します。サポートされている障害は次のとおりです: UnknownBadURLTimedOutCannotConnectToHostDNSLookupFailedBadServerResponseSecureConnectionFailed

[#example]

CrossNewRelic.Current.NoticeNetworkFailure(
"https://fakewebsite.com",
"GET",
DateTimeOffset.Now.ToUnixTimeMilliseconds(),
DateTimeOffset.Now.ToUnixTimeMilliseconds() + 100,
NetworkFailure.Unknown
);

構文

noticeNetworkFailure(String url,String httpMethod,int startTime,int endTime,NetworkFailure errorCode): void;

説明 [#description]

ネットワーク障害を記録します。ネットワーク要求が失敗した場合は、この方法を使用して失敗に関する詳細を記録します。

パラメーター [#parameters]

パラメータ

タイプ

説明

url

string

必須です。リクエストのURLです。

httpMethod

string

必須。リクエストの HTTP メソッド。

startTime

int

オプション。エポックからのリクエストの開始時刻 (ミリ秒単位)。startTimeendTime timerの代わりに使用できます。

endTime

int

オプション。エポックからのリクエストの終了時刻 (ミリ秒単位)。startTimeendTime timerの代わりに使用できます。

errorCode

network failure

必要。ほとんどの場合、この呼び出しは、catch ブロックなどの例外ハンドラー内に配置します。サポートされている障害は次のとおりです: UnknownBadURLTimedOutCannotConnectToHostDNSLookupFailedBadServerResponseSecureConnectionFailed

[#example]

NewrelicMobile.instance.noticeNetworkFailure("https://cb6b02be-a319-4de5-a3b1-361de2564493.mock.pstmn.io/searchpage", "GET", 1000, 2000,'Test Network Failure', NetworkFailure.dnsLookupFailed);

構文

noticeNetworkFailure(url: string, httpMethod: string, startTime: number, endTime: number, failure: string): void;

説明 [#description]

ネットワーク障害を記録します。ネットワーク要求が失敗した場合は、この方法を使用して失敗の詳細を記録します。ほとんどの場合、この呼び出しは、catch ブロックなどの例外ハンドラー内に配置します。

パラメーター [#parameters]

パラメータ

タイプ

説明

url

string

必須です。リクエストのURLです。

httpMethod

string

必須。リクエストの HTTP メソッド。

startTime

number

オプション。エポックからのリクエストの開始時刻 (ミリ秒単位)。startTimeendTime timerの代わりに使用できます。

endTime

number

オプション。エポックからのリクエストの終了時刻 (ミリ秒単位)。startTimeendTime timerの代わりに使用できます。

failure

string

必要。ほとんどの場合、この呼び出しは、catch ブロックなどの例外ハンドラー内に配置します。サポートされている障害は次のとおりです: UnknownBadURLTimedOutCannotConnectToHostDNSLookupFailedBadServerResponseSecureConnectionFailed

[#example]

NewRelic.noticeNetworkFailure('https://github.com', 'GET', Date.now(), Date.now(), NewRelic.NetworkFailure.BadURL);

構文

NoticeNetworkFailure(string url, string httpMethod, long startTime, long endTime, NetworkFailure failure)

説明 [#description]

ネットワーク障害を記録します。ネットワーク要求が失敗した場合は、この方法を使用して失敗に関する詳細を記録します。

パラメーター [#parameters]

パラメータ

タイプ

説明

url

string

必須です。リクエストのURLです。

httpMethod

string

必須。リクエストの HTTP メソッド。

startTime

number

オプション。エポックからのリクエストの開始時刻 (ミリ秒単位)。startTimeendTime timerの代わりに使用できます。

endTime

number

オプション。エポックからのリクエストの終了時刻 (ミリ秒単位)。startTimeendTime timerの代わりに使用できます。

failure

string

オプション。ほとんどの場合、この呼び出しは、catch ブロックなどの例外ハンドラー内に配置します。サポートされている障害は次のとおりです: UnknownBadURLTimedOutCannotConnectToHostDNSLookupFailedBadServerResponseSecureConnectionFailed

[#example]

CrossNewRelicClient.Current.NoticeNetworkFailure(
"https://fakewebsite.com",
"GET",
DateTimeOffset.Now.ToUnixTimeMilliseconds(),
DateTimeOffset.Now.ToUnixTimeMilliseconds() + 100,
NetworkFailure.Unknown
);
Copyright © 2024 New Relic株式会社。

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