Package org.apache.sirona.counters

Examples of org.apache.sirona.counters.Counter$Key


    validateQuery(query);
    validateSplitSize(numSplits);

    List<Query> splits = new ArrayList<Query>(numSplits);
    List<Key> scatterKeys = getScatterKeys(numSplits, query, datastore);
    Key lastKey = null;
    for (Key nextKey : getSplitKey(scatterKeys, numSplits)) {
      splits.add(createSplit(lastKey, nextKey, query));
      lastKey = nextKey;
    }
    splits.add(createSplit(lastKey, null, query));
View Full Code Here


    }

    @Test
    public void store() throws InterruptedException, UnknownHostException {
        { // force some counter data
            final Counter counter = Repository.INSTANCE.getCounter(new Counter.Key(Role.PERFORMANCES, "test"));
            counter.add(1.4);
            counter.add(1.6);
            Thread.sleep(150);
            counter.add(2.3);
            counter.add(2.9);
            Thread.sleep(1500);
        }

        final String host = Localhosts.get();
View Full Code Here

    @Test
    public void test() {
        final Foo foo = SironaProxyFactory.monitor(Foo.class, new FooImpl());
        foo.haveARest(2000);

        final Counter perf = Repository.INSTANCE.getCounter(new Counter.Key(Role.PERFORMANCES, FooImpl.class.getName() + ".haveARest"));
        assertNotNull(perf);
        assertEquals(2000, TimeUnit.NANOSECONDS.toMillis((int) perf.getMax()), 200);

        try {
            foo.throwSthg();
        } catch (final Exception e) {
            // normal
        }

        Counter failures = null;
        for (final Counter c : Repository.INSTANCE.counters()) {
            if (c.getKey().getName().contains("UnsupportedOperationException")) {
                if (failures != null) {
                    fail();
                }
                failures = c;
            }
        }

        assertNotNull(failures);
        assertEquals(1, failures.getHits());
    }
View Full Code Here

            assertEquals("Hello", newClient().getPage(testUrl).getWebResponse().getContentAsString());
        }
        assertEquals("Hello", newClient().getPage(testUrl + "?ignoredQuery=yes&ofcourse=itis").getWebResponse().getContentAsString());

        assertFalse(Repository.INSTANCE.counters().isEmpty());
        final Counter counter = Repository.INSTANCE.counters().iterator().next();
        assertEquals(Role.JSP, counter.getKey().getRole());
        assertEquals(url.getPath() + "test.jsp", counter.getKey().getName());
        assertEquals(3, counter.getHits());
    }
View Full Code Here

        bean.twoSeconds();

        container.stopApplicationScope();
        container.shutdownContainer();

        final Counter perf = Repository.INSTANCE.getCounter(new Counter.Key(Role.PERFORMANCES, type.getName() + ".twoSeconds"));
        assertNotNull(perf);
        assertEquals(2000, TimeUnit.NANOSECONDS.toMillis((int) perf.getMax()), 200);
    }
View Full Code Here

    @Test
    public void monitorRequest() throws IOException {
        final TextPage page = newClient().getPage(base.toExternalForm() + "hit");
        assertEquals(HttpURLConnection.HTTP_OK, page.getWebResponse().getStatusCode());

        final Counter hitCounter = Repository.INSTANCE.getCounter(new Counter.Key(Role.WEB, "/sirona-test/hit"));
        assertEquals(1, hitCounter.getHits());
    }
View Full Code Here

public class GraphiteTest extends GraphiteTestBase {
    @Test
    public void checkCountersAndGauges() throws InterruptedException {
        { // force some counter data
            final Counter counter = Repository.INSTANCE.getCounter(new Counter.Key(Role.PERFORMANCES, "test"));
            Thread.sleep(175);
            counter.add(1.4);
            counter.add(1.6);
            Thread.sleep(140);
            counter.add(2.3);
            counter.add(2.9);
            Thread.sleep(130);
        }

        { // counters
            final Collection<String> counters = extract(extract(messages(), "counter"), "counter"); // don't keep values
View Full Code Here

        assertEquals(1, Repository.INSTANCE.counters().size());

        final String name = "GET-/sirona-jaxrs2/api/service/{name}";
        assertEquals(name, Repository.INSTANCE.counters().iterator().next().getKey().getName());
        final Counter hitCounter = Repository.INSTANCE.getCounter(new Counter.Key(PerformanceServerFilter.ROLE, name));
        assertEquals(1, hitCounter.getHits());
    }
View Full Code Here

        assertEquals(1, Repository.INSTANCE.counters().size());

        final String name = "GET-/sirona-jaxrs2/api/service/{a}/{b}";
        assertEquals(name, Repository.INSTANCE.counters().iterator().next().getKey().getName());
        final Counter hitCounter = Repository.INSTANCE.getCounter(new Counter.Key(PerformanceServerFilter.ROLE, name));
        assertEquals(1, hitCounter.getHits());
    }
View Full Code Here

        assertEquals(1, Repository.INSTANCE.counters().size());

        final String name = "GET-/sirona-jaxrs2/api/service/{a}/{b}";
        assertEquals(name, Repository.INSTANCE.counters().iterator().next().getKey().getName());
        final Counter hitCounter = Repository.INSTANCE.getCounter(new Counter.Key(PerformanceServerFilter.ROLE, name));
        assertEquals(1, hitCounter.getHits());
    }
View Full Code Here

TOP

Related Classes of org.apache.sirona.counters.Counter$Key

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.