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

Revert MixerClient stats #961

Merged
merged 3 commits into from
Jan 30, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 0 additions & 2 deletions src/envoy/mixer/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ envoy_cc_library(
"http_filter.cc",
"mixer_control.cc",
"mixer_control.h",
"stats.cc",
"stats.h",
"tcp_filter.cc",
"utils.cc",
"utils.h",
Expand Down
13 changes: 6 additions & 7 deletions src/envoy/mixer/http_filter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,12 @@ class Config {
tls_(context.threadLocal().allocateSlot()) {
mixer_config_.Load(config);
Runtime::RandomGenerator& random = context.random();
Stats::Scope& scope = context.scope();
tls_->set([this, &random, &scope](Event::Dispatcher& dispatcher)
-> ThreadLocal::ThreadLocalObjectSharedPtr {
return ThreadLocal::ThreadLocalObjectSharedPtr(
new HttpMixerControl(mixer_config_, cm_, dispatcher,
random, scope));
});
tls_->set(
[this, &random](Event::Dispatcher& dispatcher)
-> ThreadLocal::ThreadLocalObjectSharedPtr {
return ThreadLocal::ThreadLocalObjectSharedPtr(
new HttpMixerControl(mixer_config_, cm_, dispatcher, random));
});

std::vector<std::shared_ptr<Auth::IssuerInfo>> issuers;
CreateAuthIssuers(mixer_config_, &issuers);
Expand Down
32 changes: 3 additions & 29 deletions src/envoy/mixer/mixer_control.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,11 @@
#include "src/envoy/mixer/mixer_control.h"
#include "src/envoy/mixer/grpc_transport.h"

using ::istio::mixer_client::Statistics;

namespace Envoy {
namespace Http {
namespace Mixer {
namespace {

const std::string kHttpStatsPrefix("http_mixer_filter.");
const std::string kTcpStatsPrefix("tcp_mixer_filter.");

// A class to wrap envoy timer for mixer client timer.
class EnvoyTimer : public ::istio::mixer_client::Timer {
public:
Expand Down Expand Up @@ -64,19 +59,8 @@ void CreateEnvironment(Upstream::ClusterManager& cm,
HttpMixerControl::HttpMixerControl(const HttpMixerConfig& mixer_config,
Upstream::ClusterManager& cm,
Event::Dispatcher& dispatcher,
Runtime::RandomGenerator& random,
Stats::Scope& scope)
: cm_(cm),
stats_obj_(
dispatcher, kHttpStatsPrefix, scope,
mixer_config.http_config.transport().stats_update_interval_ms(),
[this](Statistics* stat) -> bool {
if (!controller_) {
return false;
}
controller_->GetStatistics(stat);
return true;
}) {
Runtime::RandomGenerator& random)
: cm_(cm) {
::istio::mixer_control::http::Controller::Options options(
mixer_config.http_config, mixer_config.legacy_quotas);

Expand All @@ -90,17 +74,7 @@ HttpMixerControl::HttpMixerControl(const HttpMixerConfig& mixer_config,
TcpMixerControl::TcpMixerControl(const TcpMixerConfig& mixer_config,
Upstream::ClusterManager& cm,
Event::Dispatcher& dispatcher,
Runtime::RandomGenerator& random,
Stats::Scope& scope)
: stats_obj_(dispatcher, kTcpStatsPrefix, scope,
mixer_config.tcp_config.transport().stats_update_interval_ms(),
[this](Statistics* stat) -> bool {
if (!controller_) {
return false;
}
controller_->GetStatistics(stat);
return true;
}) {
Runtime::RandomGenerator& random) {
::istio::mixer_control::tcp::Controller::Options options(
mixer_config.tcp_config);

Expand Down
9 changes: 2 additions & 7 deletions src/envoy/mixer/mixer_control.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#include "envoy/thread_local/thread_local.h"
#include "envoy/upstream/cluster_manager.h"
#include "src/envoy/mixer/config.h"
#include "src/envoy/mixer/stats.h"

namespace Envoy {
namespace Http {
Expand All @@ -33,7 +32,7 @@ class HttpMixerControl final : public ThreadLocal::ThreadLocalObject {
// The constructor.
HttpMixerControl(const HttpMixerConfig& mixer_config,
Upstream::ClusterManager& cm, Event::Dispatcher& dispatcher,
Runtime::RandomGenerator& random, Stats::Scope& scope);
Runtime::RandomGenerator& random);

Upstream::ClusterManager& cm() { return cm_; }

Expand All @@ -50,16 +49,14 @@ class HttpMixerControl final : public ThreadLocal::ThreadLocalObject {
std::unique_ptr<::istio::mixer_control::http::Controller> controller_;
// has v2 config;
bool has_v2_config_;

MixerStatsObject stats_obj_;
};

class TcpMixerControl final : public ThreadLocal::ThreadLocalObject {
public:
// The constructor.
TcpMixerControl(const TcpMixerConfig& mixer_config,
Upstream::ClusterManager& cm, Event::Dispatcher& dispatcher,
Runtime::RandomGenerator& random, Stats::Scope& scope);
Runtime::RandomGenerator& random);

::istio::mixer_control::tcp::Controller* controller() {
return controller_.get();
Expand All @@ -68,8 +65,6 @@ class TcpMixerControl final : public ThreadLocal::ThreadLocalObject {
private:
// The mixer control
std::unique_ptr<::istio::mixer_control::tcp::Controller> controller_;

MixerStatsObject stats_obj_;
};

} // namespace Mixer
Expand Down
103 changes: 0 additions & 103 deletions src/envoy/mixer/stats.cc

This file was deleted.

87 changes: 0 additions & 87 deletions src/envoy/mixer/stats.h

This file was deleted.

13 changes: 6 additions & 7 deletions src/envoy/mixer/tcp_filter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,12 @@ class TcpConfig : public Logger::Loggable<Logger::Id::filter> {
tls_(context.threadLocal().allocateSlot()) {
mixer_config_.Load(config);
Runtime::RandomGenerator& random = context.random();
Stats::Scope& scope = context.scope();
tls_->set([this, &random, &scope](Event::Dispatcher& dispatcher)
-> ThreadLocal::ThreadLocalObjectSharedPtr {
return ThreadLocal::ThreadLocalObjectSharedPtr(
new TcpMixerControl(mixer_config_, cm_, dispatcher,
random, scope));
});
tls_->set(
[this, &random](Event::Dispatcher& dispatcher)
-> ThreadLocal::ThreadLocalObjectSharedPtr {
return ThreadLocal::ThreadLocalObjectSharedPtr(
new TcpMixerControl(mixer_config_, cm_, dispatcher, random));
});
}

TcpMixerControl& mixer_control() { return tls_->getTyped<TcpMixerControl>(); }
Expand Down