Search in sources :

Example 1 with BasicTag

use of com.netflix.spectator.api.BasicTag in project incubator-servicecomb-java-chassis by apache.

the class TestDefaultTagFinder method readSucc.

@Test
public void readSucc() {
    Tag tag = new BasicTag("key", "value");
    List<Tag> tags = Arrays.asList(new BasicTag("t1", "t1v"), tag);
    Assert.assertSame(tag, finder.find(tags));
}
Also used : BasicTag(com.netflix.spectator.api.BasicTag) Tag(com.netflix.spectator.api.Tag) BasicTag(com.netflix.spectator.api.BasicTag) Test(org.junit.Test)

Example 2 with BasicTag

use of com.netflix.spectator.api.BasicTag in project incubator-servicecomb-java-chassis by apache.

the class TestDefaultTagFinder method readFail.

@Test
public void readFail() {
    List<Tag> tags = Arrays.asList(new BasicTag("t1", "t1v"));
    Assert.assertNull(finder.find(tags));
}
Also used : BasicTag(com.netflix.spectator.api.BasicTag) Tag(com.netflix.spectator.api.Tag) BasicTag(com.netflix.spectator.api.BasicTag) Test(org.junit.Test)

Example 3 with BasicTag

use of com.netflix.spectator.api.BasicTag in project java-chassis by ServiceComb.

the class ThreadPoolMetersInitializer method createThreadPoolMeters.

protected void createThreadPoolMeters(String threadPoolName, Executor executor) {
    if (!ThreadPoolExecutor.class.isInstance(executor)) {
        return;
    }
    ThreadPoolMonitor.attach(registry, (ThreadPoolExecutor) executor, threadPoolName);
    if (executor instanceof ThreadPoolExecutorEx) {
        Tag idTag = new BasicTag("id", threadPoolName);
        PolledMeter.using(registry).withName(REJECTED_COUNT).withTag(idTag).monitorMonotonicCounter((ThreadPoolExecutorEx) executor, ThreadPoolExecutorEx::getRejectedCount);
    }
}
Also used : BasicTag(com.netflix.spectator.api.BasicTag) ThreadPoolExecutorEx(org.apache.servicecomb.core.executor.ThreadPoolExecutorEx) ThreadPoolExecutor(java.util.concurrent.ThreadPoolExecutor) Tag(com.netflix.spectator.api.Tag) BasicTag(com.netflix.spectator.api.BasicTag)

Example 4 with BasicTag

use of com.netflix.spectator.api.BasicTag in project java-chassis by ServiceComb.

the class TestDefaultTagFinder method readSucc.

@Test
public void readSucc() {
    Tag tag = new BasicTag("key", "value");
    List<Tag> tags = Arrays.asList(new BasicTag("t1", "t1v"), tag);
    Assert.assertSame(tag, finder.find(tags));
}
Also used : BasicTag(com.netflix.spectator.api.BasicTag) Tag(com.netflix.spectator.api.Tag) BasicTag(com.netflix.spectator.api.BasicTag) Test(org.junit.Test)

Example 5 with BasicTag

use of com.netflix.spectator.api.BasicTag in project java-chassis by ServiceComb.

the class TestDefaultTagFinder method readFail.

@Test
public void readFail() {
    List<Tag> tags = Arrays.asList(new BasicTag("t1", "t1v"));
    Assert.assertNull(finder.find(tags));
}
Also used : BasicTag(com.netflix.spectator.api.BasicTag) Tag(com.netflix.spectator.api.Tag) BasicTag(com.netflix.spectator.api.BasicTag) Test(org.junit.Test)

Aggregations

BasicTag (com.netflix.spectator.api.BasicTag)5 Tag (com.netflix.spectator.api.Tag)5 Test (org.junit.Test)4 ThreadPoolExecutor (java.util.concurrent.ThreadPoolExecutor)1 ThreadPoolExecutorEx (org.apache.servicecomb.core.executor.ThreadPoolExecutorEx)1