Package com.jitlogic.zorka.common.stats

Examples of com.jitlogic.zorka.common.stats.MethodCallStatistics


        statsCacheEnabled = !(0 != ((mbeanFlags | attrFlags) & HAS_OTHER_NAME));

        if (mbeanFlags == 0 && attrFlags == 0) {
            // Object name and attribute name are constant ...
            cachedStatistics = registry.getOrRegister(mbsName, mbeanTemplate, attrTemplate,
                    new MethodCallStatistics(), "Call stats");

            if (statFlags == 0) {
                cachedStatistic = cachedStatistics.getMethodCallStatistic(statTemplate);
            }
        }
View Full Code Here


        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;

                if (statistics == null) {
                    String mbeanName = subst(mbeanTemplate, record, ctx, mbeanFlags);
                    String attrName = subst(attrTemplate, record, ctx, attrFlags);
                    statistics = registry.getOrRegister(mbsName, mbeanName, attrName,
                            new MethodCallStatistics(), "Call stats");
                    if (statsCacheEnabled) {
                        statsCache.putIfAbsent(ctx, statistics);
                    }
                }
            }

            String key = statFlags != 0 ? subst(statTemplate, record, ctx, statFlags) : statTemplate;

            statistic = statistics.getMethodCallStatistic(key);
        }

        if (0 != (actions & ACTION_STATS)) {
            submit(record, statistic);
        }
View Full Code Here

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

        collector.process(record);

        MethodCallStatistics stats = (MethodCallStatistics) getAttr(testMbs, "test:name=Test", "stats");

        assertNotNull(stats.getStatistic("test"));
    }
View Full Code Here

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

        collector.process(record);

        MethodCallStatistics stats = (MethodCallStatistics) getAttr(testMbs, "test:name=Test", "stats");

        assertNotNull(stats.getStatistic("testMethod"));
    }
View Full Code Here

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

        collector.process(record);

        MethodCallStatistics stats = (MethodCallStatistics) getAttr(testMbs, "test:name=TClass", "stats");

        assertNotNull(stats.getStatistic("testMethod"));
    }
View Full Code Here

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

        collector.process(record);

        MethodCallStatistics stats = (MethodCallStatistics) getAttr(testMbs, "test:name=TClass", "stats");

        assertNotNull(stats.getStatistic("oja"));
    }
View Full Code Here

                null, ZorkaStatsCollector.ACTION_STATS);

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

        MethodCallStatistics stats = (MethodCallStatistics) getAttr(testMbs, "test:name=SomeBean", "stats");
        assertEquals(2, stats.getStatisticNames().length);
    }
View Full Code Here

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

        c1.process(rec);
        c2.process(rec);

        MethodCallStatistics stats = (MethodCallStatistics) getAttr(testMbs, "test:name=SomeBean", "stats");
        assertEquals(2L, ((MethodCallStatistic) stats.getStatistic("AAA")).getCalls());
    }
View Full Code Here

        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");
        assertEquals(600L, ((MethodCallStatistic) stats.getStatistic("AAA")).getThroughput());
        assertEquals(300L, ((MethodCallStatistic) stats.getStatistic("AAA")).getMaxThroughput());
    }
View Full Code Here


    @Test
    public void testDiscoveryZorkaStats() throws Exception {
        ZorkaMappedMBean mbean = new ZorkaMappedMBean("test");
        MethodCallStatistics stats = new MethodCallStatistics();
        mbean.put("stats", stats);

        testMbs.registerMBean(mbean, new ObjectName("test:type=ZorkaStats"));

        stats.getMethodCallStatistic("A").logCall(4L);
        stats.getMethodCallStatistic("B").logCall(1L);

        QueryDef query1 = zorka.query("test", "test:type=ZorkaStats", "type").get("stats").listAs("**", "PAR");
        Map<String, List<Map<String, String>>> obj1 = zabbixLib._discovery(query1);
        assertEquals("query with exact attrs should return data", 2, obj1.get("data").size());

View Full Code Here

TOP

Related Classes of com.jitlogic.zorka.common.stats.MethodCallStatistics

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.