Package com.jitlogic.zorka.core.spy

Examples of com.jitlogic.zorka.core.spy.SpyContext


        MethodCallStatistic statistic = cachedStatistic;

        if (statistic == null) {

            MethodCallStatistics statistics = cachedStatistics;
            SpyContext ctx = (SpyContext) record.get(".CTX");

            if (statistics == null) {
                prefetch(record, ctx);

                statistics = statsCacheEnabled ? statsCache.get(ctx) : null;
View Full Code Here


    @Test
    public void testCollectToStatsMbeanWithoutPlaceholders() throws Exception {
        ZorkaStatsCollector collector = new ZorkaStatsCollector(mBeanServerRegistry, "test", "test:name=Test", "stats",
                "test", "T", null, ZorkaStatsCollector.ACTION_STATS);

        SpyContext ctx = new SpyContext(spy.instance("x"), "TClass", "testMethod", "()V", 1);

        Map<String, Object> record = ZorkaUtil.map(".CTX", ctx, ".STAGE", ON_SUBMIT, ".STAGES", (1 << ON_RETURN), "T", 10L);

        collector.process(record);
View Full Code Here

    @Test
    public void testCollectorToStatsMbeanWithMethodNamePlaceholder() throws Exception {
        ZorkaStatsCollector collector = new ZorkaStatsCollector(mBeanServerRegistry, "test", "test:name=Test", "stats",
                "${methodName}", "T", null, ZorkaStatsCollector.ACTION_STATS);

        SpyContext ctx = new SpyContext(spy.instance("x"), "TClass", "testMethod", "()V", 1);

        Map<String, Object> record = ZorkaUtil.map(".CTX", ctx, ".STAGE", ON_SUBMIT, ".STAGES", (1 << ON_RETURN), "T", 10L);

        collector.process(record);
View Full Code Here

    @Test
    public void testCollectoToStatsMbeanWithClassAndMethodNamePlaceholder() throws Exception {
        ZorkaStatsCollector collector = new ZorkaStatsCollector(mBeanServerRegistry, "test", "test:name=${shortClassName}",
                "stats", "${methodName}", "T", null, ZorkaStatsCollector.ACTION_STATS);

        SpyContext ctx = new SpyContext(spy.instance("x"), "some.TClass", "testMethod", "()V", 1);

        Map<String, Object> record = ZorkaUtil.map(".CTX", ctx, ".STAGE", ON_SUBMIT, ".STAGES", (1 << ON_RETURN), "T", 10L);

        collector.process(record);
View Full Code Here

    @Test
    public void testCollectToStatsWithKeyExpression() throws Exception {
        ZorkaStatsCollector collector = new ZorkaStatsCollector(mBeanServerRegistry, "test", "test:name=${shortClassName}",
                "stats", "${C1}", "T", null, ZorkaStatsCollector.ACTION_STATS);

        SpyContext ctx = new SpyContext(spy.instance("x"), "some.TClass", "testMethod", "()V", 1);

        Map<String, Object> record = ZorkaUtil.map(".CTX", ctx, ".STAGE", ON_SUBMIT, ".STAGES", (1 << ON_RETURN), "T", 10L, "C1", "oja");

        collector.process(record);
View Full Code Here

                null, ZorkaStatsCollector.ACTION_STATS);

        ZorkaStatsCollector c2 = new ZorkaStatsCollector(mBeanServerRegistry, "test", "test:name=SomeBean", "stats", "AAA", "T",
                null, ZorkaStatsCollector.ACTION_STATS);

        SpyContext ctx = new SpyContext(spy.instance("x"), "some.TClass", "testMethod", "()V", 1);
        Map<String, Object> rec = ZorkaUtil.map(".CTX", ctx, ".STAGE", ON_SUBMIT, ".STAGES", (1 << ON_RETURN), "T", 1L);

        c1.process(rec);
        c2.process(rec);
View Full Code Here

    @Test
    public void testThroughputCounting() throws Exception {
        ZorkaStatsCollector c1 = new ZorkaStatsCollector(mBeanServerRegistry, "test", "test:name=SomeBean",
                "stats", "AAA", "T", "LEN", ZorkaStatsCollector.ACTION_STATS);

        SpyContext ctx = new SpyContext(spy.instance("x"), "some.TClass", "testMethod", "()V", 1);
        c1.process(ZorkaUtil.<String, Object>map(".CTX", ctx, ".STAGE", ON_SUBMIT, ".STAGES", (1 << ON_RETURN), "T", 1L, "LEN", 100));
        c1.process(ZorkaUtil.<String, Object>map(".CTX", ctx, ".STAGE", ON_SUBMIT, ".STAGES", (1 << ON_RETURN), "T", 1L, "LEN", 300));
        c1.process(ZorkaUtil.<String, Object>map(".CTX", ctx, ".STAGE", ON_SUBMIT, ".STAGES", (1 << ON_RETURN), "T", 1L, "LEN", 200));

        MethodCallStatistics stats = (MethodCallStatistics) getAttr(testMbs, "test:name=SomeBean", "stats");
View Full Code Here

        this.attrChain = attrChain;
    }

    @Override
    public Map<String, Object> process(Map<String, Object> record) {
        SpyContext ctx = (SpyContext) record.get(".CTX");
        String mbeanName = ctx.subst(mbeanTemplate);
        String attrName = ctx.subst(attrTemplate);

        Object obj1 = new AttrGetter(record.get(srcField), attrChain);
        Object obj2 = registry.getOrRegister(mbsName, mbeanName, attrName, obj1, desc);

        if (!obj1.equals(obj2)) {
View Full Code Here

    @Test
    public void testSubmitWithImmediateFlagAndCheckIfCollected() throws Exception {
        SpyDefinition sdef = engine.add(
                spy.instance("x").onEnter(spy.fetchTime("E0"))).onSubmit(collector);
        SpyContext ctx = engine.lookup(new SpyContext(sdef, "com.TClass", "tMethod", "()V", 1));

        submitter.submit(ON_ENTER, ctx.getId(), SF_IMMEDIATE, new Object[]{1L});

        assertEquals(1, collector.size());
    }
View Full Code Here


    @Test
    public void testSubmitWithBufferAndFlush() throws Exception {
        SpyDefinition sdef = engine.add(spy.instrument("x").onSubmit(collector));
        SpyContext ctx = engine.lookup(new SpyContext(sdef, "Class", "method", "()V", 1));

        submitter.submit(ON_ENTER, ctx.getId(), SF_NONE, new Object[]{1L});
        assertEquals(0, collector.size());

        submitter.submit(ON_RETURN, ctx.getId(), SF_FLUSH, new Object[]{2L});
        assertEquals(1, collector.size());
    }
View Full Code Here

TOP

Related Classes of com.jitlogic.zorka.core.spy.SpyContext

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.