• EnglishEspañol日本語한국어Português
  • EntrarComeçar agora

Esta tradução de máquina é fornecida para sua comodidade.

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.

Criar um problema

Os endpoints mínimos da API aparecem como uma transação

Problema

Se o agente .NET estiver monitorando uma aplicação Asp..NET Core “Minimal API”, vários endpoints podem aparecer como uma única transação web. Isso ocorre porque o endpoint compartilha o mesmo caminho de rota, mesmo que tenham métodos de solicitação HTTP diferentes.

Para diferenciar esses endpoints, recomendamos aplicar a chamada de API SetTransactionName() .

Solução

Adicione SetTransactionName() para dar a cada endpoint um nome de transação exclusivo. Embora seus argumentos para a chamada de API possam variar, recomendamos adicionar SetTransactionName() como no exemplo abaixo:

// 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”);
});

Você pode ler sobre como definir nomes para transação em nosso documento SetTransactionName.

Copyright © 2024 New Relic Inc.

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