From 0950f6b8afb8b9f5044f9b3e63cb5ffc3fc338c0 Mon Sep 17 00:00:00 2001 From: Zack Date: Fri, 7 Apr 2017 15:02:35 -0700 Subject: [PATCH 1/2] Update response.http.code to response.code and response.latency to response.duration to line up with the canonical attributes in istio/istio.github.io/docs/concepts/attributes.md --- src/envoy/mixer/http_control.cc | 10 +++++----- src/envoy/mixer/integration_test/check_report_test.go | 8 ++++---- .../mixer/integration_test/failed_request_test.go | 8 ++++---- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/envoy/mixer/http_control.cc b/src/envoy/mixer/http_control.cc index 8283482dff3..5976c871893 100644 --- a/src/envoy/mixer/http_control.cc +++ b/src/envoy/mixer/http_control.cc @@ -44,8 +44,8 @@ const std::string kRequestSize = "request.size"; const std::string kRequestTime = "request.time"; const std::string kResponseHeaders = "response.headers"; -const std::string kResponseHttpCode = "response.http.code"; -const std::string kResponseLatency = "response.latency"; +const std::string kResponseCode = "response.code"; +const std::string kResponseDuration = "response.duration"; const std::string kResponseSize = "response.size"; const std::string kResponseTime = "response.time"; @@ -118,14 +118,14 @@ void FillRequestInfoAttributes(const AccessLog::RequestInfo& info, attr->attributes[kResponseSize] = Attributes::Int64Value(info.bytesSent()); } - attr->attributes[kResponseLatency] = Attributes::DurationValue( + attr->attributes[kResponseDuration] = Attributes::DurationValue( std::chrono::duration_cast(info.duration())); if (info.responseCode().valid()) { - attr->attributes[kResponseHttpCode] = + attr->attributes[kResponseCode] = Attributes::Int64Value(info.responseCode().value()); } else { - attr->attributes[kResponseHttpCode] = + attr->attributes[kResponseCode] = Attributes::Int64Value(check_status_code); } } diff --git a/src/envoy/mixer/integration_test/check_report_test.go b/src/envoy/mixer/integration_test/check_report_test.go index 71d8a3f6bb9..9b9708c19b2 100644 --- a/src/envoy/mixer/integration_test/check_report_test.go +++ b/src/envoy/mixer/integration_test/check_report_test.go @@ -61,8 +61,8 @@ const reportAttributesOkGet = ` "request.size": 0, "response.time": "*", "response.size": 0, - "response.latency": "*", - "response.http.code": 200, + "response.duration": "*", + "response.code": 200, "response.headers": { "date": "*", "content-type": "text/plain; charset=utf-8", @@ -115,8 +115,8 @@ const reportAttributesOkPost = ` "request.size": 12, "response.time": "*", "response.size": 12, - "response.latency": "*", - "response.http.code": 200, + "response.duration": "*", + "response.code": 200, "response.headers": { "date": "*", "content-type": "text/plain", diff --git a/src/envoy/mixer/integration_test/failed_request_test.go b/src/envoy/mixer/integration_test/failed_request_test.go index 9ae99bcf81d..011227afa6f 100644 --- a/src/envoy/mixer/integration_test/failed_request_test.go +++ b/src/envoy/mixer/integration_test/failed_request_test.go @@ -67,8 +67,8 @@ const reportAttributesMixerFail = ` "request.size": 0, "response.time": "*", "response.size": 41, - "response.latency": "*", - "response.http.code": 401, + "response.duration": "*", + "response.code": 401, "response.headers": { "date": "*", "content-type": "text/plain", @@ -100,8 +100,8 @@ const reportAttributesBackendFail = ` "request.size": 0, "response.time": "*", "response.size": 25, - "response.latency": "*", - "response.http.code": 400, + "response.duration": "*", + "response.code": 400, "response.headers": { "date": "*", "content-type": "text/plain; charset=utf-8", From 59baf89e1c8f3ece99e7f41d2f2811993e6be0aa Mon Sep 17 00:00:00 2001 From: Zack Date: Fri, 7 Apr 2017 15:15:00 -0700 Subject: [PATCH 2/2] Format according to clang-format --- src/envoy/mixer/http_control.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/envoy/mixer/http_control.cc b/src/envoy/mixer/http_control.cc index 5976c871893..61aa3285a62 100644 --- a/src/envoy/mixer/http_control.cc +++ b/src/envoy/mixer/http_control.cc @@ -125,8 +125,7 @@ void FillRequestInfoAttributes(const AccessLog::RequestInfo& info, attr->attributes[kResponseCode] = Attributes::Int64Value(info.responseCode().value()); } else { - attr->attributes[kResponseCode] = - Attributes::Int64Value(check_status_code); + attr->attributes[kResponseCode] = Attributes::Int64Value(check_status_code); } }