• /
  • ログイン

Go agent attributes

Attributes are key-value pairs containing information for transaction events, error events, and traced errors. You can adjust the destinations of default attributes and create custom attributes for the attributes collected by New Relic's Go language agent, including:

  • Error traces
  • Transaction events
  • Page views

For an extra level of monitoring detail, create custom attributes.

Go agent attributes

The Go agent receives the following default attributes from your app. You can adjust these default settings and turn attributes on or off for certain destinations.

重要

As of Go agent v3.0.0, this attribute has been marked deprecated and been renamed to http.statusCode. The v3.x agent will continue to produce this attribute, but it will be removed in v4.0.0.

Span and segment attributes

If you have Go agent v2.6.0 or higher, you can configure attributes on spans and segments. The Go agent receives the following default attributes from your app. These attributes are only found on span events and transaction trace segments. You can adjust these default settings and turn attributes on or off for certain destinations.

Change attribute destination

Use these options to change attribute destinations:

Create custom attributes

Add custom attributes by using this method in a transaction:

txn.AddAttribute("key", "value")

The txn variable is the one instrumented for the Go transaction. For example:

txn.AddAttribute("product", "widget")
txn.AddAttribute("price", 19.99)
txn.AddAttribute("importantCustomer", true)

Default settings for custom attribute destinations:

  • Error collector (traced errors): Enabled
  • Transaction events: Enabled

For more help

その他のヘルプ

さらに支援が必要な場合は、これらのサポートと学習リソースを確認してください:

問題を作成するこのページを編集する
Copyright © 2020 New Relic Inc.