Skip to content

Commit

Permalink
Update attributes to match the canonical attribute list. (#232)
Browse files Browse the repository at this point in the history
* 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

* Format according to clang-format
  • Loading branch information
ZackButcher authored and qiwzhang committed Apr 7, 2017
1 parent 1bcfab4 commit e47cfc3
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
11 changes: 5 additions & 6 deletions src/envoy/mixer/http_control.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down Expand Up @@ -118,15 +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<std::chrono::nanoseconds>(info.duration()));

if (info.responseCode().valid()) {
attr->attributes[kResponseHttpCode] =
attr->attributes[kResponseCode] =
Attributes::Int64Value(info.responseCode().value());
} else {
attr->attributes[kResponseHttpCode] =
Attributes::Int64Value(check_status_code);
attr->attributes[kResponseCode] = Attributes::Int64Value(check_status_code);
}
}

Expand Down
8 changes: 4 additions & 4 deletions src/envoy/mixer/integration_test/check_report_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
8 changes: 4 additions & 4 deletions src/envoy/mixer/integration_test/failed_request_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down

0 comments on commit e47cfc3

Please sign in to comment.