diff options
author | Benoit Foucher <benoit@zeroc.com> | 2014-09-12 13:24:38 +0200 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2014-09-12 13:24:38 +0200 |
commit | abeebf67ba35156606bbaabf073b496900f836cf (patch) | |
tree | 430212c34a1a1d4922fa11426e9fbd537fb98e52 /cpp/src/IceBox/ServiceManagerI.cpp | |
parent | Fixed dependencies (diff) | |
download | ice-abeebf67ba35156606bbaabf073b496900f836cf.tar.bz2 ice-abeebf67ba35156606bbaabf073b496900f836cf.tar.xz ice-abeebf67ba35156606bbaabf073b496900f836cf.zip |
Fixed ICE-5620: metrics admin creation in IceBox, fixed bug where timer wasn't instrumented
Diffstat (limited to 'cpp/src/IceBox/ServiceManagerI.cpp')
-rw-r--r-- | cpp/src/IceBox/ServiceManagerI.cpp | 81 |
1 files changed, 12 insertions, 69 deletions
diff --git a/cpp/src/IceBox/ServiceManagerI.cpp b/cpp/src/IceBox/ServiceManagerI.cpp index bffc34ae55a..43f183a87c4 100644 --- a/cpp/src/IceBox/ServiceManagerI.cpp +++ b/cpp/src/IceBox/ServiceManagerI.cpp @@ -15,8 +15,6 @@ #include <Ice/Initialize.h> #include <Ice/Instance.h> #include <Ice/PropertiesAdminI.h> -#include <Ice/MetricsAdminI.h> -#include <Ice/InstrumentationI.h> #include <Ice/LoggerAdminI.h> #include <IceBox/ServiceManagerI.h> @@ -399,27 +397,16 @@ IceBox::ServiceManagerI::start() } // - // If Ice metrics are enabled on the IceBox communicator, we also enable them on the - // shared communicator. + // If Ice metrics are enabled on the IceBox communicator, we also enable them on + // the service communicator. // - IceInternal::MetricsAdminIPtr metricsAdmin; - if(IceInternal::CommunicatorObserverIPtr::dynamicCast(_communicator->getObserver())) + if(_communicator->findAdminFacet("Metrics") && + initData.properties->getProperty("Ice.Admin.Metrics").empty()) { - metricsAdmin = new IceInternal::MetricsAdminI(initData.properties, getProcessLogger()); - initData.observer = new IceInternal::CommunicatorObserverI(metricsAdmin); + initData.properties->setProperty("Ice.Admin.Metrics", "1"); } _sharedCommunicator = initialize(initData); - - // - // Ensure the metrics admin plugin uses the same property set as the - // communicator. This is necessary to correctly deal with runtime - // property updates. - // - if(metricsAdmin) - { - metricsAdmin->setProperties(_sharedCommunicator->getProperties()); - } } // @@ -551,16 +538,12 @@ IceBox::ServiceManagerI::start(const string& service, const string& entryPoint, // property set. // Ice::CommunicatorPtr communicator; - IceInternal::MetricsAdminIPtr metricsAdmin; + Ice::ObjectPtr metricsAdmin; if(_communicator->getProperties()->getPropertyAsInt("IceBox.UseSharedCommunicator." + service) > 0) { assert(_sharedCommunicator); communicator = _sharedCommunicator; - Ice::Instrumentation::CommunicatorObserverPtr o = communicator->getObserver(); - if(o) - { - metricsAdmin = IceInternal::CommunicatorObserverIPtr::dynamicCast(o)->getMetricsAdmin(); - } + metricsAdmin = _sharedCommunicator->findAdminFacet("Metrics"); } else { @@ -609,10 +592,10 @@ IceBox::ServiceManagerI::start(const string& service, const string& entryPoint, // If Ice metrics are enabled on the IceBox communicator, we also enable them on // the service communicator. // - if(IceInternal::CommunicatorObserverIPtr::dynamicCast(_communicator->getObserver())) + if(_communicator->findAdminFacet("Metrics") && + initData.properties->getProperty("Ice.Admin.Metrics").empty()) { - metricsAdmin = new IceInternal::MetricsAdminI(initData.properties, initData.logger); - initData.observer = new IceInternal::CommunicatorObserverI(metricsAdmin); + initData.properties->setProperty("Ice.Admin.Metrics", "1"); } // @@ -654,15 +637,7 @@ IceBox::ServiceManagerI::start(const string& service, const string& entryPoint, } } - // - // Ensure the metrics admin plugin uses the same property set as the - // communicator. This is necessary to correctly deal with runtime - // property updates. - // - if(metricsAdmin) - { - metricsAdmin->setProperties(communicator->getProperties()); - } + metricsAdmin = communicator->findAdminFacet("Metrics"); } catch(const Exception& ex) { @@ -698,7 +673,7 @@ IceBox::ServiceManagerI::start(const string& service, const string& entryPoint, _communicator->addAdminFacet(metricsAdmin, "IceBox.Service." + info.name + ".Metrics"); // Ensure the metrics admin facet is notified of property updates. - propAdmin->addUpdateCallback(metricsAdmin); + propAdmin->addUpdateCallback(Ice::PropertiesAdminUpdateCallbackPtr::dynamicCast(metricsAdmin)); } // @@ -796,19 +771,6 @@ IceBox::ServiceManagerI::start(const string& service, const string& entryPoint, // Ignored } - try - { - Ice::ObjectPtr admin = _communicator->removeAdminFacet("IceBox.Service." + info.name + ".Metrics"); - if(admin && communicator != _sharedCommunicator) - { - IceInternal::MetricsAdminIPtr::dynamicCast(admin)->destroy(); - } - } - catch(const LocalException&) - { - // Ignored - } - if(info.communicator) { destroyServiceCommunicator(info.name, info.communicator); @@ -880,19 +842,6 @@ IceBox::ServiceManagerI::stopAll() // Ignored } - try - { - Ice::ObjectPtr admin = _communicator->removeAdminFacet("IceBox.Service." + info.name + ".Metrics"); - if(admin && info.communicator != _sharedCommunicator) - { - IceInternal::MetricsAdminIPtr::dynamicCast(admin)->destroy(); - } - } - catch(const LocalException&) - { - // Ignored - } - if(info.communicator) { try @@ -971,12 +920,6 @@ IceBox::ServiceManagerI::stopAll() if(_sharedCommunicator) { - Ice::Instrumentation::CommunicatorObserverPtr o = _sharedCommunicator->getObserver(); - if(o) - { - IceInternal::CommunicatorObserverIPtr::dynamicCast(o)->getMetricsAdmin()->destroy(); - } - try { _sharedCommunicator->destroy(); |