DruidConfig
DruidConfig is a gem to access the information about Druid cluster status. You can check a node capacity, number of segments, tiers... It uses zookeeper to get coordinator and overlord URIs.
To use in your application, add this line to your Gemfile:
gem 'druid_config'
Query Druid data
The purpose of this gem is to query Druid cluster status. If you want to query Druid data, I recommend you to use ruby-druid gem.
Initialization
Cluster
is the base class to perform queries. To initialize it send the Zookeeper URI and options as arguments:
cluster = DruidConfig::Cluster.new(zookeeper_uri, )
Available options:
- discovery_path: string with the discovery path of druid inside Zookeeper directory structure.
Usage
Call methods defined in DruidConfig::Cluster
to access to the data. To get more information about data returned in methods, check Druid documentation.
leader
: leaderload_status
: load statusload_status
: load queuemetadata_datasources
: Hash with metadata of datasourcesmetadata_datasources_segments
: Hash with metadata of segmentsdatasources
: all data sourcesdatasource
: a concrete data sourcerules
: all rules defined in the clustertiers
: tiersservers
ornodes
: all nodes of the clusterphysical_servers
orphysical_nodes
: array of URIs of nodeshistoricals
: historical nodesrealtimes
: realtime nodesworkers
: worker nodesphysical_workers
: array of URIs of worker nodesrunning_tasks
,pending_tasks
,waiting_tasks
,complete_tasks
: tasks in the cluster based in their statustask
: load a task based on an identifierservices
: Hash with physical nodes and the services they are running
Entities
Some methods return an instance of an Entity
class. These entities provide multiple methods to access data. Defined entities are inside druid_config/entities
folder.
Exceptions
DruidConfig::Exceptions::NotAvailableNodes
This exception will be raised when you try to perform a query to a Druid Coordinator or Overlord but there aren't any node of that type available.
DruidConfig::Exceptions::DruidApiError
Sometimes the Gem have available nodes, but it can't access to Druid API. In this case, the gem automatically will reset the Zookeeper connection and retry the query. If second query fails too, a DruidConfig::Exceptions::DruidApiError
exception will be raised.
Collaborate
To contribute DruidConfig:
- Create an issue with the contribution: bug, enhancement or feature
- Fork the repository and make all changes you need
- Write test on new changes
- Create a pull request when you finish
License
DruidConfig gem is released under the Affero GPL license. Copyright redBorder