summaryrefslogtreecommitdiff
path: root/cpp
diff options
context:
space:
mode:
authorBernard Normier <bernard@zeroc.com>2017-02-10 17:42:30 -0500
committerBernard Normier <bernard@zeroc.com>2017-02-10 17:42:30 -0500
commit43382f18da8d0dd88c26df6cc27690dcb80060ab (patch)
tree56fcaa357e4d5b8f2b4c0b1e53d53c53823b60e4 /cpp
parentFix java-compat/Slice/generation test (diff)
downloadice-43382f18da8d0dd88c26df6cc27690dcb80060ab.tar.bz2
ice-43382f18da8d0dd88c26df6cc27690dcb80060ab.tar.xz
ice-43382f18da8d0dd88c26df6cc27690dcb80060ab.zip
ICE-7547: add tracing for admin-routing in IceGrid
Diffstat (limited to 'cpp')
-rw-r--r--cpp/src/Ice/PropertyNames.cpp4
-rw-r--r--cpp/src/Ice/PropertyNames.h2
-rw-r--r--cpp/src/IceGrid/AdminRouter.cpp51
-rw-r--r--cpp/src/IceGrid/AdminRouter.h14
-rw-r--r--cpp/src/IceGrid/NodeAdminRouter.cpp13
-rw-r--r--cpp/src/IceGrid/RegistryAdminRouter.cpp15
-rw-r--r--cpp/src/IceGrid/TraceLevels.cpp3
-rw-r--r--cpp/src/IceGrid/TraceLevels.h3
8 files changed, 92 insertions, 13 deletions
diff --git a/cpp/src/Ice/PropertyNames.cpp b/cpp/src/Ice/PropertyNames.cpp
index 7fd76b56b12..6c28af3e195 100644
--- a/cpp/src/Ice/PropertyNames.cpp
+++ b/cpp/src/Ice/PropertyNames.cpp
@@ -6,7 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
-// Generated by makeprops.py from file ./config/PropertyNames.xml, Wed Nov 16 09:52:45 2016
+// Generated by makeprops.py from file ../config/PropertyNames.xml, Fri Feb 10 17:05:23 2017
// IMPORTANT: Do not edit this file -- any edits made here will be lost!
@@ -617,6 +617,7 @@ const IceInternal::Property IceGridPropsData[] =
IceInternal::Property("IceGrid.Node.RedirectErrToOut", false, 0),
IceInternal::Property("IceGrid.Node.Trace.Activator", false, 0),
IceInternal::Property("IceGrid.Node.Trace.Adapter", false, 0),
+ IceInternal::Property("IceGrid.Node.Trace.Admin", false, 0),
IceInternal::Property("IceGrid.Node.Trace.Patch", false, 0),
IceInternal::Property("IceGrid.Node.Trace.Replica", false, 0),
IceInternal::Property("IceGrid.Node.Trace.Server", false, 0),
@@ -912,6 +913,7 @@ const IceInternal::Property IceGridPropsData[] =
IceInternal::Property("IceGrid.Registry.SSLPermissionsVerifier.CollocationOptimized", false, 0),
IceInternal::Property("IceGrid.Registry.SSLPermissionsVerifier.Context.*", false, 0),
IceInternal::Property("IceGrid.Registry.SSLPermissionsVerifier", false, 0),
+ IceInternal::Property("IceGrid.Registry.Trace.Admin", false, 0),
IceInternal::Property("IceGrid.Registry.Trace.Application", false, 0),
IceInternal::Property("IceGrid.Registry.Trace.Adapter", false, 0),
IceInternal::Property("IceGrid.Registry.Trace.Locator", false, 0),
diff --git a/cpp/src/Ice/PropertyNames.h b/cpp/src/Ice/PropertyNames.h
index c505e5aaeb5..93c78f9a123 100644
--- a/cpp/src/Ice/PropertyNames.h
+++ b/cpp/src/Ice/PropertyNames.h
@@ -6,7 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
-// Generated by makeprops.py from file ./config/PropertyNames.xml, Wed Nov 16 09:52:45 2016
+// Generated by makeprops.py from file ../config/PropertyNames.xml, Fri Feb 10 17:05:23 2017
// IMPORTANT: Do not edit this file -- any edits made here will be lost!
diff --git a/cpp/src/IceGrid/AdminRouter.cpp b/cpp/src/IceGrid/AdminRouter.cpp
index 380521140dc..3808a4545e8 100644
--- a/cpp/src/IceGrid/AdminRouter.cpp
+++ b/cpp/src/IceGrid/AdminRouter.cpp
@@ -19,28 +19,61 @@ class CallbackI : public IceUtil::Shared
{
public:
- CallbackI(const AMD_Object_ice_invokePtr& cb) :
- _cb(cb)
+ CallbackI(const AMD_Object_ice_invokePtr& cb, const Ice::ObjectPrx& target, const string& operation,
+ const IceGrid::TraceLevelsPtr& traceLevels) :
+ _cb(cb),
+ _target(target),
+ _operation(operation),
+ _traceLevels(traceLevels)
{
}
void response(bool ok, const pair<const Byte*, const Byte*>& outParams)
{
+ if(_traceLevels->admin > 0)
+ {
+ Ice::Trace out(_traceLevels->logger, _traceLevels->adminCat);
+
+ out << "operation `" << _operation << "' routed to `" << Ice::identityToString(_target->ice_getIdentity())
+ << " -f " << _target->ice_getFacet() << "' is returning ";
+ if(ok)
+ {
+ out << "successfully";
+ }
+ else
+ {
+ out << "a user exception";
+ }
+ }
_cb->ice_response(ok, outParams);
}
- void exception(const Ice::Exception&)
+ void exception(const Ice::Exception& ex)
{
+ if(_traceLevels->admin > 0)
+ {
+ Ice::Trace out(_traceLevels->logger, _traceLevels->adminCat);
+ out << "operation `" << _operation << "' routed to `" << Ice::identityToString(_target->ice_getIdentity())
+ << " -f " << _target->ice_getFacet() << "' failed with " << ex;
+ }
// Admin object is unreachable
_cb->ice_exception(ObjectNotExistException(__FILE__, __LINE__));
}
private:
AMD_Object_ice_invokePtr _cb;
+ Ice::ObjectPrx _target;
+ string _operation;
+ const IceGrid::TraceLevelsPtr _traceLevels;
};
}
+IceGrid::AdminRouter::AdminRouter(const TraceLevelsPtr& traceLevels) :
+ _traceLevels(traceLevels)
+{
+}
+
void
IceGrid::AdminRouter::invokeOnTarget(const Ice::ObjectPrx& target,
const AMD_Object_ice_invokePtr& cb,
@@ -52,9 +85,13 @@ IceGrid::AdminRouter::invokeOnTarget(const Ice::ObjectPrx& target,
//
// Call with AMI
//
- Callback_Object_ice_invokePtr amiCb = newCallback_Object_ice_invoke(new CallbackI(cb),
- &CallbackI::response,
- &CallbackI::exception);
+ Callback_Object_ice_invokePtr amiCb = newCallback_Object_ice_invoke(
+ new CallbackI(cb, target, current.operation, _traceLevels), &CallbackI::response, &CallbackI::exception);
+
+ if(_traceLevels->admin > 0)
+ {
+ Ice::Trace out(_traceLevels->logger, _traceLevels->adminCat);
+ out << "routing operation `" << current.operation << "' to `" << target->ice_toString() << "'";
+ }
target->begin_ice_invoke(current.operation, current.mode, inParams, current.ctx, amiCb);
}
-
diff --git a/cpp/src/IceGrid/AdminRouter.h b/cpp/src/IceGrid/AdminRouter.h
index 052fa6759f4..d2b21cc2fdb 100644
--- a/cpp/src/IceGrid/AdminRouter.h
+++ b/cpp/src/IceGrid/AdminRouter.h
@@ -11,6 +11,7 @@
#define ICE_GRID_ADMIN_ROUTER_H
#include <Ice/Ice.h>
+#include <IceGrid/TraceLevels.h>
namespace IceGrid
{
@@ -22,10 +23,15 @@ class AdminRouter : public Ice::BlobjectArrayAsync
{
protected:
- virtual void invokeOnTarget(const Ice::ObjectPrx&,
- const Ice::AMD_Object_ice_invokePtr&,
- const std::pair<const Ice::Byte*, const Ice::Byte*>&,
- const Ice::Current&);
+ AdminRouter(const TraceLevelsPtr&);
+
+
+ void invokeOnTarget(const Ice::ObjectPrx&,
+ const Ice::AMD_Object_ice_invokePtr&,
+ const std::pair<const Ice::Byte*, const Ice::Byte*>&,
+ const Ice::Current&);
+
+ const TraceLevelsPtr _traceLevels;
};
}
diff --git a/cpp/src/IceGrid/NodeAdminRouter.cpp b/cpp/src/IceGrid/NodeAdminRouter.cpp
index fe36134a2b3..4d9ca4eebe2 100644
--- a/cpp/src/IceGrid/NodeAdminRouter.cpp
+++ b/cpp/src/IceGrid/NodeAdminRouter.cpp
@@ -18,6 +18,7 @@ using namespace std;
IceGrid::NodeServerAdminRouter::NodeServerAdminRouter(const NodeIPtr& node) :
+ AdminRouter(node->getTraceLevels()),
_node(node)
{
}
@@ -34,6 +35,12 @@ IceGrid::NodeServerAdminRouter::ice_invoke_async(const AMD_Object_ice_invokePtr&
ServerIPtr server = ServerIPtr::dynamicCast(_node->getAdapter()->find(serverId));
if(server == 0)
{
+ if(_traceLevels->admin > 0)
+ {
+ Ice::Trace out(_traceLevels->logger, _traceLevels->adminCat);
+ out << "could not find Admin proxy for server `" << current.id.name << "'";
+ }
+
throw ObjectNotExistException(__FILE__, __LINE__);
}
@@ -44,6 +51,12 @@ IceGrid::NodeServerAdminRouter::ice_invoke_async(const AMD_Object_ice_invokePtr&
if(target == 0)
{
+ if(_traceLevels->admin > 0)
+ {
+ Ice::Trace out(_traceLevels->logger, _traceLevels->adminCat);
+ out << "no Process proxy registered with server `" << current.id.name << "'";
+ }
+
throw ObjectNotExistException(__FILE__, __LINE__);
}
diff --git a/cpp/src/IceGrid/RegistryAdminRouter.cpp b/cpp/src/IceGrid/RegistryAdminRouter.cpp
index e69dc2a1baa..2edbf27005d 100644
--- a/cpp/src/IceGrid/RegistryAdminRouter.cpp
+++ b/cpp/src/IceGrid/RegistryAdminRouter.cpp
@@ -53,6 +53,7 @@ private:
}
IceGrid::RegistryServerAdminRouter::RegistryServerAdminRouter(const DatabasePtr& database) :
+ AdminRouter(database->getTraceLevels()),
_database(database)
{
}
@@ -99,6 +100,7 @@ IceGrid::RegistryServerAdminRouter::ice_invoke_async(const AMD_Object_ice_invoke
IceGrid::RegistryNodeAdminRouter::RegistryNodeAdminRouter(const string& collocNodeName, const DatabasePtr& database) :
+ AdminRouter(database->getTraceLevels()),
_collocNodeName(collocNodeName),
_database(database)
{
@@ -131,6 +133,12 @@ IceGrid::RegistryNodeAdminRouter::ice_invoke_async(const AMD_Object_ice_invokePt
if(target == 0)
{
+ if(_traceLevels->admin > 0)
+ {
+ Ice::Trace out(_traceLevels->logger, _traceLevels->adminCat);
+ out << "could not find Admin proxy for node `" << current.id.name << "'";
+ }
+
throw ObjectNotExistException(__FILE__, __LINE__);
}
}
@@ -144,6 +152,7 @@ IceGrid::RegistryNodeAdminRouter::ice_invoke_async(const AMD_Object_ice_invokePt
IceGrid::RegistryReplicaAdminRouter::RegistryReplicaAdminRouter(const string& name,
const DatabasePtr& database) :
+ AdminRouter(database->getTraceLevels()),
_name(name),
_database(database)
{
@@ -175,6 +184,12 @@ IceGrid::RegistryReplicaAdminRouter::ice_invoke_async(const AMD_Object_ice_invok
if(target == 0)
{
+ if(_traceLevels->admin > 0)
+ {
+ Ice::Trace out(_traceLevels->logger, _traceLevels->adminCat);
+ out << "could not find Admin proxy for replica `" << current.id.name << "'";
+ }
+
throw ObjectNotExistException(__FILE__, __LINE__);
}
diff --git a/cpp/src/IceGrid/TraceLevels.cpp b/cpp/src/IceGrid/TraceLevels.cpp
index cd22d49d916..bf227a2d5a7 100644
--- a/cpp/src/IceGrid/TraceLevels.cpp
+++ b/cpp/src/IceGrid/TraceLevels.cpp
@@ -15,6 +15,8 @@ using namespace std;
using namespace IceGrid;
TraceLevels::TraceLevels(const Ice::CommunicatorPtr& communicator, const string& prefix) :
+ admin(0),
+ adminCat("Admin"),
application(0),
applicationCat("Application"),
node(0),
@@ -40,6 +42,7 @@ TraceLevels::TraceLevels(const Ice::CommunicatorPtr& communicator, const string&
Ice::PropertiesPtr properties = communicator->getProperties();
string keyBase = prefix + ".Trace.";
+ const_cast<int&>(admin) = properties->getPropertyAsInt(keyBase + adminCat);
const_cast<int&>(application) = properties->getPropertyAsInt(keyBase + applicationCat);
const_cast<int&>(node) = properties->getPropertyAsInt(keyBase + nodeCat);
const_cast<int&>(replica) = properties->getPropertyAsInt(keyBase + replicaCat);
diff --git a/cpp/src/IceGrid/TraceLevels.h b/cpp/src/IceGrid/TraceLevels.h
index b83bb819389..399f423b0cc 100644
--- a/cpp/src/IceGrid/TraceLevels.h
+++ b/cpp/src/IceGrid/TraceLevels.h
@@ -24,6 +24,9 @@ public:
TraceLevels(const Ice::CommunicatorPtr&, const std::string&);
virtual ~TraceLevels();
+ const int admin;
+ const char* adminCat;
+
const int application;
const char* applicationCat;