mirror of https://github.com/apache/druid.git
add loadstatus endpoint for serverView status
This commit is contained in:
parent
dfecfb71be
commit
4b5282d224
|
@ -66,6 +66,8 @@ public class BrokerServerView implements TimelineServerView
|
|||
private final ServerInventoryView baseView;
|
||||
private final TierSelectorStrategy tierSelectorStrategy;
|
||||
|
||||
private volatile boolean initialized = false;
|
||||
|
||||
@Inject
|
||||
public BrokerServerView(
|
||||
QueryToolChestWarehouse warehouse,
|
||||
|
@ -109,6 +111,7 @@ public class BrokerServerView implements TimelineServerView
|
|||
@Override
|
||||
public CallbackAction segmentViewInitialized()
|
||||
{
|
||||
initialized = true;
|
||||
return ServerView.CallbackAction.CONTINUE;
|
||||
}
|
||||
}
|
||||
|
@ -128,6 +131,11 @@ public class BrokerServerView implements TimelineServerView
|
|||
);
|
||||
}
|
||||
|
||||
public boolean isInitialized()
|
||||
{
|
||||
return initialized;
|
||||
}
|
||||
|
||||
public void clear()
|
||||
{
|
||||
synchronized (lock) {
|
||||
|
|
|
@ -54,7 +54,7 @@ public abstract class BaseZkCoordinator implements DataSegmentChangeHandler
|
|||
private final CuratorFramework curator;
|
||||
|
||||
private volatile PathChildrenCache loadQueueCache;
|
||||
private volatile boolean started;
|
||||
private volatile boolean started = false;
|
||||
private final ListeningExecutorService loadingExec;
|
||||
|
||||
public BaseZkCoordinator(
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* Druid - a distributed column store.
|
||||
* Copyright (C) 2014 Metamarkets Group Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
package io.druid.server.http;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.inject.Inject;
|
||||
import io.druid.client.BrokerServerView;
|
||||
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.Response;
|
||||
|
||||
@Path("/druid/broker/v1")
|
||||
public class BrokerResource
|
||||
{
|
||||
private final BrokerServerView brokerServerView;
|
||||
|
||||
@Inject
|
||||
public BrokerResource(BrokerServerView brokerServerView)
|
||||
{
|
||||
this.brokerServerView = brokerServerView;
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/loadstatus")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public Response getLoadStatus()
|
||||
{
|
||||
return Response.ok(ImmutableMap.of("inventoryInitialized", brokerServerView.isInitialized())).build();
|
||||
}
|
||||
}
|
|
@ -48,6 +48,7 @@ import io.druid.server.ClientInfoResource;
|
|||
import io.druid.server.ClientQuerySegmentWalker;
|
||||
import io.druid.server.QueryResource;
|
||||
import io.druid.server.coordination.broker.DruidBroker;
|
||||
import io.druid.server.http.BrokerResource;
|
||||
import io.druid.server.initialization.JettyServerInitializer;
|
||||
import io.druid.server.metrics.MetricsModule;
|
||||
import io.druid.server.router.TieredBrokerConfig;
|
||||
|
@ -87,6 +88,7 @@ public class CliBroker extends ServerRunnable
|
|||
binder.bind(QueryToolChestWarehouse.class).to(MapQueryToolChestWarehouse.class);
|
||||
|
||||
binder.bind(CachingClusteredClient.class).in(LazySingleton.class);
|
||||
binder.bind(BrokerServerView.class).in(LazySingleton.class);
|
||||
binder.bind(TimelineServerView.class).to(BrokerServerView.class).in(LazySingleton.class);
|
||||
|
||||
binder.bind(Cache.class).toProvider(CacheProvider.class).in(ManageLifecycle.class);
|
||||
|
@ -101,6 +103,7 @@ public class CliBroker extends ServerRunnable
|
|||
|
||||
binder.bind(JettyServerInitializer.class).to(QueryJettyServerInitializer.class).in(LazySingleton.class);
|
||||
Jerseys.addResource(binder, QueryResource.class);
|
||||
Jerseys.addResource(binder, BrokerResource.class);
|
||||
Jerseys.addResource(binder, ClientInfoResource.class);
|
||||
LifecycleModule.register(binder, QueryResource.class);
|
||||
LifecycleModule.register(binder, DruidBroker.class);
|
||||
|
|
Loading…
Reference in New Issue