use of io.cdap.cdap.metrics.collect.AggregatedMetricsCollectionService in project cdap by caskdata.
the class TaskWorkerMetricsTest method beforeTest.
@Before
public void beforeTest() {
CConfiguration cConf = createCConf();
SConfiguration sConf = SConfiguration.create();
published = new ArrayList<>();
AggregatedMetricsCollectionService mockMetricsCollector = new AggregatedMetricsCollectionService(1000L) {
@Override
protected void publish(Iterator<MetricValues> metrics) {
Iterators.addAll(published, metrics);
}
};
mockMetricsCollector.startAndWait();
taskWorkerService = new TaskWorkerService(cConf, sConf, new InMemoryDiscoveryService(), (namespaceId, retryStrategy) -> null, mockMetricsCollector);
taskWorkerStateFuture = TaskWorkerTestUtil.getServiceCompletionFuture(taskWorkerService);
// start the service
taskWorkerService.startAndWait();
InetSocketAddress addr = taskWorkerService.getBindAddress();
this.uri = URI.create(String.format("http://%s:%s", addr.getHostName(), addr.getPort()));
}
use of io.cdap.cdap.metrics.collect.AggregatedMetricsCollectionService in project cdap by caskdata.
the class RemoteTaskExecutorTest method beforeTest.
@Before
public void beforeTest() {
published = new ArrayList<>();
mockMetricsCollector = new AggregatedMetricsCollectionService(1000L) {
@Override
protected void publish(Iterator<MetricValues> metrics) {
Iterators.addAll(published, metrics);
}
};
mockMetricsCollector.startAndWait();
registered = discoveryService.register(URIScheme.createDiscoverable(Constants.Service.TASK_WORKER, httpService));
}
Aggregations