| 268 | } |
| 269 | |
| 270 | ThriftServer::ThriftServer(const string& name, |
| 271 | const std::shared_ptr<TProcessor>& processor, int port, AuthProvider* auth_provider, |
| 272 | MetricGroup* metrics, int max_concurrent_connections, int64_t queue_timeout_ms, |
| 273 | int64_t idle_poll_period_ms, TransportType transport_type, |
| 274 | bool is_external_facing, string host) |
| 275 | : started_(false), |
| 276 | port_(port), |
| 277 | host_(std::move(host)), |
| 278 | ssl_enabled_(false), |
| 279 | max_concurrent_connections_(max_concurrent_connections), |
| 280 | queue_timeout_ms_(queue_timeout_ms), |
| 281 | idle_poll_period_ms_(idle_poll_period_ms), |
| 282 | name_(name), |
| 283 | metrics_name_(Substitute("impala.thrift-server.$0", name_)), |
| 284 | server_(NULL), |
| 285 | processor_(processor), |
| 286 | connection_handler_(NULL), |
| 287 | metrics_(NULL), |
| 288 | auth_provider_(auth_provider), |
| 289 | transport_type_(transport_type), |
| 290 | is_external_facing_(is_external_facing) { |
| 291 | if (auth_provider_ == NULL) { |
| 292 | auth_provider_ = AuthManager::GetInstance()->GetInternalAuthProvider(); |
| 293 | } |
| 294 | if (metrics != NULL) { |
| 295 | metrics_enabled_ = true; |
| 296 | stringstream count_ss; |
| 297 | count_ss << metrics_name_ << ".connections-in-use"; |
| 298 | num_current_connections_metric_ = metrics->AddGauge(count_ss.str(), 0); |
| 299 | stringstream max_ss; |
| 300 | max_ss << metrics_name_ << ".total-connections"; |
| 301 | total_connections_metric_ = metrics->AddCounter(max_ss.str(), 0); |
| 302 | metrics_ = metrics; |
| 303 | } else { |
| 304 | metrics_enabled_ = false; |
| 305 | } |
| 306 | } |
| 307 | |
| 308 | namespace { |
| 309 |
nothing calls this directly
no test coverage detected