git.colasdn.top/newrelic/go-agent@v3.26.0+incompatible/attributes.go (about) 1 // Copyright 2020 New Relic Corporation. All rights reserved. 2 // SPDX-License-Identifier: Apache-2.0 3 4 package newrelic 5 6 // This file contains the names of the automatically captured attributes. 7 // Attributes are key value pairs attached to transaction events, error events, 8 // and traced errors. You may add your own attributes using the 9 // Transaction.AddAttribute method (see transaction.go). 10 // 11 // These attribute names are exposed here to facilitate configuration. 12 // 13 // For more information, see: 14 // https://docs.newrelic.com/docs/agents/manage-apm-agents/agent-metrics/agent-attributes 15 16 // Attributes destined for Transaction Events, Errors, and Transaction Traces: 17 const ( 18 // AttributeResponseCode is the response status code for a web request. 19 AttributeResponseCode = "httpResponseCode" 20 // AttributeRequestMethod is the request's method. 21 AttributeRequestMethod = "request.method" 22 // AttributeRequestAccept is the request's "Accept" header. 23 AttributeRequestAccept = "request.headers.accept" 24 // AttributeRequestContentType is the request's "Content-Type" header. 25 AttributeRequestContentType = "request.headers.contentType" 26 // AttributeRequestContentLength is the request's "Content-Length" header. 27 AttributeRequestContentLength = "request.headers.contentLength" 28 // AttributeRequestHost is the request's "Host" header. 29 AttributeRequestHost = "request.headers.host" 30 // AttributeRequestURI is the request's URL without query parameters, 31 // fragment, user, or password. 32 AttributeRequestURI = "request.uri" 33 // AttributeResponseContentType is the response "Content-Type" header. 34 AttributeResponseContentType = "response.headers.contentType" 35 // AttributeResponseContentLength is the response "Content-Length" header. 36 AttributeResponseContentLength = "response.headers.contentLength" 37 // AttributeHostDisplayName contains the value of Config.HostDisplayName. 38 AttributeHostDisplayName = "host.displayName" 39 ) 40 41 // Attributes destined for Errors and Transaction Traces: 42 const ( 43 // AttributeRequestUserAgent is the request's "User-Agent" header. 44 AttributeRequestUserAgent = "request.headers.User-Agent" 45 // AttributeRequestReferer is the request's "Referer" header. Query 46 // string parameters are removed. 47 AttributeRequestReferer = "request.headers.referer" 48 ) 49 50 // AWS Lambda specific attributes: 51 const ( 52 AttributeAWSRequestID = "aws.requestId" 53 AttributeAWSLambdaARN = "aws.lambda.arn" 54 AttributeAWSLambdaColdStart = "aws.lambda.coldStart" 55 AttributeAWSLambdaEventSourceARN = "aws.lambda.eventSource.arn" 56 ) 57 58 // Attributes for consumed message transactions: 59 // 60 // When a message is consumed (for example from Kafka or RabbitMQ), supported 61 // instrumentation packages -- i.e. those found in the _integrations 62 // (https://godoc.org/github.com/newrelic/go-agent/_integrations) directory -- 63 // will add these attributes automatically. `AttributeMessageExchangeType`, 64 // `AttributeMessageReplyTo`, and `AttributeMessageCorrelationID` are disabled 65 // by default. To see these attributes added to all destinations, you must add 66 // include them in your config settings: 67 // 68 // cfg.Attributes.Include = append(cfg.Attributes.Include, 69 // AttributeMessageExchangeType, AttributeMessageReplyTo, 70 // AttributeMessageCorrelationID) 71 // 72 // When not using a supported instrumentation package, you can add these 73 // attributes manually using the `Transaction.AddAttribute` 74 // (https://godoc.org/github.com/newrelic/go-agent#Transaction) API. In this 75 // case, these attributes will be included on all destintations by default. 76 // 77 // txn := app.StartTransaction("Message/RabbitMQ/Exchange/Named/MyExchange", nil, nil) 78 // txn.AddAttribute(AttributeMessageRoutingKey, "myRoutingKey") 79 // txn.AddAttribute(AttributeMessageQueueName, "myQueueName") 80 // txn.AddAttribute(AttributeMessageExchangeType, "myExchangeType") 81 // txn.AddAttribute(AttributeMessageReplyTo, "myReplyTo") 82 // txn.AddAttribute(AttributeMessageCorrelationID, "myCorrelationID") 83 // // ... consume a message ... 84 // txn.End() 85 // 86 // It is recommended that at most one message is consumed per transaction. 87 const ( 88 // The routing key of the consumed message. 89 AttributeMessageRoutingKey = "message.routingKey" 90 // The name of the queue the message was consumed from. 91 AttributeMessageQueueName = "message.queueName" 92 // The type of exchange used for the consumed message (direct, fanout, 93 // topic, or headers). 94 AttributeMessageExchangeType = "message.exchangeType" 95 // The callback queue used in RPC configurations. 96 AttributeMessageReplyTo = "message.replyTo" 97 // The application-generated identifier used in RPC configurations. 98 AttributeMessageCorrelationID = "message.correlationId" 99 ) 100 101 // Attributes destined for Span Events: 102 // 103 // To disable the capture of one of these span event attributes, db.statement 104 // for example, modify your Config like this: 105 // 106 // cfg.SpanEvents.Attributes.Exclude = append(cfg.SpanEvents.Attributes.Exclude, 107 // newrelic.SpanAttributeDBStatement) 108 const ( 109 SpanAttributeDBStatement = "db.statement" 110 SpanAttributeDBInstance = "db.instance" 111 SpanAttributeDBCollection = "db.collection" 112 SpanAttributePeerAddress = "peer.address" 113 SpanAttributePeerHostname = "peer.hostname" 114 SpanAttributeHTTPURL = "http.url" 115 SpanAttributeHTTPMethod = "http.method" 116 SpanAttributeAWSOperation = "aws.operation" 117 SpanAttributeAWSRequestID = "aws.requestId" 118 SpanAttributeAWSRegion = "aws.region" 119 )