OmniSciDB  0fdbebe030
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
MapDTrackingProcessor Class Reference

#include <MapDHandler.h>

+ Inheritance diagram for MapDTrackingProcessor:
+ Collaboration diagram for MapDTrackingProcessor:

Public Member Functions

 MapDTrackingProcessor (mapd::shared_ptr< MapDIf > handler)
 
bool process (mapd::shared_ptr<::apache::thrift::protocol::TProtocol > in, mapd::shared_ptr<::apache::thrift::protocol::TProtocol > out, void *connectionContext)
 

Static Public Attributes

static thread_local std::string client_address
 
static thread_local ClientProtocol client_protocol
 

Detailed Description

Definition at line 117 of file MapDHandler.h.

Constructor & Destructor Documentation

MapDTrackingProcessor::MapDTrackingProcessor ( mapd::shared_ptr< MapDIf >  handler)
inline

Definition at line 119 of file MapDHandler.h.

119 : MapDProcessor(handler) {}

Member Function Documentation

bool MapDTrackingProcessor::process ( mapd::shared_ptr<::apache::thrift::protocol::TProtocol >  in,
mapd::shared_ptr<::apache::thrift::protocol::TProtocol >  out,
void *  connectionContext 
)
inline

Definition at line 121 of file MapDHandler.h.

References client_address, client_protocol, HTTP, Other, split(), and TCP.

123  {
124  using namespace ::apache::thrift;
125 
126  auto transport = in->getTransport();
127  if (transport) {
128  static std::mutex processor_mutex;
129  std::lock_guard lock(processor_mutex);
130  const auto origin_str = transport->getOrigin();
131  std::vector<std::string> origins;
132  boost::split(origins, origin_str, boost::is_any_of(","));
133  if (origins.empty()) {
135  } else {
136  // Take the first origin, which should be the client IP before any intermediate
137  // servers (e.g. the web server)
138  auto trimmed_origin = origins.front();
139  boost::algorithm::trim(trimmed_origin);
140  MapDTrackingProcessor::client_address = trimmed_origin;
141  }
142  if (dynamic_cast<transport::THttpTransport*>(transport.get())) {
144  } else if (dynamic_cast<transport::TBufferedTransport*>(transport.get())) {
146  } else {
148  }
149  } else {
151  }
152 
153  return MapDProcessor::process(in, out, connectionContext);
154  }
static thread_local std::string client_address
Definition: MapDHandler.h:156
std::vector< std::string > split(std::string_view str, std::string_view delim, std::optional< size_t > maxsplit)
split apart a string into a vector of substrings
const int8_t const int64_t const uint64_t const int32_t const int64_t int64_t ** out
static thread_local ClientProtocol client_protocol
Definition: MapDHandler.h:157

+ Here is the call graph for this function:

Member Data Documentation

thread_local std::string MapDTrackingProcessor::client_address
static

Definition at line 156 of file MapDHandler.h.

Referenced by MapDHandler::getConnectionInfo(), and process().

thread_local ClientProtocol MapDTrackingProcessor::client_protocol
static

Definition at line 157 of file MapDHandler.h.

Referenced by MapDHandler::getConnectionInfo(), and process().


The documentation for this class was generated from the following files: