Search in sources :

Example 1 with MetricsCacheLocation

use of org.apache.heron.proto.tmanager.TopologyManager.MetricsCacheLocation in project heron by twitter.

the class MetricsCacheMetricsProviderTest method createMetricsProviderSpy.

private MetricsCacheMetricsProvider createMetricsProviderSpy() {
    MetricsCacheLocation location = MetricsCacheLocation.newBuilder().setTopologyName("testTopo").setTopologyId("topoId").setHost("localhost").setControllerPort(0).setServerPort(0).build();
    SchedulerStateManagerAdaptor stateMgr = Mockito.mock(SchedulerStateManagerAdaptor.class);
    when(stateMgr.getMetricsCacheLocation("testTopo")).thenReturn(location);
    MetricsCacheMetricsProvider metricsProvider = new MetricsCacheMetricsProvider(stateMgr, "testTopo");
    return spy(metricsProvider);
}
Also used : MetricsCacheLocation(org.apache.heron.proto.tmanager.TopologyManager.MetricsCacheLocation) SchedulerStateManagerAdaptor(org.apache.heron.spi.statemgr.SchedulerStateManagerAdaptor)

Example 2 with MetricsCacheLocation

use of org.apache.heron.proto.tmanager.TopologyManager.MetricsCacheLocation in project heron by twitter.

the class MetricsCacheMetricsProvider method getCacheLocation.

/* returns last known location of metrics cache
   */
private synchronized String getCacheLocation() {
    if (metricsCacheLocation != null) {
        return metricsCacheLocation;
    }
    MetricsCacheLocation cacheLocation = stateManagerAdaptor.getMetricsCacheLocation(topologyName);
    metricsCacheLocation = String.format("http://%s:%s/%s", cacheLocation.getHost(), cacheLocation.getStatsPort(), PATH_STATS);
    return metricsCacheLocation;
}
Also used : MetricsCacheLocation(org.apache.heron.proto.tmanager.TopologyManager.MetricsCacheLocation)

Aggregations

MetricsCacheLocation (org.apache.heron.proto.tmanager.TopologyManager.MetricsCacheLocation)2 SchedulerStateManagerAdaptor (org.apache.heron.spi.statemgr.SchedulerStateManagerAdaptor)1