• 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.

問題を作成する

最小限のAPIエンドポイントが1つのトランザクションとして表示される

問題

.NETエージェントが、Asp.Net Coreの「最小限のAPI」アプリケーションを監視している場合、複数のエンドポイントが1つのウェブトランザクションとして表示されることがあります。この原因は、エンドポイントが異なるHTTPリクエストメソッドを持っている場合でも、同じルートパスを共有するためです。

これらのエンドポイントを区別するには、SetTransactionName() API呼び出しを適用することをお勧めします。

解決

SetTransactionName()を追加して、各エンドポイントに一意のトランザクション名を指定します。API呼び出しの引数は異なる場合がありますが、以下の例のようにSetTransactionName()を追加することをお勧めします。

// map a minimal API with GET and POST endpoints on the same route
app.MapGet(/minimalApi”, () =>
{
NewRelic.Api.Agent.NewRelic.SetTransactionName(null, name: “minimalApi/Get”);
return Results.Ok(“Get: minimalApi”);
});
app.MapPost(/minimalApi”, () =>
{
NewRelic.Api.Agent.NewRelic.SetTransactionName(null, name: “minimalApi/Post”);
return Results.Ok(“Post: minimalApi”);
});

トランザクションへの名前の設定方法については、SetTransactionNameドキュメントを参照してください。

Copyright © 2024 New Relic株式会社。

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