Skip to content

Commit 673b902

Browse files
authored
Use official attribute names (istio#80)
* Use official attribute names * fix format
1 parent 21f1cb3 commit 673b902

File tree

1 file changed

+12
-25
lines changed

1 file changed

+12
-25
lines changed

src/envoy/mixer/http_control.cc

Lines changed: 12 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -24,31 +24,25 @@ namespace Http {
2424
namespace Mixer {
2525
namespace {
2626

27-
const std::string kProxyPeerID = "Istio/Proxy";
28-
2927
// Define lower case string for X-Forwarded-Host.
3028
const LowerCaseString kHeaderNameXFH("x-forwarded-host", false);
3129

32-
const std::string kRequestHeaderPrefix = "requestHeader:";
33-
const std::string kRequestParamPrefix = "requestParameter:";
34-
const std::string kResponseHeaderPrefix = "responseHeader:";
30+
const std::string kRequestHeaderPrefix = "request.headers.";
31+
const std::string kResponseHeaderPrefix = "response.headers.";
3532

3633
// Define attribute names
37-
const std::string kAttrNamePeerId = "peerId";
38-
const std::string kAttrNameURL = "url";
39-
const std::string kAttrNameHttpMethod = "httpMethod";
40-
const std::string kAttrNameRequestSize = "requestSize";
41-
const std::string kAttrNameResponseSize = "responseSize";
42-
const std::string kAttrNameLogMessage = "logMessage";
43-
const std::string kAttrNameResponseTime = "responseTime";
44-
const std::string kAttrNameOriginIp = "originIp";
45-
const std::string kAttrNameOriginHost = "originHost";
34+
const std::string kAttrNameRequestPath = "request.path";
35+
const std::string kAttrNameRequestSize = "request.size";
36+
const std::string kAttrNameResponseSize = "response.size";
37+
const std::string kAttrNameResponseTime = "response.time";
38+
const std::string kAttrNameOriginIp = "origin.ip";
39+
const std::string kAttrNameOriginHost = "origin.host";
4640

4741
const std::string kEnvNameSourceService = "SOURCE_SERVICE";
4842
const std::string kEnvNameTargetService = "TARGET_SERVICE";
4943

50-
const std::string kAttrNameSourceService = "sourceService";
51-
const std::string kAttrNameTargetService = "targetService";
44+
const std::string kAttrNameSourceService = "source.service";
45+
const std::string kAttrNameTargetService = "target.service";
5246

5347
Attributes::Value StringValue(const std::string& str) {
5448
Attributes::Value v;
@@ -106,14 +100,8 @@ void FillRequestHeaderAttributes(const HeaderMap& header_map,
106100
},
107101
attr);
108102

109-
// Pass in all Query parameters.
110-
auto path = header_map.Path();
111-
if (path != nullptr) {
112-
for (const auto& it : Utility::parseQueryString(path->value().c_str())) {
113-
attr->attributes[kRequestParamPrefix + it.first] = StringValue(it.second);
114-
}
115-
}
116-
103+
SetStringAttribute(kAttrNameRequestPath, header_map.Path()->value().c_str(),
104+
attr);
117105
SetStringAttribute(kAttrNameOriginIp, GetFirstForwardedFor(header_map), attr);
118106
SetStringAttribute(kAttrNameOriginHost, GetLastForwardedHost(header_map),
119107
attr);
@@ -167,7 +155,6 @@ void HttpControl::FillCheckAttributes(const HeaderMap& header_map,
167155

168156
SetStringAttribute(kAttrNameSourceService, source_service_, attr);
169157
SetStringAttribute(kAttrNameTargetService, target_service_, attr);
170-
attr->attributes[kAttrNamePeerId] = StringValue(kProxyPeerID);
171158
}
172159

173160
void HttpControl::Check(HttpRequestDataPtr request_data, HeaderMap& headers,

0 commit comments

Comments
 (0)