Commit 4cbd20fb by Amir Aharon

end of day.. just starting

parent fb101b93
...@@ -51,4 +51,4 @@ GTAGS ...@@ -51,4 +51,4 @@ GTAGS
GSYMS GSYMS
GRTAGS GRTAGS
typescript typescript
.project
...@@ -29,18 +29,18 @@ ...@@ -29,18 +29,18 @@
{ {
"name": "Linux", "name": "Linux",
"includePath": [ "includePath": [
"/usr/include/c++/4.9", "/usr/include/c++/7.4.0",
"/usr/include/x86_64-linux-gnu/c++/4.9", "/usr/include/x86_64-linux-gnu/c++/7.4.0",
"/usr/include/c++/4.9/backward", "/usr/include/c++/7.4.0/backward",
"/usr/lib/gcc/x86_64-linux-gnu/4.9/include", "/usr/lib/gcc/x86_64-linux-gnu/7.4.0/include",
"/usr/local/include", "/usr/local/include",
"/usr/lib/gcc/x86_64-linux-gnu/4.9/include-fixed", "/usr/lib/gcc/x86_64-linux-gnu/7.4.0/include-fixed",
"/usr/include/x86_64-linux-gnu", "/usr/include/x86_64-linux-gnu",
"/usr/include", "/usr/include",
"${workspaceRoot}/../3party", "${workspaceRoot}/../3party",
"${workspaceRoot}/src", "${workspaceRoot}/src",
"/usr/include/c++/5", "/usr/include/c++/7.4.0",
"/usr/include/x86_64-linux-gnu/c++/5", "/usr/include/x86_64-linux-gnu/c++/7.4.0",
"${workspaceRoot}/../3party/cereal/include" "${workspaceRoot}/../3party/cereal/include"
], ],
"compileCommands": "./compile_commands.json", "compileCommands": "./compile_commands.json",
...@@ -48,17 +48,17 @@ ...@@ -48,17 +48,17 @@
"intelliSenseMode": "clang-x64", "intelliSenseMode": "clang-x64",
"browse": { "browse": {
"path": [ "path": [
"/usr/include/c++/4.9", "/usr/include/c++/7.4.0",
"/usr/include/x86_64-linux-gnu/c++/4.9", "/usr/include/x86_64-linux-gnu/c++/7.4.0",
"/usr/include/c++/4.9/backward", "/usr/include/c++/7.4.0/backward",
"/usr/lib/gcc/x86_64-linux-gnu/4.9/include", "/usr/lib/gcc/x86_64-linux-gnu/7.4.0/include",
"/usr/local/include", "/usr/local/include",
"/usr/lib/gcc/x86_64-linux-gnu/4.9/include-fixed", "/usr/lib/gcc/x86_64-linux-gnu/7.4.0/include-fixed",
"/usr/include/x86_64-linux-gnu", "/usr/include/x86_64-linux-gnu",
"/usr/include", "/usr/include",
"${workspaceRoot}/../3party", "${workspaceRoot}/../3party",
"${workspaceRoot}/src", "${workspaceRoot}/src",
"/usr/include/c++/5" "/usr/include/c++/7.4.0"
], ],
"limitSymbolsToIncludedHeaders": true, "limitSymbolsToIncludedHeaders": true,
"databaseFilename": "" "databaseFilename": ""
......
...@@ -10,7 +10,7 @@ set(Microservice_VERSION_STRING ${Microservice_VERSION_MAJOR}.${Microservice_VER ...@@ -10,7 +10,7 @@ set(Microservice_VERSION_STRING ${Microservice_VERSION_MAJOR}.${Microservice_VER
#set(CMAKE_BUILD_TYPE Release) #set(CMAKE_BUILD_TYPE Release)
set(BUILD_DIR build) set(BUILD_DIR build)
set(CMAKE_BUILD_TYPE Debug) set(CMAKE_BUILD_TYPE Debug)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -m64 -g") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -m64 -g")
set(CMAKE_CXX_FLAGS_DEBUG "-O0") set(CMAKE_CXX_FLAGS_DEBUG "-O0")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${BUILD_DIR}/lib) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${BUILD_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${BUILD_DIR}/bin) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${BUILD_DIR}/bin)
...@@ -41,6 +41,7 @@ include_directories(SYSTEM ../3party/rabbitmq) ...@@ -41,6 +41,7 @@ include_directories(SYSTEM ../3party/rabbitmq)
include_directories(SYSTEM ../3party/flatbuffers/include) include_directories(SYSTEM ../3party/flatbuffers/include)
include_directories(SYSTEM ../3party/poco-1.7.8/Foundation/include) include_directories(SYSTEM ../3party/poco-1.7.8/Foundation/include)
include_directories(SYSTEM ../3party/evpp/build-release/include) include_directories(SYSTEM ../3party/evpp/build-release/include)
include_directories(SYSTEM ../3party/spdlog/include/spdlog)
# include_directories(SYSTEM ../internals/include/Rabbitmq) # include_directories(SYSTEM ../internals/include/Rabbitmq)
include_directories(SYSTEM /usr/include/Poco) include_directories(SYSTEM /usr/include/Poco)
include_directories(SYSTEM /usr/include/hiredis) include_directories(SYSTEM /usr/include/hiredis)
......
#FROM ubuntu:14.04 #FROM ubuntu:14.04
#FROM ubuntu-debootstrap:14.04 #FROM ubuntu-debootstrap:14.04
FROM municipalitybank.com:5050/mcx/devops/dev-cpp FROM municipalitybank.com:5050/mcx/devops/dev-cpp:gcc7
USER root USER root
COPY ./doc/install-dependencies.sh /usr/ COPY ./doc/install-dependencies.sh /usr/
......
...@@ -5,5 +5,8 @@ ...@@ -5,5 +5,8 @@
# #
# Created on May 8, 2016, 9:59:18 AM # Created on May 8, 2016, 9:59:18 AM
# #
sudo apt-get install -y libhiredis0.10 libhiredis-dev libzmq3 libzmq3-dev liblog4cpp5 liblog4cpp5-dev \ # apt-get install -y libhiredis0.13 libhiredis-dev libzmq5 libzmq3-dev liblog4cpp5v5 liblog4cpp5-dev \
# libgoogle-glog-dev libboost-all-dev libssl-dev uuid-dev libzmqpp-dev libmhash-dev libevent-dev
apt-get install -y libhiredis-dev libzmq3-dev liblog4cpp5-dev \
libgoogle-glog-dev libboost-all-dev libssl-dev uuid-dev libzmqpp-dev libmhash-dev libevent-dev libgoogle-glog-dev libboost-all-dev libssl-dev uuid-dev libzmqpp-dev libmhash-dev libevent-dev
\ No newline at end of file
...@@ -114,7 +114,7 @@ void MSIMetricsFactoryDropwisardImpl::GetMetrics(std::map<std::string, long>& me ...@@ -114,7 +114,7 @@ void MSIMetricsFactoryDropwisardImpl::GetMetrics(std::map<std::string, long>& me
for (auto meter : registry_->getMeters()) for (auto meter : registry_->getMeters())
{ {
register auto meter_ptr = meter.second; auto meter_ptr = meter.second;
str.assign("meter." + meter.first); str.assign("meter." + meter.first);
metrics_map[str + ".count"] = meter_ptr->getCount(); metrics_map[str + ".count"] = meter_ptr->getCount();
metrics_map[str + ".mean_rate"] = meter_ptr->getMeanRate(); metrics_map[str + ".mean_rate"] = meter_ptr->getMeanRate();
...@@ -125,7 +125,7 @@ void MSIMetricsFactoryDropwisardImpl::GetMetrics(std::map<std::string, long>& me ...@@ -125,7 +125,7 @@ void MSIMetricsFactoryDropwisardImpl::GetMetrics(std::map<std::string, long>& me
for (auto timer : registry_->getTimers()) for (auto timer : registry_->getTimers())
{ {
register auto timer_snapshot_ptr = timer.second->getSnapshot(); auto timer_snapshot_ptr = timer.second->getSnapshot();
str.assign("timer." + timer.first); str.assign("timer." + timer.first);
metrics_map[str + ".mean_rate(ms)"] = timer_snapshot_ptr->getMean() / NANOS_IN_MILLI; metrics_map[str + ".mean_rate(ms)"] = timer_snapshot_ptr->getMean() / NANOS_IN_MILLI;
metrics_map[str + ".min(ms)"] = timer_snapshot_ptr->getMin() / NANOS_IN_MILLI; metrics_map[str + ".min(ms)"] = timer_snapshot_ptr->getMin() / NANOS_IN_MILLI;
...@@ -136,7 +136,7 @@ void MSIMetricsFactoryDropwisardImpl::GetMetrics(std::map<std::string, long>& me ...@@ -136,7 +136,7 @@ void MSIMetricsFactoryDropwisardImpl::GetMetrics(std::map<std::string, long>& me
for (auto histogram : registry_->getHistograms()) for (auto histogram : registry_->getHistograms())
{ {
register auto histogram_snapshot_ptr = histogram.second->getSnapshot(); auto histogram_snapshot_ptr = histogram.second->getSnapshot();
str.assign("histogram." + histogram.first); str.assign("histogram." + histogram.first);
metrics_map[str + ".mean_rate"] = histogram_snapshot_ptr->getMean(); metrics_map[str + ".mean_rate"] = histogram_snapshot_ptr->getMean();
metrics_map[str + ".min"] = histogram_snapshot_ptr->getMin(); metrics_map[str + ".min"] = histogram_snapshot_ptr->getMin();
......
...@@ -152,7 +152,7 @@ bool cMicroservice_ICacheClientRedisImpl::getKeysByPattern(std::string& pattern, ...@@ -152,7 +152,7 @@ bool cMicroservice_ICacheClientRedisImpl::getKeysByPattern(std::string& pattern,
{ {
if (pt_redisReply->type == REDIS_REPLY_ARRAY) if (pt_redisReply->type == REDIS_REPLY_ARRAY)
{ {
register redisReply **pt_replyElement = pt_redisReply->element; redisReply **pt_replyElement = pt_redisReply->element;
for (int i = 0; i < pt_redisReply->elements; i++,pt_replyElement++) for (int i = 0; i < pt_redisReply->elements; i++,pt_replyElement++)
{ {
retKeys.push_back((*pt_replyElement)->str); retKeys.push_back((*pt_replyElement)->str);
......
#include "Microservice_ILoggerSpdlogImpl.h"
#include "spdlog/sinks/stdout_color_sinks.h"
#define MAKE_MESSAGE {int len; va_list ap; va_start( ap , stringFormat );\
len = ( vsnprintf(ba_LogBuffer, nsMicroservice_Constants::MAX_LOGEER_BUFF_LENGTH, stringFormat, ap ) ); va_end(ap);}
Microservice_ILoggerSpdlogImpl::Microservice_ILoggerSpdlogImpl(){
mpc_Logger = spdlog::stdout_color_mt("console");
spdlog::flush_every(std::chrono::seconds(3));
}
Microservice_ILoggerSpdlogImpl::Microservice_ILoggerSpdlogImpl(const char* name){
mpc_Logger = spdlog::stdout_color_mt(name);
spdlog::flush_every(std::chrono::seconds(3));
}
Microservice_ILoggerSpdlogImpl::Microservice_ILoggerSpdlogImpl(const Microservice_ILoggerSpdlogImpl& orig){
}
Microservice_ILoggerSpdlogImpl::~Microservice_ILoggerSpdlogImpl(){
}
void Microservice_ILoggerSpdlogImpl::setLevel(cMicroservice_Enums::eLogLevel level){
switch (level)
{
case cMicroservice_Enums::eLogLevel::eDebug:
mpc_Logger->set_level(spdlog::level::debug);
break;
case cMicroservice_Enums::eLogLevel::eError:
mpc_Logger->set_level(spdlog::level::err);
break;
case cMicroservice_Enums::eLogLevel::eFatal:
mpc_Logger->set_level(spdlog::level::critical);
break;
case cMicroservice_Enums::eLogLevel::eInfo:
mpc_Logger->set_level(spdlog::level::info);
break;
case cMicroservice_Enums::eLogLevel::eTrace:
mpc_Logger->set_level(spdlog::level::trace);
break;
case cMicroservice_Enums::eLogLevel::eWarning:
mpc_Logger->set_level(spdlog::level::warn);
break;
}
}
cMicroservice_Enums::eLogLevel Microservice_ILoggerSpdlogImpl::getLevel(){
switch (mpc_Logger->level())
{
case spdlog::level::debug:
return cMicroservice_Enums::eLogLevel::eDebug;
case spdlog::level::err:
return cMicroservice_Enums::eLogLevel::eError;
case spdlog::level::critical:
return cMicroservice_Enums::eLogLevel::eFatal;
case spdlog::level::info:
return cMicroservice_Enums::eLogLevel::eInfo;
case spdlog::level::trace:
return cMicroservice_Enums::eLogLevel::eTrace;
case spdlog::level::warn:
return cMicroservice_Enums::eLogLevel::eWarning;
default:
return cMicroservice_Enums::eLogLevel::eError;
}
}
void Microservice_ILoggerSpdlogImpl::info(const char* stringFormat, ... ) {
MAKE_MESSAGE;
mpc_Logger->info(ba_LogBuffer);
}
void Microservice_ILoggerSpdlogImpl::debug(const char* stringFormat, ...) {
MAKE_MESSAGE;
mpc_Logger->debug(ba_LogBuffer);
}
void Microservice_ILoggerSpdlogImpl::error(const char* stringFormat, ...) {
MAKE_MESSAGE;
mpc_Logger->error(ba_LogBuffer);
}
void Microservice_ILoggerSpdlogImpl::fatal(const char* stringFormat, ...) {
MAKE_MESSAGE;
mpc_Logger->critical(ba_LogBuffer);
}
void Microservice_ILoggerSpdlogImpl::trace(const char* stringFormat, ...) {
MAKE_MESSAGE;
mpc_Logger->trace(ba_LogBuffer);
}
void Microservice_ILoggerSpdlogImpl::warning(const char* stringFormat, ...) {
MAKE_MESSAGE;
mpc_Logger->warn(ba_LogBuffer);
}
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/*
* File: Microservices_ILoggerLog4cppImpl.h
* Author: amir
* apt-get install liblog4cpp5-dev
*
* Created on May 1, 2016, 5:01 PM
*/
// #if __cplusplus < 201703L // Standards below C++2017
// void fn() throw (int) { }
// #endif // __cplusplus
#ifndef MICROSERVICES_ILOGGERSPDLOGIMPL_H
#define MICROSERVICES_ILOGGERSPDLOGIMPL_H
#include "common/Microservice_Iface.h"
#include "spdlog/spdlog.h"
#include "spdlog/sinks/stdout_color_sinks.h"
class Microservice_ILoggerSpdlogImpl: public nsMicroservice_Iface::ILogger
{
private:
std::shared_ptr<logger> mpc_Logger;
public:
Microservice_ILoggerSpdlogImpl();
void initLogger(const char* name);
void initDefaultLogger(const char* name);
Microservice_ILoggerSpdlogImpl(const char* name);
Microservice_ILoggerSpdlogImpl(const Microservice_ILoggerSpdlogImpl& orig);
virtual ~Microservice_ILoggerSpdlogImpl();
virtual void fatal(const std::string& msg){
mpc_Logger->critical(msg);
}
virtual void error(const std::string& msg){
mpc_Logger->error(msg);
}
virtual void warning(const std::string& msg){
mpc_Logger->warn(msg);
}
virtual void info(const std::string& msg){
mpc_Logger->info(msg);
}
virtual void debug(const std::string& msg){
mpc_Logger->debug(msg);
}
virtual void trace(const std::string& msg){
mpc_Logger->trace(msg);
}
virtual void fatal(const char* stringFormat, ...);
virtual void error(const char* stringFormat, ...);
virtual void warning(const char* stringFormat, ...);
virtual void info(const char* stringFormat, ...);
virtual void debug(const char* stringFormat, ...);
virtual void trace(const char* stringFormat, ...);
virtual void setLevel(cMicroservice_Enums::eLogLevel level);
virtual cMicroservice_Enums::eLogLevel getLevel() override;
};
#endif /* MICROSERVICES_ILOGGERSPDLOGIMPL_H */
...@@ -47,7 +47,7 @@ const char* cMicroservice_IRequestRestImpl::GetContent() ...@@ -47,7 +47,7 @@ const char* cMicroservice_IRequestRestImpl::GetContent()
{ {
if (p_reqInfo_) if (p_reqInfo_)
{ {
register auto len = p_reqInfo_->content_length; auto len = p_reqInfo_->content_length;
if(len > 0) if(len > 0)
{ {
mba_BodyBuffer = (char*)realloc(mba_BodyBuffer,len + 1); mba_BodyBuffer = (char*)realloc(mba_BodyBuffer,len + 1);
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
* Created on May 1, 2016, 5:01 PM * Created on May 1, 2016, 5:01 PM
*/ */
#include <stdlib.h> #include <stdlib.h>
#include "Microservices_ILoggerLog4cppImpl.h" #include "Microservices_ILoggerLog4cppImpl.h"
......
...@@ -11,6 +11,9 @@ ...@@ -11,6 +11,9 @@
* *
* Created on May 1, 2016, 5:01 PM * Created on May 1, 2016, 5:01 PM
*/ */
// #if __cplusplus < 201703L // Standards below C++2017
// void fn() throw (int) { }
// #endif // __cplusplus
#ifndef MICROSERVICES_ILOGGERLOG4CPPIMPL_H #ifndef MICROSERVICES_ILOGGERLOG4CPPIMPL_H
#define MICROSERVICES_ILOGGERLOG4CPPIMPL_H #define MICROSERVICES_ILOGGERLOG4CPPIMPL_H
...@@ -41,7 +44,6 @@ public: ...@@ -41,7 +44,6 @@ public:
void initLogger(const char* name); void initLogger(const char* name);
void initDefaultLogger(const char* name); void initDefaultLogger(const char* name);
cMicroservices_ILoggerLog4cppImpl(const char* name); cMicroservices_ILoggerLog4cppImpl(const char* name);
cMicroservices_ILoggerLog4cppImpl(const cMicroservices_ILoggerLog4cppImpl& orig); cMicroservices_ILoggerLog4cppImpl(const cMicroservices_ILoggerLog4cppImpl& orig);
virtual ~cMicroservices_ILoggerLog4cppImpl(); virtual ~cMicroservices_ILoggerLog4cppImpl();
......
...@@ -147,7 +147,7 @@ void MSICommandClientEvppImpl::HandleCommandAndCallback(ICommandClient::HttpComm ...@@ -147,7 +147,7 @@ void MSICommandClientEvppImpl::HandleCommandAndCallback(ICommandClient::HttpComm
cmdDataPtr->p_retstat->Reset(); cmdDataPtr->p_retstat->Reset();
cmdDataPtr->p_response->Reset(); cmdDataPtr->p_response->Reset();
std::unique_lock<std::mutex> lk(m); std::unique_lock<std::mutex> lk(m);
register int resp_code = responsePtr->http_code(); int resp_code = responsePtr->http_code();
if (resp_code == 0){ if (resp_code == 0){
this->handleRequestFailed(cmdDataPtr,CONNECTION_FAILED_OR_REQUEST_TIMEOUT); this->handleRequestFailed(cmdDataPtr,CONNECTION_FAILED_OR_REQUEST_TIMEOUT);
} else if (resp_code >= 200 && resp_code <= 206){ } else if (resp_code >= 200 && resp_code <= 206){
...@@ -273,7 +273,7 @@ MSRetStat MSICommandClientEvppImpl::HandleAsyncCommandAndCallback(HandleAsyncCom ...@@ -273,7 +273,7 @@ MSRetStat MSICommandClientEvppImpl::HandleAsyncCommandAndCallback(HandleAsyncCom
*/ */
requestPtr->Execute([this,handleAsyncCommandDataPtr,requestPtr](const std::shared_ptr<evpp::httpc::EvppResponse> &responsePtr) { requestPtr->Execute([this,handleAsyncCommandDataPtr,requestPtr](const std::shared_ptr<evpp::httpc::EvppResponse> &responsePtr) {
try { try {
register int resp_code = responsePtr->http_code(); int resp_code = responsePtr->http_code();
handleAsyncCommandDataPtr->finished = true; handleAsyncCommandDataPtr->finished = true;
if (resp_code == 0){ if (resp_code == 0){
this->handleAsyncRequestFailed(handleAsyncCommandDataPtr,CONNECTION_FAILED_OR_REQUEST_TIMEOUT); this->handleAsyncRequestFailed(handleAsyncCommandDataPtr,CONNECTION_FAILED_OR_REQUEST_TIMEOUT);
......
...@@ -453,7 +453,7 @@ void runEvppTest(){ ...@@ -453,7 +453,7 @@ void runEvppTest(){
auto f = [&counter, &responsed, r](const std::shared_ptr<evpp::httpc::Response> &response) { auto f = [&counter, &responsed, r](const std::shared_ptr<evpp::httpc::Response> &response) {
std::cout << "http_code=" << response->http_code() << " [" << response->body().ToString() << "]"; std::cout << "http_code=" << response->http_code() << " [" << response->body().ToString() << "]";
//std::string header = response->FindHeader("Connection"); //std::string header = response->FindHeader("Connection");
register int count = counter++; int count = counter++;
if (count >= ITERATIONS) if (count >= ITERATIONS)
responsed = true; responsed = true;
}; };
...@@ -479,7 +479,7 @@ void runEvppClientTest(evpp::EventLoopThread& eventLoop, ...@@ -479,7 +479,7 @@ void runEvppClientTest(evpp::EventLoopThread& eventLoop,
auto f = [&counter, &responsed, r](const std::shared_ptr<evpp::httpc::EvppResponse> &response) { auto f = [&counter, &responsed, r](const std::shared_ptr<evpp::httpc::EvppResponse> &response) {
std::cout << __PRETTY_FUNCTION__ << " http_code=" << response->http_code() << " [" << response->body().ToString() << "]\n"; std::cout << __PRETTY_FUNCTION__ << " http_code=" << response->http_code() << " [" << response->body().ToString() << "]\n";
//std::string header = response->FindHeader("Connection"); //std::string header = response->FindHeader("Connection");
register int count = counter++; int count = counter++;
if (count >= ITERATIONS) if (count >= ITERATIONS)
responsed = true; responsed = true;
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment