Skip to content

Commit

Permalink
Merge pull request #16 from yammer/react
Browse files Browse the repository at this point in the history
React
  • Loading branch information
chrisgray committed Apr 14, 2016
2 parents ae71ed6 + ae68b71 commit a8ba15f
Show file tree
Hide file tree
Showing 79 changed files with 1,510 additions and 2,042 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
target*
dependency-reduced-pom.xml
*.keystore
breakerbox-ui/node_modules
4 changes: 0 additions & 4 deletions breakerbox-dashboard/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,5 @@
<groupId>io.dropwizard</groupId>
<artifactId>dropwizard-assets</artifactId>
</dependency>
<dependency>
<groupId>io.dropwizard</groupId>
<artifactId>dropwizard-views</artifactId>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,16 @@

import com.netflix.hystrix.dashboard.stream.MockStreamServlet;
import com.netflix.hystrix.dashboard.stream.ProxyStreamServlet;
import com.yammer.breakerbox.dashboard.resources.IndexResource;
import io.dropwizard.Configuration;
import io.dropwizard.ConfiguredBundle;
import io.dropwizard.assets.AssetsBundle;
import io.dropwizard.setup.Bootstrap;
import io.dropwizard.setup.Environment;
import io.dropwizard.views.ViewBundle;

public class BreakerboxDashboardBundle implements ConfiguredBundle<Configuration> {
@Override
public void initialize(Bootstrap<?> bootstrap) {
bootstrap.addBundle(new AssetsBundle());
bootstrap.addBundle(new ViewBundle<>());
}

@Override
Expand All @@ -23,7 +20,5 @@ public void run(Configuration configuration, Environment environment) throws Exc

environment.servlets().addServlet("mock.stream", new MockStreamServlet()).addMapping("/tenacity/mock.stream");
environment.servlets().addServlet("proxy.stream", new ProxyStreamServlet()).addMapping("/tenacity/proxy.stream");

environment.jersey().register(new IndexResource());
}
}

This file was deleted.

16 changes: 0 additions & 16 deletions breakerbox-dashboard/src/main/resources/index.css

This file was deleted.

84 changes: 0 additions & 84 deletions breakerbox-dashboard/src/main/resources/index.html

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public class JdbiStore extends BreakerboxStore {
private static final Logger LOGGER = LoggerFactory.getLogger(JdbiStore.class);
protected final ServiceDB serviceDB;
protected final DependencyDB dependencyDB;
private final MetricRegistry metricRegistry;
protected JdbiConfiguration configuration;

public JdbiStore(JdbiConfiguration storeConfiguration,
Expand All @@ -46,13 +47,15 @@ public JdbiStore(JdbiConfiguration storeConfiguration,
serviceDB = database.onDemand(ServiceDB.class);

this.configuration = storeConfiguration;

metricRegistry = environment.metrics();
}

@Override
public boolean initialize() throws Exception {
public boolean initialize() {
try (CloseableLiquibase liquibase = new CloseableLiquibase(configuration
.getDataSourceFactory()
.build(new MetricRegistry(), "liquibase"))) {
.build(metricRegistry, "liquibase"))) {
liquibase.update("");
return true;
} catch (Exception err) {
Expand Down
12 changes: 9 additions & 3 deletions breakerbox-service/config.properties
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
turbine.aggregator.clusterConfig=breakerbox,production
turbine.aggregator.clusterConfig=breakerbox,production,others

turbine.instanceUrlSuffix=/tenacity/metrics.stream

turbine.ConfigPropertyBasedDiscovery.others.instances=\
localhost:8080,\
localhost:8081

turbine.ConfigPropertyBasedDiscovery.breakerbox.instances=\
localhost:8080
localhost:8080,\
localhost:8081

turbine.ConfigPropertyBasedDiscovery.production.instances=\
localhost:8080
localhost:8080,\
localhost:8081
8 changes: 0 additions & 8 deletions breakerbox-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,6 @@
<groupId>com.yammer.breakerbox</groupId>
<artifactId>breakerbox-jdbi</artifactId>
</dependency>
<dependency>
<groupId>io.dropwizard</groupId>
<artifactId>dropwizard-views</artifactId>
</dependency>
<dependency>
<groupId>io.dropwizard</groupId>
<artifactId>dropwizard-views-mustache</artifactId>
</dependency>
<dependency>
<groupId>io.dropwizard</groupId>
<artifactId>dropwizard-testing</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,10 @@
import com.yammer.breakerbox.service.config.BreakerboxServiceConfiguration;
import com.yammer.breakerbox.service.core.SyncComparator;
import com.yammer.breakerbox.service.managed.ManagedTurbine;
import com.yammer.breakerbox.service.resources.ArchaiusResource;
import com.yammer.breakerbox.service.resources.ConfigureResource;
import com.yammer.breakerbox.service.resources.DashboardResource;
import com.yammer.breakerbox.service.resources.InSyncResource;
import com.yammer.breakerbox.service.resources.*;
import com.yammer.breakerbox.service.store.ScheduledTenacityPoller;
import com.yammer.breakerbox.service.store.TenacityPropertyKeysStore;
import com.yammer.breakerbox.service.tenacity.*;
import com.yammer.breakerbox.service.views.DashboardViewFactory;
import com.yammer.breakerbox.store.BreakerboxStore;
import com.yammer.dropwizard.authenticator.LdapAuthenticator;
import com.yammer.dropwizard.authenticator.LdapConfiguration;
Expand Down Expand Up @@ -136,9 +132,10 @@ public void run(final BreakerboxServiceConfiguration configuration, final Enviro
environment.servlets().addServlet("turbine.stream", new TurbineStreamServlet()).addMapping("/turbine.stream");

environment.jersey().register(new ArchaiusResource(configuration.getArchaiusOverride(), breakerboxStore));
environment.jersey().register(new ConfigureResource(breakerboxStore, tenacityPropertyKeysStore, syncComparator, metaClusters));
environment.jersey().register(new DashboardResource(new DashboardViewFactory(configuration.getBreakerboxHostAndPort()), configuration.getDefaultDashboard(), metaClusters));
environment.jersey().register(new ConfigureResource(breakerboxStore));
environment.jersey().register(new DashboardResource(configuration.getDefaultDashboard(), configuration.getBreakerboxHostAndPort(), metaClusters));
environment.jersey().register(new InSyncResource(syncComparator, tenacityPropertyKeysStore));
environment.jersey().register(new ClustersResource(metaClusters, breakerboxStore, tenacityPropertyKeysStore));

final ScheduledExecutorService scheduledExecutorService = environment
.lifecycle()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package com.yammer.breakerbox.service.resources;

import com.codahale.metrics.annotation.Timed;
import com.google.common.collect.Ordering;
import com.yammer.breakerbox.service.comparable.SortRowFirst;
import com.yammer.breakerbox.service.core.Instances;
import com.yammer.breakerbox.service.store.TenacityPropertyKeysStore;
import com.yammer.breakerbox.store.BreakerboxStore;
import com.yammer.breakerbox.store.DependencyId;
import com.yammer.breakerbox.store.ServiceId;
import com.yammer.breakerbox.store.model.DependencyModel;

import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import java.util.Collection;
import java.util.Set;

@Path("/clusters")
public class ClustersResource {
private final Set<String> specifiedMetaClusters;
private final BreakerboxStore breakerboxStore;
private final TenacityPropertyKeysStore tenacityPropertyKeysStore;

public ClustersResource(Set<String> specifiedMetaClusters,
BreakerboxStore breakerboxStore,
TenacityPropertyKeysStore tenacityPropertyKeysStore) {
this.specifiedMetaClusters = specifiedMetaClusters;
this.breakerboxStore = breakerboxStore;
this.tenacityPropertyKeysStore = tenacityPropertyKeysStore;
}

@GET @Timed @Produces(MediaType.APPLICATION_JSON)
public Collection<String> clusters(@QueryParam("no-meta") @DefaultValue("false") boolean noMeta) {
return noMeta ? Instances.noMetaClusters(specifiedMetaClusters) : Instances.clusters();
}

@GET @Timed @Produces(MediaType.APPLICATION_JSON)
@Path("{serviceId}/propertykeys")
public Collection<String> propertyKeys(@PathParam("serviceId") String id) {
final ServiceId serviceId = ServiceId.from(id);
return tenacityPropertyKeysStore.tenacityPropertyKeysFor(Instances.propertyKeyUris(serviceId));
}

@GET @Timed @Produces(MediaType.APPLICATION_JSON)
@Path("{serviceId}/configurations/{dependencyId}")
public Collection<DependencyModel> configurations(@PathParam("serviceId") String serviceId,
@PathParam("dependencyId") String dependencyId) {
return Ordering.from(new SortRowFirst())
.reverse()
.immutableSortedCopy(breakerboxStore.allDependenciesFor(DependencyId.from(dependencyId),
ServiceId.from(serviceId)));
}
}
Loading

0 comments on commit a8ba15f

Please sign in to comment.