forked from apache/druid
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add shuffle metrics for parallel indexing (apache#10359)
* Add shuffle metrics for parallel indexing * javadoc and concurrency test * concurrency * fix javadoc * Feature flag * doc * fix doc and add a test * checkstyle * add tests * fix build and address comments
- Loading branch information
1 parent
8eee67e
commit 3eaedf4
Showing
30 changed files
with
956 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
86 changes: 86 additions & 0 deletions
86
core/src/test/java/org/apache/druid/java/util/metrics/MonitorSchedulerTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
package org.apache.druid.java.util.metrics; | ||
|
||
import com.google.common.collect.ImmutableList; | ||
import org.apache.druid.java.util.common.concurrent.Execs; | ||
import org.apache.druid.java.util.emitter.service.ServiceEmitter; | ||
import org.junit.Assert; | ||
import org.junit.Test; | ||
import org.mockito.Mockito; | ||
|
||
import java.util.Optional; | ||
|
||
public class MonitorSchedulerTest | ||
{ | ||
@Test | ||
public void testFindMonitor() | ||
{ | ||
class Monitor1 extends NoopMonitor | ||
{ | ||
} | ||
class Monitor2 extends NoopMonitor | ||
{ | ||
} | ||
class Monitor3 extends NoopMonitor | ||
{ | ||
} | ||
|
||
final Monitor1 monitor1 = new Monitor1(); | ||
final Monitor2 monitor2 = new Monitor2(); | ||
|
||
final MonitorScheduler scheduler = new MonitorScheduler( | ||
Mockito.mock(MonitorSchedulerConfig.class), | ||
Execs.scheduledSingleThreaded("monitor-scheduler-test"), | ||
Mockito.mock(ServiceEmitter.class), | ||
ImmutableList.of(monitor1, monitor2) | ||
); | ||
|
||
final Optional<Monitor1> maybeFound1 = scheduler.findMonitor(Monitor1.class); | ||
final Optional<Monitor2> maybeFound2 = scheduler.findMonitor(Monitor2.class); | ||
Assert.assertTrue(maybeFound1.isPresent()); | ||
Assert.assertTrue(maybeFound2.isPresent()); | ||
Assert.assertSame(monitor1, maybeFound1.get()); | ||
Assert.assertSame(monitor2, maybeFound2.get()); | ||
|
||
Assert.assertFalse(scheduler.findMonitor(Monitor3.class).isPresent()); | ||
} | ||
|
||
private static class NoopMonitor implements Monitor | ||
{ | ||
@Override | ||
public void start() | ||
{ | ||
|
||
} | ||
|
||
@Override | ||
public void stop() | ||
{ | ||
|
||
} | ||
|
||
@Override | ||
public boolean monitor(ServiceEmitter emitter) | ||
{ | ||
return true; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.