diff options
author | Bernard Normier <bernard@zeroc.com> | 2017-02-10 17:42:30 -0500 |
---|---|---|
committer | Bernard Normier <bernard@zeroc.com> | 2017-02-10 17:42:30 -0500 |
commit | 43382f18da8d0dd88c26df6cc27690dcb80060ab (patch) | |
tree | 56fcaa357e4d5b8f2b4c0b1e53d53c53823b60e4 | |
parent | Fix java-compat/Slice/generation test (diff) | |
download | ice-43382f18da8d0dd88c26df6cc27690dcb80060ab.tar.bz2 ice-43382f18da8d0dd88c26df6cc27690dcb80060ab.tar.xz ice-43382f18da8d0dd88c26df6cc27690dcb80060ab.zip |
ICE-7547: add tracing for admin-routing in IceGrid
-rw-r--r-- | config/PropertyNames.xml | 4 | ||||
-rw-r--r-- | cpp/src/Ice/PropertyNames.cpp | 4 | ||||
-rw-r--r-- | cpp/src/Ice/PropertyNames.h | 2 | ||||
-rw-r--r-- | cpp/src/IceGrid/AdminRouter.cpp | 51 | ||||
-rw-r--r-- | cpp/src/IceGrid/AdminRouter.h | 14 | ||||
-rw-r--r-- | cpp/src/IceGrid/NodeAdminRouter.cpp | 13 | ||||
-rw-r--r-- | cpp/src/IceGrid/RegistryAdminRouter.cpp | 15 | ||||
-rw-r--r-- | cpp/src/IceGrid/TraceLevels.cpp | 3 | ||||
-rw-r--r-- | cpp/src/IceGrid/TraceLevels.h | 3 | ||||
-rw-r--r-- | csharp/src/Ice/PropertyNames.cs | 4 | ||||
-rw-r--r-- | java-compat/src/Ice/src/main/java/IceInternal/PropertyNames.java | 4 | ||||
-rw-r--r-- | java/src/Ice/src/main/java/com/zeroc/IceInternal/PropertyNames.java | 4 | ||||
-rw-r--r-- | js/src/Ice/PropertyNames.js | 2 |
13 files changed, 105 insertions, 18 deletions
diff --git a/config/PropertyNames.xml b/config/PropertyNames.xml index 2351ae06c55..0ac8431d650 100644 --- a/config/PropertyNames.xml +++ b/config/PropertyNames.xml @@ -491,6 +491,7 @@ generated from the section label. <property name="Node.RedirectErrToOut" /> <property name="Node.Trace.Activator" /> <property name="Node.Trace.Adapter" /> + <property name="Node.Trace.Admin" /> <property name="Node.Trace.Patch" /> <property name="Node.Trace.Replica" /> <property name="Node.Trace.Server" /> @@ -524,7 +525,8 @@ generated from the section label. <property name="Registry.SessionFilters" /> <property name="Registry.SessionManager" class="objectadapter" /> <property name="Registry.SessionTimeout" /> - <property name="Registry.SSLPermissionsVerifier" class="proxy" /> + <property name="Registry.SSLPermissionsVerifier" class="proxy"/> + <property name="Registry.Trace.Admin" /> <property name="Registry.Trace.Application" /> <property name="Registry.Trace.Adapter" /> <property name="Registry.Trace.Locator" /> 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; diff --git a/csharp/src/Ice/PropertyNames.cs b/csharp/src/Ice/PropertyNames.cs index 85cc14c3f05..43786d88671 100644 --- a/csharp/src/Ice/PropertyNames.cs +++ b/csharp/src/Ice/PropertyNames.cs @@ -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! @@ -598,6 +598,7 @@ namespace IceInternal new Property(@"^IceGrid\.Node\.RedirectErrToOut$", false, null), new Property(@"^IceGrid\.Node\.Trace\.Activator$", false, null), new Property(@"^IceGrid\.Node\.Trace\.Adapter$", false, null), + new Property(@"^IceGrid\.Node\.Trace\.Admin$", false, null), new Property(@"^IceGrid\.Node\.Trace\.Patch$", false, null), new Property(@"^IceGrid\.Node\.Trace\.Replica$", false, null), new Property(@"^IceGrid\.Node\.Trace\.Server$", false, null), @@ -893,6 +894,7 @@ namespace IceInternal new Property(@"^IceGrid\.Registry\.SSLPermissionsVerifier\.CollocationOptimized$", false, null), new Property(@"^IceGrid\.Registry\.SSLPermissionsVerifier\.Context\.[^\s]+$", false, null), new Property(@"^IceGrid\.Registry\.SSLPermissionsVerifier$", false, null), + new Property(@"^IceGrid\.Registry\.Trace\.Admin$", false, null), new Property(@"^IceGrid\.Registry\.Trace\.Application$", false, null), new Property(@"^IceGrid\.Registry\.Trace\.Adapter$", false, null), new Property(@"^IceGrid\.Registry\.Trace\.Locator$", false, null), diff --git a/java-compat/src/Ice/src/main/java/IceInternal/PropertyNames.java b/java-compat/src/Ice/src/main/java/IceInternal/PropertyNames.java index 8dcb0eac059..e70a2fb1b5d 100644 --- a/java-compat/src/Ice/src/main/java/IceInternal/PropertyNames.java +++ b/java-compat/src/Ice/src/main/java/IceInternal/PropertyNames.java @@ -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! @@ -598,6 +598,7 @@ public final class PropertyNames new Property("IceGrid\\.Node\\.RedirectErrToOut", false, null), new Property("IceGrid\\.Node\\.Trace\\.Activator", false, null), new Property("IceGrid\\.Node\\.Trace\\.Adapter", false, null), + new Property("IceGrid\\.Node\\.Trace\\.Admin", false, null), new Property("IceGrid\\.Node\\.Trace\\.Patch", false, null), new Property("IceGrid\\.Node\\.Trace\\.Replica", false, null), new Property("IceGrid\\.Node\\.Trace\\.Server", false, null), @@ -893,6 +894,7 @@ public final class PropertyNames new Property("IceGrid\\.Registry\\.SSLPermissionsVerifier\\.CollocationOptimized", false, null), new Property("IceGrid\\.Registry\\.SSLPermissionsVerifier\\.Context\\.[^\\s]+", false, null), new Property("IceGrid\\.Registry\\.SSLPermissionsVerifier", false, null), + new Property("IceGrid\\.Registry\\.Trace\\.Admin", false, null), new Property("IceGrid\\.Registry\\.Trace\\.Application", false, null), new Property("IceGrid\\.Registry\\.Trace\\.Adapter", false, null), new Property("IceGrid\\.Registry\\.Trace\\.Locator", false, null), diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/PropertyNames.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/PropertyNames.java index 3408c5bc537..772e8f731de 100644 --- a/java/src/Ice/src/main/java/com/zeroc/IceInternal/PropertyNames.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/PropertyNames.java @@ -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! @@ -598,6 +598,7 @@ public final class PropertyNames new Property("IceGrid\\.Node\\.RedirectErrToOut", false, null), new Property("IceGrid\\.Node\\.Trace\\.Activator", false, null), new Property("IceGrid\\.Node\\.Trace\\.Adapter", false, null), + new Property("IceGrid\\.Node\\.Trace\\.Admin", false, null), new Property("IceGrid\\.Node\\.Trace\\.Patch", false, null), new Property("IceGrid\\.Node\\.Trace\\.Replica", false, null), new Property("IceGrid\\.Node\\.Trace\\.Server", false, null), @@ -893,6 +894,7 @@ public final class PropertyNames new Property("IceGrid\\.Registry\\.SSLPermissionsVerifier\\.CollocationOptimized", false, null), new Property("IceGrid\\.Registry\\.SSLPermissionsVerifier\\.Context\\.[^\\s]+", false, null), new Property("IceGrid\\.Registry\\.SSLPermissionsVerifier", false, null), + new Property("IceGrid\\.Registry\\.Trace\\.Admin", false, null), new Property("IceGrid\\.Registry\\.Trace\\.Application", false, null), new Property("IceGrid\\.Registry\\.Trace\\.Adapter", false, null), new Property("IceGrid\\.Registry\\.Trace\\.Locator", false, null), diff --git a/js/src/Ice/PropertyNames.js b/js/src/Ice/PropertyNames.js index 785ad1b824f..1f9b0e50c9d 100644 --- a/js/src/Ice/PropertyNames.js +++ b/js/src/Ice/PropertyNames.js @@ -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! |