Skip to content

Commit 6e29abc

Browse files
authored
Update to latest mixer_client. (istio#145)
* Update to latest mixer_client. * Updated the sha.
1 parent 9d10adc commit 6e29abc

File tree

2 files changed

+15
-48
lines changed

2 files changed

+15
-48
lines changed

src/envoy/mixer/http_control.cc

Lines changed: 14 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -45,47 +45,10 @@ const std::string kResponseLatency = "response.latency";
4545
const std::string kResponseSize = "response.size";
4646
const std::string kResponseTime = "response.time";
4747

48-
Attributes::Value StringValue(const std::string& str) {
49-
Attributes::Value v;
50-
v.type = Attributes::Value::STRING;
51-
v.str_v = str;
52-
return v;
53-
}
54-
55-
Attributes::Value StringMapValue(
56-
std::map<std::string, std::string>&& string_map) {
57-
Attributes::Value v;
58-
v.type = Attributes::Value::STRING_MAP;
59-
v.string_map_v.swap(string_map);
60-
return v;
61-
}
62-
63-
Attributes::Value Int64Value(int64_t value) {
64-
Attributes::Value v;
65-
v.type = Attributes::Value::INT64;
66-
v.value.int64_v = value;
67-
return v;
68-
}
69-
70-
Attributes::Value TimeValue(
71-
std::chrono::time_point<std::chrono::system_clock> value) {
72-
Attributes::Value v;
73-
v.type = Attributes::Value::TIME;
74-
v.time_v = value;
75-
return v;
76-
}
77-
78-
Attributes::Value DurationValue(std::chrono::nanoseconds value) {
79-
Attributes::Value v;
80-
v.type = Attributes::Value::DURATION;
81-
v.duration_nanos_v = value;
82-
return v;
83-
}
84-
8548
void SetStringAttribute(const std::string& name, const std::string& value,
8649
Attributes* attr) {
8750
if (!value.empty()) {
88-
attr->attributes[name] = StringValue(value);
51+
attr->attributes[name] = Attributes::StringValue(value);
8952
}
9053
}
9154

@@ -105,39 +68,43 @@ void FillRequestHeaderAttributes(const HeaderMap& header_map,
10568
Attributes* attr) {
10669
SetStringAttribute(kRequestPath, header_map.Path()->value().c_str(), attr);
10770
SetStringAttribute(kRequestHost, header_map.Host()->value().c_str(), attr);
108-
attr->attributes[kRequestTime] = TimeValue(std::chrono::system_clock::now());
71+
attr->attributes[kRequestTime] =
72+
Attributes::TimeValue(std::chrono::system_clock::now());
10973
attr->attributes[kRequestHeaders] =
110-
StringMapValue(ExtractHeaders(header_map));
74+
Attributes::StringMapValue(ExtractHeaders(header_map));
11175
}
11276

11377
void FillResponseHeaderAttributes(const HeaderMap* header_map,
11478
Attributes* attr) {
11579
if (header_map) {
11680
attr->attributes[kResponseHeaders] =
117-
StringMapValue(ExtractHeaders(*header_map));
81+
Attributes::StringMapValue(ExtractHeaders(*header_map));
11882
}
119-
attr->attributes[kResponseTime] = TimeValue(std::chrono::system_clock::now());
83+
attr->attributes[kResponseTime] =
84+
Attributes::TimeValue(std::chrono::system_clock::now());
12085
}
12186

12287
void FillRequestInfoAttributes(const AccessLog::RequestInfo& info,
12388
int check_status_code, Attributes* attr) {
12489
if (info.bytesReceived() >= 0) {
125-
attr->attributes[kRequestSize] = Int64Value(info.bytesReceived());
90+
attr->attributes[kRequestSize] =
91+
Attributes::Int64Value(info.bytesReceived());
12692
}
12793
if (info.bytesSent() >= 0) {
128-
attr->attributes[kResponseSize] = Int64Value(info.bytesSent());
94+
attr->attributes[kResponseSize] = Attributes::Int64Value(info.bytesSent());
12995
}
13096

13197
if (info.duration().count() > 0) {
132-
attr->attributes[kResponseLatency] = DurationValue(
98+
attr->attributes[kResponseLatency] = Attributes::DurationValue(
13399
std::chrono::duration_cast<std::chrono::nanoseconds>(info.duration()));
134100
}
135101

136102
if (info.responseCode().valid()) {
137103
attr->attributes[kResponseHttpCode] =
138-
Int64Value(info.responseCode().value());
104+
Attributes::Int64Value(info.responseCode().value());
139105
} else {
140-
attr->attributes[kResponseHttpCode] = Int64Value(check_status_code);
106+
attr->attributes[kResponseHttpCode] =
107+
Attributes::Int64Value(check_status_code);
141108
}
142109
}
143110

src/envoy/mixer/repositories.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
################################################################################
1616
#
1717

18-
MIXER_CLIENT = "5b5745f29ac5a8babe79ada573defaa83f3bb9e7"
18+
MIXER_CLIENT = "456d37e71a7608636ddaf5f3d1acbce015870ebf"
1919

2020
def mixer_client_repositories(bind=True):
2121
native.git_repository(

0 commit comments

Comments
 (0)