저는 New Relic에서 일합니다.
만큼 그들은 이러한 요구 사항을 충족 비 IIS 응용 프로그램의 성능을 모니터링 할 수 있습니다 :
인스트루먼트 모든 .NET 응용 프로그램이 사용 가능해야하는 기능
자세한 내용은 설명서 사이트에서 확인할 수 있습니다. https://docs.newrelic.com/docs/dotnet/instrumenting-custom-applications
.NET 에이전트 API를 사용하여 사용자 지정 메트릭을 수집해야 할 수도 있습니다. RecordMetric, RecordResponseTimeMetric 및 IncrementCounter 메소드는 웹 이외의 응용 프로그램과 함께 작동합니다. .NET 에이전트 API 설명서는 다음 위치에 있습니다. https://docs.newrelic.com/docs/dotnet/net-agent-api
웹 트랜잭션이 아닌 트랜잭션을 추적하도록 사용자 정의 트랜잭션을 설정할 수도 있습니다. 일반적으로 HttpObjects를 사용하는 함수는 추적 할 수 있지만 다음은 에이전트 버전 2.24.218.0에 구현 된 새로운 기능입니다. 트랜잭션 컨텍스트가없는 비 웹 응용 프로그램 및 비동기 호출의 경우 다음 기능을 사용하여 일반적으로 에이전트가 수행하지 않는 트랜잭션을 만들 수 있습니다. 이는 사용자 정의 계측 파일을 통한 수동 프로세스입니다.
CoreInstrumentation.xml과 함께 C : \ ProgramData \ New Relic.NET Agent \ Extensions에 CustomInstrumentation.xml이라는 사용자 지정 계측 파일을 만듭니다. 사용자 정의 계측 파일에 다음 내용을 추가합니다 :
<?xml version="1.0" encoding="utf-8"?>
<extension xmlns="urn:newrelic-extension">
<instrumentation>
<tracerFactory name="NewRelic.Agent.Core.Tracer.Factories.BackgroundThreadTracerFactory" metricName="Category/Name">
<match assemblyName="AssemblyName" className="NameSpace.ClassName">
<exactMethodMatcher methodName="MethodName" />
</match>
</tracerFactory>
</instrumentation>
</extension>
당신은 변경해야 속성이 위 카테고리/이름,의 AssemblyName, NameSpace.ClassName 및 methodName로 값 :
거래를 시작할 때 형 이름 공간의 객체 AssemblyName 어셈블리의 .ClassName은 MethodName 메서드를 호출합니다. 메소드가 메소드를 리턴하거나 예외를 던지면 트랜잭션이 종료됩니다. 트랜잭션의 이름은 Name이며 카테고리로 지정된 트랜잭션 유형으로 그룹화됩니다. New Relic UI에서는 Monitoring> Transactions 페이지를 볼 때 Type 드롭 다운 메뉴에서 트랜잭션 유형을 선택할 수 있습니다.
범주와 이름이 모두 있어야하며 슬래시로 구분해야합니다.
예상대로 메소드 호출 중에 발생하는 계측 된 활동 (메소드, 데이터베이스, 외부)은 트랜잭션의 분석 테이블과 트랜잭션 추적에 표시됩니다.
다음은 좀 더 구체적인 예입니다. 첫째, 계측 파일 :
<?xml version="1.0" encoding="utf-8"?>
<extension xmlns="urn:newrelic-extension">
<instrumentation>
<tracerFactory name="NewRelic.Agent.Core.Tracer.Factories.BackgroundThreadTracerFactory" metricName="Background/Bars">
<match assemblyName="Foo" className="Foo.Bar">
<exactMethodMatcher methodName="Bar1" />
<exactMethodMatcher methodName="Bar2" />
</match>
</tracerFactory>
<tracerFactory metricName="Custom/some custom metric name">
<match assemblyName="Foo" className="Foo.Bar">
<exactMethodMatcher methodName="Bar3" />
</match>
</tracerFactory>
</instrumentation>
</extension>
이제 몇 가지 코드 :
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Custom Transactions");
var t = new CustomTransaction();
for (int i = 0; i < 100; ++i)
t.StartTransaction();
}
}
class CustomTransaction
{
public void StartTransaction()
{
Console.WriteLine("StartTransaction");
Dummy();
}
void Dummy()
{
System.Threading.Thread.Sleep(5000);
}
}
}
사용하여 다음과 같은 사용자 정의 계측 파일 : 여기
var foo = new Foo();
foo.Bar1(); // Creates a transaction named Bars in category Background
foo.Bar2(); // Same here.
foo.Bar3(); // Won't create a new transaction. See notes below.
public class Foo
{
// this will result in a transaction with an External Service request segment in the transaction trace
public void Bar1()
{
new WebClient().DownloadString("http://www.google.com/);
}
// this will result in a transaction that has one segment with a category of "Custom" and a name of "some custom metric name"
public void Bar2()
{
// the segment for Bar3 will contain your SQL query inside of it and possibly an execution plan
Bar3();
}
// if Bar3 is called directly, it won't get a transaction made for it.
// However, if it is called inside of Bar1 or Bar2 then it will show up as a segment containing the SQL query
private void Bar3()
{
using (var connection = new SqlConnection(ConnectionStrings["MsSqlConnection"].ConnectionString))
{
connection.Open();
using (var command = new SqlCommand("SELECT * FROM table", connection))
using (var reader = command.ExecuteReader())
{
reader.Read();
}
}
}
}
은 사용자 정의 트랜잭션을 설명하는 간단한 콘솔 응용 프로그램입니다
<?xml version="1.0" encoding="utf-8"?>
<extension xmlns="urn:newrelic-extension">
<instrumentation>
<tracerFactory name="NewRelic.Agent.Core.Tracer.Factories.BackgroundThreadTracerFactory" metricName="Background/CustomTransaction">
<match assemblyName="ConsoleApplication1" className="ConsoleApplication1.CustomTransaction">
<exactMethodMatcher methodName="StartTransaction" />
</match>
</tracerFactory>
<tracerFactory metricName="Custom/Dummy">
<match assemblyName="ConsoleApplication1" className="ConsoleApplication1.CustomTransaction">
<exactMethodMatcher methodName="Dummy" />
</match>
</tracerFactory>
</instrumentation>
</extension>
감사합니다. 자세한 대답은 그것은 내가 문서에서 하루 종일 읽고있는 것을 요약합니다. 이 시점에서 일종의 glob 패턴 접근법을 사용하여 모든 코드를 모니터 할 수있는 방법이 없다는 것을 이해합니다. (즉,'*') 특정 클래스에서 호출 된 메소드는 앱 도메인과 관련없이 모니터링됩니다. 확인 할수 있어요? – Ali
안녕하세요, 다시 말하지만 당신은 너무 많은 자원을 집중적으로 사용하기 때문에 *로 모든 것을 추적 할 방법이 없다고 말하는 것이 맞습니다. – karlpcrowley
나는 너의 대답을 확실히 받아 들일 것이다. 또한 .NET 용 SDK에 대한 계획이 있는지 알려 주시면 프로젝트에서 _automagically_를 추적 할 수 있습니다. 고맙습니다. – Ali