Typically in a large system with many cascading dependencies managed by different trackers such as DeclarativeService, DependencyManager, iPojo or others, tracking the root cause of a top level service not being started can become very cumbersome. When building service oriented architectures, it is often the case that a single missing requirement will lock a full stack of services, but to find that one requirement is like finding a needle in a haystack!
Typically, if A depends on B which depends on C which depends on D, and D is nowhere to be found, I need only show the "C -> D" missing requirement; if D is resolved, then the whole stack is unlocked.
Similarly, if D is known by another dependency management system, but unregistered because it depends on E which is missing, then only the "D -> E" requirement is relevant.
So the basic idea here is to ask each dependency manager instance about its unresolved dependencies, merge all answers and filter the result to keep only the root causes. For now, only plugins for Felix SCR and Felix DependencyManager are implemented, but additional plugins for iPojo, Blueprint or others could easily be developed either in Scala or Java by anyone interested.
From this, and with the help of the Raphaƫl Graffle javascript library, I wrote a WebConsole plugin to graph both registered services and missing dependencies.
Here's what it looks like on basic sample of unsatisfied dependencies:
and for registered services, the arrows point from bundles to the services they use:
The colors are random and don't mean anything. The "bubbles" can be dragged around to help readability. If the graph of all services grows too large and difficult to read, a filter is provided to focus only on a subset of packages for instance.
Enough blabbering, try it for yourself:
> git clone https://github.com/joune/servicediagnostics.git > cd servicediagnostics > mvn install > run.sh
Interesting article
ReplyDelete