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

문제 신고

비동기 애플리케이션 추적

NewGoroutine API를 사용하여 비동기 세그먼트를 추적하는 기능은 Go 에이전트 버전 2.6.0 부터 사용할 수 있습니다. 버전 2.6.0 이상이 없는 경우 Go 에이전트를 최신 버전으로 업데이트하십시오.

새로운 고루틴

Transaction.NewGoroutine() Transaction 메서드를 사용하면 트랜잭션이 여러 고루틴에서 세그먼트를 생성할 수 있습니다.

NewGoroutine Transaction 에 대한 새 참조를 반환합니다. 이것은 세그먼트를 만드는 다른 고루틴에 Transaction 을 전달할 때마다 호출되어야 합니다. 각 세그먼트 생성 고루틴에는 고유한 Transaction 참조가 있어야 합니다. 다른 고루틴이 시작되기 전이나 후에 호출해도 상관없습니다.

모든 Transaction 메서드는 모든 Transaction 참조에서 사용할 수 있습니다. TransactionEnd() 이 고루틴에서 호출될 때 종료됩니다.

Transaction 참조를 다른 고루틴에 직접 전달하는 예:

go func(txn *newrelic.Transaction) {
defer txn.StartSegment("async").End()
time.Sleep(100 * time.Millisecond)
}(txn.NewGoroutine())

채널의 새 Transaction 참조를 다른 고루틴으로 전달하는 예:

ch := make(chan *newrelic.Transaction)
go func() {
txn := <-ch
defer txn.StartSegment("async").End()
time.Sleep(100 * time.Millisecond)
}()
ch <- txn.NewGoroutine()
Copyright © 2024 New Relic Inc.

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