Skip to content

Commit

Permalink
Rename response.statusCode to http.statusCode.
Browse files Browse the repository at this point in the history
  • Loading branch information
purple4reina committed Dec 16, 2019
1 parent 616d591 commit 0f9a6de
Show file tree
Hide file tree
Showing 15 changed files with 70 additions and 70 deletions.
4 changes: 2 additions & 2 deletions MIGRATION.md
Expand Up @@ -130,7 +130,7 @@ Two attributes have been renamed. The old names will still be reported, but are

| Old (deprecated) attribute | New attribute |
|------------------------------|------------------------------|
| `httpResponseCode` | `response.statusCode` |
| `httpResponseCode` | `http.statusCode` |
| `request.headers.User-Agent` | `request.headers.userAgent` |

Since in v3.0 both the deprecated and the new attribute are being reported, if you have configured your application to ignore one or both of these attributes, such as with `Config.Attributes.Exclude`, you will now need to specify both the deprecated and the new attribute name in your configuration.
Expand Down Expand Up @@ -539,7 +539,7 @@ var _ newrelic.ErrorAttributer = MyErrorType{}
```go
config.ErrorCollector.Attributes.Exclude = []string{
"response.statusCode",
"http.statusCode",
"httpResponseCode",
"request.headers.userAgent",
"request.headers.User-Agent",
Expand Down
20 changes: 10 additions & 10 deletions v3/integrations/nrecho-v3/nrecho_test.go
Expand Up @@ -41,7 +41,7 @@ func TestBasicRoute(t *testing.T) {
},
AgentAttributes: map[string]interface{}{
"httpResponseCode": "200",
"response.statusCode": "200",
"http.statusCode": "200",
"request.method": "GET",
"response.headers.contentType": "text/html",
"request.uri": "/hello",
Expand Down Expand Up @@ -166,10 +166,10 @@ func TestReturnsHTTPError(t *testing.T) {
"nr.apdexPerfZone": "F",
},
AgentAttributes: map[string]interface{}{
"httpResponseCode": "418",
"response.statusCode": "418",
"request.method": "GET",
"request.uri": "/hello",
"httpResponseCode": "418",
"http.statusCode": "418",
"request.method": "GET",
"request.uri": "/hello",
},
UserAttributes: map[string]interface{}{},
}})
Expand Down Expand Up @@ -202,10 +202,10 @@ func TestReturnsError(t *testing.T) {
"nr.apdexPerfZone": "F",
},
AgentAttributes: map[string]interface{}{
"httpResponseCode": "500",
"response.statusCode": "500",
"request.method": "GET",
"request.uri": "/hello",
"httpResponseCode": "500",
"http.statusCode": "500",
"request.method": "GET",
"request.uri": "/hello",
},
UserAttributes: map[string]interface{}{},
}})
Expand Down Expand Up @@ -239,7 +239,7 @@ func TestResponseCode(t *testing.T) {
},
AgentAttributes: map[string]interface{}{
"httpResponseCode": "418",
"response.statusCode": "418",
"http.statusCode": "418",
"request.method": "GET",
"response.headers.contentType": "text/html",
"request.uri": "/hello",
Expand Down
20 changes: 10 additions & 10 deletions v3/integrations/nrecho-v4/nrecho_test.go
Expand Up @@ -41,7 +41,7 @@ func TestBasicRoute(t *testing.T) {
},
AgentAttributes: map[string]interface{}{
"httpResponseCode": "200",
"response.statusCode": "200",
"http.statusCode": "200",
"request.method": "GET",
"response.headers.contentType": "text/html",
"request.uri": "/hello",
Expand Down Expand Up @@ -166,10 +166,10 @@ func TestReturnsHTTPError(t *testing.T) {
"nr.apdexPerfZone": "F",
},
AgentAttributes: map[string]interface{}{
"httpResponseCode": "418",
"response.statusCode": "418",
"request.method": "GET",
"request.uri": "/hello",
"httpResponseCode": "418",
"http.statusCode": "418",
"request.method": "GET",
"request.uri": "/hello",
},
UserAttributes: map[string]interface{}{},
}})
Expand Down Expand Up @@ -202,10 +202,10 @@ func TestReturnsError(t *testing.T) {
"nr.apdexPerfZone": "F",
},
AgentAttributes: map[string]interface{}{
"httpResponseCode": "500",
"response.statusCode": "500",
"request.method": "GET",
"request.uri": "/hello",
"httpResponseCode": "500",
"http.statusCode": "500",
"request.method": "GET",
"request.uri": "/hello",
},
UserAttributes: map[string]interface{}{},
}})
Expand Down Expand Up @@ -239,7 +239,7 @@ func TestResponseCode(t *testing.T) {
},
AgentAttributes: map[string]interface{}{
"httpResponseCode": "418",
"response.statusCode": "418",
"http.statusCode": "418",
"request.method": "GET",
"response.headers.contentType": "text/html",
"request.uri": "/hello",
Expand Down
10 changes: 5 additions & 5 deletions v3/integrations/nrgin/nrgin_test.go
Expand Up @@ -213,7 +213,7 @@ func TestStatusCodes(t *testing.T) {
UserAttributes: map[string]interface{}{},
AgentAttributes: map[string]interface{}{
"httpResponseCode": expectCode,
"response.statusCode": expectCode,
"http.statusCode": expectCode,
"request.method": "GET",
"request.uri": "/err",
"response.headers.contentType": "text/plain; charset=utf-8",
Expand Down Expand Up @@ -256,10 +256,10 @@ func TestNoResponseBody(t *testing.T) {
},
UserAttributes: map[string]interface{}{},
AgentAttributes: map[string]interface{}{
"httpResponseCode": expectCode,
"response.statusCode": expectCode,
"request.method": "GET",
"request.uri": "/nobody",
"httpResponseCode": expectCode,
"http.statusCode": expectCode,
"request.method": "GET",
"request.uri": "/nobody",
},
}})
}
16 changes: 8 additions & 8 deletions v3/integrations/nrgrpc/nrgrpc_server_test.go
Expand Up @@ -98,7 +98,7 @@ func TestUnaryServerInterceptor(t *testing.T) {
UserAttributes: map[string]interface{}{},
AgentAttributes: map[string]interface{}{
"httpResponseCode": 0,
"response.statusCode": 0,
"http.statusCode": 0,
"request.headers.contentType": "application/grpc",
"request.method": "TestApplication/DoUnaryUnary",
"request.uri": "grpc://bufnet/TestApplication/DoUnaryUnary",
Expand Down Expand Up @@ -168,7 +168,7 @@ func TestUnaryServerInterceptorError(t *testing.T) {
UserAttributes: map[string]interface{}{},
AgentAttributes: map[string]interface{}{
"httpResponseCode": 15,
"response.statusCode": 15,
"http.statusCode": 15,
"request.headers.contentType": "application/grpc",
"request.method": "TestApplication/DoUnaryUnaryError",
"request.uri": "grpc://bufnet/TestApplication/DoUnaryUnaryError",
Expand All @@ -186,7 +186,7 @@ func TestUnaryServerInterceptorError(t *testing.T) {
},
AgentAttributes: map[string]interface{}{
"httpResponseCode": 15,
"response.statusCode": 15,
"http.statusCode": 15,
"request.headers.User-Agent": internal.MatchAnything,
"request.headers.userAgent": internal.MatchAnything,
"request.headers.contentType": "application/grpc",
Expand Down Expand Up @@ -261,7 +261,7 @@ func TestUnaryStreamServerInterceptor(t *testing.T) {
UserAttributes: map[string]interface{}{},
AgentAttributes: map[string]interface{}{
"httpResponseCode": 0,
"response.statusCode": 0,
"http.statusCode": 0,
"request.headers.contentType": "application/grpc",
"request.method": "TestApplication/DoUnaryStream",
"request.uri": "grpc://bufnet/TestApplication/DoUnaryStream",
Expand Down Expand Up @@ -352,7 +352,7 @@ func TestStreamUnaryServerInterceptor(t *testing.T) {
UserAttributes: map[string]interface{}{},
AgentAttributes: map[string]interface{}{
"httpResponseCode": 0,
"response.statusCode": 0,
"http.statusCode": 0,
"request.headers.contentType": "application/grpc",
"request.method": "TestApplication/DoStreamUnary",
"request.uri": "grpc://bufnet/TestApplication/DoStreamUnary",
Expand Down Expand Up @@ -456,7 +456,7 @@ func TestStreamStreamServerInterceptor(t *testing.T) {
UserAttributes: map[string]interface{}{},
AgentAttributes: map[string]interface{}{
"httpResponseCode": 0,
"response.statusCode": 0,
"http.statusCode": 0,
"request.headers.contentType": "application/grpc",
"request.method": "TestApplication/DoStreamStream",
"request.uri": "grpc://bufnet/TestApplication/DoStreamStream",
Expand Down Expand Up @@ -530,7 +530,7 @@ func TestStreamServerInterceptorError(t *testing.T) {
UserAttributes: map[string]interface{}{},
AgentAttributes: map[string]interface{}{
"httpResponseCode": 15,
"response.statusCode": 15,
"http.statusCode": 15,
"request.headers.contentType": "application/grpc",
"request.method": "TestApplication/DoUnaryStreamError",
"request.uri": "grpc://bufnet/TestApplication/DoUnaryStreamError",
Expand All @@ -548,7 +548,7 @@ func TestStreamServerInterceptorError(t *testing.T) {
},
AgentAttributes: map[string]interface{}{
"httpResponseCode": 15,
"response.statusCode": 15,
"http.statusCode": 15,
"request.headers.User-Agent": internal.MatchAnything,
"request.headers.userAgent": internal.MatchAnything,
"request.headers.contentType": "application/grpc",
Expand Down
24 changes: 12 additions & 12 deletions v3/integrations/nrhttprouter/nrhttprouter_test.go
Expand Up @@ -104,10 +104,10 @@ func TestHandle(t *testing.T) {
"color": "purple",
},
AgentAttributes: map[string]interface{}{
"httpResponseCode": 500,
"response.statusCode": 500,
"request.method": "GET",
"request.uri": "/hello/person",
"httpResponseCode": 500,
"http.statusCode": 500,
"request.method": "GET",
"request.uri": "/hello/person",
},
},
})
Expand Down Expand Up @@ -148,10 +148,10 @@ func TestHandler(t *testing.T) {
"color": "purple",
},
AgentAttributes: map[string]interface{}{
"httpResponseCode": 500,
"response.statusCode": 500,
"request.method": "GET",
"request.uri": "/hello/",
"httpResponseCode": 500,
"http.statusCode": 500,
"request.method": "GET",
"request.uri": "/hello/",
},
},
})
Expand Down Expand Up @@ -235,10 +235,10 @@ func TestNotFound(t *testing.T) {
"color": "purple",
},
AgentAttributes: map[string]interface{}{
"httpResponseCode": 500,
"response.statusCode": 500,
"request.method": "GET",
"request.uri": "/hello/",
"httpResponseCode": 500,
"http.statusCode": 500,
"request.method": "GET",
"request.uri": "/hello/",
},
},
})
Expand Down
2 changes: 1 addition & 1 deletion v3/integrations/nrlambda/handler_test.go
Expand Up @@ -419,7 +419,7 @@ func TestAPIGatewayProxyResponse(t *testing.T) {
AgentAttributes: map[string]interface{}{
"aws.lambda.coldStart": true,
"httpResponseCode": "200",
"response.statusCode": "200",
"http.statusCode": "200",
"response.headers.contentType": "text/html",
},
}})
Expand Down
6 changes: 3 additions & 3 deletions v3/integrations/nrmicro/nrmicro_test.go
Expand Up @@ -653,7 +653,7 @@ func TestServerWrapperWithApp(t *testing.T) {
"request.headers.contentType": "application/json",
"request.headers.contentLength": 3,
"httpResponseCode": 200,
"response.statusCode": 200,
"http.statusCode": 200,
},
}})
}
Expand Down Expand Up @@ -724,7 +724,7 @@ func TestServerWrapperWithAppReturnsError(t *testing.T) {
"request.headers.contentType": "application/json",
"request.headers.contentLength": 3,
"httpResponseCode": 401,
"response.statusCode": 401,
"http.statusCode": 401,
},
}})
app.ExpectErrors(t, []internal.WantError{{
Expand Down Expand Up @@ -788,7 +788,7 @@ func TestServerWrapperWithAppReturnsNonMicroError(t *testing.T) {
"request.headers.contentType": "application/json",
"request.headers.contentLength": 3,
"httpResponseCode": 500,
"response.statusCode": 500,
"http.statusCode": 500,
},
}})
app.ExpectErrors(t, []internal.WantError{{
Expand Down
2 changes: 1 addition & 1 deletion v3/internal/attributes.go
Expand Up @@ -99,7 +99,7 @@ var (
attributeRequestURI: {name: "request.uri", defaultDests: usualDests},
attributeResponseHeadersContentType: {name: "response.headers.contentType", defaultDests: usualDests},
attributeResponseHeadersContentLength: {name: "response.headers.contentLength", defaultDests: usualDests},
attributeResponseCode: {name: "response.statusCode", defaultDests: usualDests},
attributeResponseCode: {name: "http.statusCode", defaultDests: usualDests},
attributeResponseCodeDeprecated: {name: "httpResponseCode", defaultDests: usualDests},
AttributeAWSRequestID: {name: "aws.requestId", defaultDests: usualDests},
AttributeAWSLambdaARN: {name: "aws.lambda.arn", defaultDests: usualDests},
Expand Down
2 changes: 1 addition & 1 deletion v3/newrelic/attributes.go
Expand Up @@ -13,7 +13,7 @@ package newrelic
// Attributes destined for Transaction Events, Errors, and Transaction Traces:
const (
// AttributeResponseCode is the response status code for a web request.
AttributeResponseCode = "response.statusCode"
AttributeResponseCode = "http.statusCode"
// AttributeResponseCodeDeprecated is the response status code for a web
// request, the same value as AttributeResponseCode. To completely exclude
// this value from a destination, both AttributeResponseCode and
Expand Down
8 changes: 4 additions & 4 deletions v3/newrelic/internal_17_test.go
Expand Up @@ -41,8 +41,8 @@ func TestWrapHandleFunc(t *testing.T) {
"transactionName": "WebTransaction/Go/GET /hello",
},
AgentAttributes: mergeAttributes(helloRequestAttributes, map[string]interface{}{
"httpResponseCode": "200",
"response.statusCode": "200",
"httpResponseCode": "200",
"http.statusCode": "200",
}),
}})
app.ExpectMetrics(t, []internal.WantMetric{
Expand Down Expand Up @@ -83,8 +83,8 @@ func TestWrapHandle(t *testing.T) {
"transactionName": "WebTransaction/Go/GET /hello",
},
AgentAttributes: mergeAttributes(helloRequestAttributes, map[string]interface{}{
"httpResponseCode": "200",
"response.statusCode": "200",
"httpResponseCode": "200",
"http.statusCode": "200",
}),
}})
app.ExpectMetrics(t, []internal.WantMetric{
Expand Down
2 changes: 1 addition & 1 deletion v3/newrelic/internal_browser_test.go
Expand Up @@ -31,7 +31,7 @@ func TestBrowserTimingHeaderSuccess(t *testing.T) {

encodingKey := browserEncodingKey(testLicenseKey)
obfuscatedTxnName, _ := internal.Obfuscate([]byte("OtherTransaction/Go/hello"), encodingKey)
obfuscatedAttributes, _ := internal.Obfuscate([]byte(`{"u":{"zip":"zap"},"a":{"response.statusCode":200}}`), encodingKey)
obfuscatedAttributes, _ := internal.Obfuscate([]byte(`{"u":{"zip":"zap"},"a":{"http.statusCode":200}}`), encodingKey)

// This is a cheat: we can't deterministically set this, but DeepEqual
// doesn't have any ability to say "equal everything except these
Expand Down
8 changes: 4 additions & 4 deletions v3/newrelic/internal_cross_process_test.go
Expand Up @@ -79,10 +79,10 @@ func TestCrossProcessWriteHeaderSuccess(t *testing.T) {
app.ExpectTxnEvents(t, []internal.WantEvent{{
Intrinsics: catIntrinsics,
AgentAttributes: map[string]interface{}{
"request.method": "GET",
"httpResponseCode": 200,
"response.statusCode": 200,
"request.uri": "newrelic.com",
"request.method": "GET",
"httpResponseCode": 200,
"http.statusCode": 200,
"request.uri": "newrelic.com",
},
UserAttributes: map[string]interface{}{},
}})
Expand Down
8 changes: 4 additions & 4 deletions v3/newrelic/internal_set_web_response_test.go
Expand Up @@ -25,8 +25,8 @@ func TestSetWebResponseNil(t *testing.T) {
txn.End()
app.ExpectTxnEvents(t, []internal.WantEvent{{
AgentAttributes: map[string]interface{}{
"httpResponseCode": 123,
"response.statusCode": 123,
"httpResponseCode": 123,
"http.statusCode": 123,
},
Intrinsics: map[string]interface{}{"name": "OtherTransaction/Go/hello"},
}})
Expand Down Expand Up @@ -59,8 +59,8 @@ func TestSetWebResponseSuccess(t *testing.T) {
}
app.ExpectTxnEvents(t, []internal.WantEvent{{
AgentAttributes: map[string]interface{}{
"httpResponseCode": 123,
"response.statusCode": 123,
"httpResponseCode": 123,
"http.statusCode": 123,
},
Intrinsics: map[string]interface{}{"name": "OtherTransaction/Go/hello"},
}})
Expand Down
8 changes: 4 additions & 4 deletions v3/newrelic/internal_test.go
Expand Up @@ -601,8 +601,8 @@ func TestResponseCodeError(t *testing.T) {
"transactionName": "WebTransaction/Go/hello",
},
AgentAttributes: mergeAttributes(helloRequestAttributes, map[string]interface{}{
"httpResponseCode": "400",
"response.statusCode": "400",
"httpResponseCode": "400",
"http.statusCode": "400",
}),
}})
app.ExpectMetrics(t, webErrorMetrics)
Expand Down Expand Up @@ -701,8 +701,8 @@ func TestResponseCodeServerSideOverwriteLocal(t *testing.T) {
"transactionName": "WebTransaction/Go/hello",
},
AgentAttributes: mergeAttributes(helloRequestAttributes, map[string]interface{}{
"httpResponseCode": "404",
"response.statusCode": "404",
"httpResponseCode": "404",
"http.statusCode": "404",
}),
}})
app.ExpectMetrics(t, webErrorMetrics)
Expand Down

0 comments on commit 0f9a6de

Please sign in to comment.