Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge from master to firebase #159

Merged
merged 56 commits into from
Mar 13, 2017
Merged
Show file tree
Hide file tree
Changes from 55 commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
78b931b
Simple TCP server to show how to retrieve original dest IP:port after…
enricoschiattarella Jan 10, 2017
8b3a442
Rebase Envoy (#41)
kyessenov Jan 12, 2017
c3abd2a
Update prototype to use iptables (#42)
kyessenov Jan 12, 2017
add363a
Rebase to fixed Envoy (#43)
kyessenov Jan 13, 2017
ee3cdee
Handle HEAD request. (#34)
chowchow316 Jan 13, 2017
efc32a2
Expose bazel target (#48)
kyessenov Jan 21, 2017
92541b7
Try again (#49)
kyessenov Jan 21, 2017
cea8827
Integrate with mixer client. (#55)
qiwzhang Jan 27, 2017
6d7f0ee
Add originIp and originHost attributes. (#56)
qiwzhang Jan 27, 2017
4cd5c9f
Add uuid-dev dependency in README.md (#45)
lizan Jan 28, 2017
bcdb75d
Extract originIp and OriginHost. (#57)
qiwzhang Jan 28, 2017
2c9c1af
Update buckets for UI. (#58)
chowchow316 Jan 30, 2017
2796209
Add targetService attribute. (#59)
qiwzhang Feb 1, 2017
8218f92
Use envoy new access_log handler for sending Report. (#60)
qiwzhang Feb 1, 2017
1d2d6a8
Update to the latest envoy with #396. (#61)
qiwzhang Feb 2, 2017
53fd026
Fix tclap dependency fetching error (#62)
kyessenov Feb 2, 2017
33f54ed
Integrate mixer client directly with envoy. (#66)
qiwzhang Feb 6, 2017
eb8bfcc
Add release binary script. (#68)
qiwzhang Feb 6, 2017
89f0fbf
Push tar.gz to GCS (#69)
kyessenov Feb 6, 2017
7635536
Remove mixer_client from api_manager. (#72)
qiwzhang Feb 8, 2017
a6a33fd
Update mixer client SHA. (#74)
chowchow316 Feb 8, 2017
d29a195
Update readme. (#73)
chowchow316 Feb 8, 2017
fdac61b
Adds Jenkinsfile and updates release-binary to create a SHA. (#71)
sebastienvas Feb 9, 2017
6e372fc
Update grpc and protobuf (#70)
lizan Feb 9, 2017
28105ca
Add sourceService. (#78)
qiwzhang Feb 9, 2017
21f1cb3
Add script to build docker image. (#77)
qiwzhang Feb 9, 2017
673b902
Use official attribute names (#80)
qiwzhang Feb 10, 2017
366f5ae
Creates a KEY for mixer client dep. Updates release-binary (#79)
sebastienvas Feb 10, 2017
a39d555
Update src/envoy/mixer/README. (#82)
qiwzhang Feb 10, 2017
88cfb24
Fix src/envoy/mixer/README.md (#85)
wattli Feb 10, 2017
d5a878a
Get attributes from envoy config. (#87)
chowchow316 Feb 14, 2017
25adae9
updated SHA to point to newer envoy with RDS API feature (#94)
GregHanson Feb 14, 2017
1cdc2ac
Disable travis on stable branches (#96)
sebastienvas Feb 15, 2017
2f69cc9
Publish debug binaries (no release yet) (#98)
kyessenov Feb 15, 2017
8488133
Copies the binary instead of linking for release (#102)
sebastienvas Feb 16, 2017
0804a07
Not to use api_key if its service is not actived. (#109)
qiwzhang Feb 21, 2017
7444da1
Update envoy and add c-ares (#107)
kyessenov Feb 22, 2017
d093254
Send StatusCode Attributes to Mixer. (#110)
chowchow316 Feb 22, 2017
ef1aecf
Add send_attribute filter. (#115)
qiwzhang Feb 22, 2017
20e19d2
Fail request if api_key is not valid. (#116)
chowchow316 Feb 22, 2017
7fe10df
Rename response.http.code (#125)
qiwzhang Feb 24, 2017
fdfb73f
Send headers as string map. (#129)
qiwzhang Feb 25, 2017
3d402e6
unify bazel's docker build targets with other istio repos (#127)
ayj Feb 25, 2017
d71d5f3
update base debug docker image reference (#133)
ayj Feb 28, 2017
f5281ad
Update postsubmit to create docker images (#132)
sebastienvas Feb 28, 2017
0c7c549
Adding config release for bazel build (#135)
sebastienvas Mar 1, 2017
fc9497a
Fix mixer client crash. (#136)
qiwzhang Mar 1, 2017
83e1d58
Get mixerclient with response parsing. (#138)
qiwzhang Mar 2, 2017
a118aea
Update nghttp2 to sync with envoy (#140)
wattli Mar 2, 2017
9d10adc
Populate origin.user attribute from the SAN field of client cert (#142)
wattli Mar 2, 2017
6e29abc
Update to latest mixer_client. (#145)
qiwzhang Mar 3, 2017
a5567b9
Not call report if decodeHeaders is not called. (#150)
qiwzhang Mar 7, 2017
c0c317d
Update mixerclient with sync-ed grpc write and fail-fast. (#155)
qiwzhang Mar 9, 2017
25f43e3
Update envoy to PR553 (#156)
qiwzhang Mar 10, 2017
62b4bdc
Merge branch 'master' of https://github.com/istio/proxy into merge
sarvaniv Mar 13, 2017
168ee21
Update the Commit id for envoy
sarvaniv Mar 13, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 22 additions & 52 deletions src/envoy/mixer/http_control.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,59 +31,24 @@ namespace Mixer {
namespace {

// Define attribute names
const std::string kRequestPath = "request.path";
const std::string kOriginUser = "origin.user";

const std::string kRequestHeaders = "request.headers";
const std::string kRequestHost = "request.host";
const std::string kRequestPath = "request.path";
const std::string kRequestSize = "request.size";
const std::string kRequestTime = "request.time";
const std::string kRequestHeaders = "request.headers";

const std::string kResponseHeaders = "response.headers";
const std::string kResponseHttpCode = "response.http.code";
const std::string kResponseLatency = "response.latency";
const std::string kResponseSize = "response.size";
const std::string kResponseTime = "response.time";
const std::string kResponseLatency = "response.latency";
const std::string kResponseHttpCode = "response.http.code";

Attributes::Value StringValue(const std::string& str) {
Attributes::Value v;
v.type = Attributes::Value::STRING;
v.str_v = str;
return v;
}

Attributes::Value StringMapValue(
std::map<std::string, std::string>&& string_map) {
Attributes::Value v;
v.type = Attributes::Value::STRING_MAP;
v.string_map_v.swap(string_map);
return v;
}

Attributes::Value Int64Value(int64_t value) {
Attributes::Value v;
v.type = Attributes::Value::INT64;
v.value.int64_v = value;
return v;
}

Attributes::Value TimeValue(
std::chrono::time_point<std::chrono::system_clock> value) {
Attributes::Value v;
v.type = Attributes::Value::TIME;
v.time_v = value;
return v;
}

Attributes::Value DurationValue(std::chrono::nanoseconds value) {
Attributes::Value v;
v.type = Attributes::Value::DURATION;
v.duration_nanos_v = value;
return v;
}

void SetStringAttribute(const std::string& name, const std::string& value,
Attributes* attr) {
if (!value.empty()) {
attr->attributes[name] = StringValue(value);
attr->attributes[name] = Attributes::StringValue(value);
}
}

Expand All @@ -103,39 +68,43 @@ void FillRequestHeaderAttributes(const HeaderMap& header_map,
Attributes* attr) {
SetStringAttribute(kRequestPath, header_map.Path()->value().c_str(), attr);
SetStringAttribute(kRequestHost, header_map.Host()->value().c_str(), attr);
attr->attributes[kRequestTime] = TimeValue(std::chrono::system_clock::now());
attr->attributes[kRequestTime] =
Attributes::TimeValue(std::chrono::system_clock::now());
attr->attributes[kRequestHeaders] =
StringMapValue(ExtractHeaders(header_map));
Attributes::StringMapValue(ExtractHeaders(header_map));
}

void FillResponseHeaderAttributes(const HeaderMap* header_map,
Attributes* attr) {
if (header_map) {
attr->attributes[kResponseHeaders] =
StringMapValue(ExtractHeaders(*header_map));
Attributes::StringMapValue(ExtractHeaders(*header_map));
}
attr->attributes[kResponseTime] = TimeValue(std::chrono::system_clock::now());
attr->attributes[kResponseTime] =
Attributes::TimeValue(std::chrono::system_clock::now());
}

void FillRequestInfoAttributes(const AccessLog::RequestInfo& info,
int check_status_code, Attributes* attr) {
if (info.bytesReceived() >= 0) {
attr->attributes[kRequestSize] = Int64Value(info.bytesReceived());
attr->attributes[kRequestSize] =
Attributes::Int64Value(info.bytesReceived());
}
if (info.bytesSent() >= 0) {
attr->attributes[kResponseSize] = Int64Value(info.bytesSent());
attr->attributes[kResponseSize] = Attributes::Int64Value(info.bytesSent());
}

if (info.duration().count() > 0) {
attr->attributes[kResponseLatency] = DurationValue(
attr->attributes[kResponseLatency] = Attributes::DurationValue(
std::chrono::duration_cast<std::chrono::nanoseconds>(info.duration()));
}

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

Expand Down Expand Up @@ -170,8 +139,9 @@ void HttpControl::FillCheckAttributes(HeaderMap& header_map, Attributes* attr) {
}

void HttpControl::Check(HttpRequestDataPtr request_data, HeaderMap& headers,
DoneFunc on_done) {
std::string origin_user, DoneFunc on_done) {
FillCheckAttributes(headers, &request_data->attributes);
SetStringAttribute(kOriginUser, origin_user, &request_data->attributes);
log().debug("Send Check: {}", request_data->attributes.DebugString());
mixer_client_->Check(request_data->attributes, on_done);
}
Expand Down
2 changes: 1 addition & 1 deletion src/envoy/mixer/http_control.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class HttpControl final : public Logger::Loggable<Logger::Id::http> {

// Make mixer check call.
void Check(HttpRequestDataPtr request_data, HeaderMap& headers,
::istio::mixer_client::DoneFunc on_done);
std::string origin_user, ::istio::mixer_client::DoneFunc on_done);

// Make mixer report call.
void Report(HttpRequestDataPtr request_data,
Expand Down
14 changes: 13 additions & 1 deletion src/envoy/mixer/http_filter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "common/http/headers.h"
#include "common/http/utility.h"
#include "envoy/server/instance.h"
#include "envoy/ssl/connection.h"
#include "server/config/network/http_connection_manager.h"
#include "src/envoy/mixer/http_control.h"
#include "src/envoy/mixer/utils.h"
Expand Down Expand Up @@ -151,8 +152,16 @@ class Instance : public Http::StreamFilter, public Http::AccessLog::Instance {
state_ = Calling;
initiating_call_ = true;
request_data_ = std::make_shared<HttpRequestData>();

std::string origin_user;
Ssl::Connection* ssl =
const_cast<Ssl::Connection*>(decoder_callbacks_->ssl());
if (ssl != nullptr) {
origin_user = ssl->uriSanPeerCertificate();
}

http_control_->Check(
request_data_, headers,
request_data_, headers, origin_user,
wrapper([this](const Status& status) { completeCheck(status); }));
initiating_call_ = false;

Expand Down Expand Up @@ -180,6 +189,7 @@ class Instance : public Http::StreamFilter, public Http::AccessLog::Instance {
}
return FilterTrailersStatus::Continue;
}

void setDecoderFilterCallbacks(
StreamDecoderFilterCallbacks& callbacks) override {
Log().debug("Called Mixer::Instance : {}", __func__);
Expand Down Expand Up @@ -227,6 +237,8 @@ class Instance : public Http::StreamFilter, public Http::AccessLog::Instance {
const HeaderMap* response_headers,
const AccessLog::RequestInfo& request_info) override {
Log().debug("Called Mixer::Instance : {}", __func__);
// If decodeHaeders() is not called, not to call Mixer report.
if (!request_data_) return;
// Make sure not to use any class members at the callback.
// The class may be gone when it is called.
// Log() is a static function so it is OK.
Expand Down
2 changes: 1 addition & 1 deletion src/envoy/mixer/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
################################################################################
#

MIXER_CLIENT = "5b5745f29ac5a8babe79ada573defaa83f3bb9e7"
MIXER_CLIENT = "92a305961bcea90ed349ffdbb0ea299c6f6bacad"

def mixer_client_repositories(bind=True):
native.git_repository(
Expand Down
9 changes: 4 additions & 5 deletions src/envoy/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ event_srcs = [
"evthread.c",
"evutil.c",
"evutil_rand.c",
"evutil_time.c",
"http.c",
"listener.c",
"log.c",
Expand All @@ -86,9 +87,7 @@ cc_library(
"defer-internal.h",
"evbuffer-internal.h",
"event-internal.h",
"event.h",
"evthread-internal.h",
"evutil.h",
"http-internal.h",
"iocp-internal.h",
"ipv6-internal.h",
Expand Down Expand Up @@ -134,8 +133,8 @@ cc_library(

native.new_http_archive(
name = "libevent_git",
url = "https://github.com/libevent/libevent/releases/download/release-2.0.22-stable/libevent-2.0.22-stable.tar.gz",
strip_prefix = "libevent-2.0.22-stable",
url = "https://github.com/libevent/libevent/releases/download/release-2.1.8-stable/libevent-2.1.8-stable.tar.gz",
strip_prefix = "libevent-2.1.8-stable",
build_file_content = BUILD,
)

Expand Down Expand Up @@ -752,6 +751,6 @@ cc_test(
native.new_git_repository(
name = "envoy_git",
remote = "https://github.com/lyft/envoy.git",
commit = "70e5d651b55d356770529e5bee9c6b2707d9cf21", # 3/1/2017
commit = "9679c08a21988a8e95a4e9b2ba65712ec25eadc1", # https://github.com/lyft/envoy/pull/553
build_file_content = BUILD,
)