Package com.streamreduce.core.model

Examples of com.streamreduce.core.model.Metric


    public ObjectId objectId;

    @Before
    public void setUp() throws Exception {
        MetricDAO metricDao = new MetricDAO(messageDBDatastore);
        Key<Metric> key = metricDao.save(new Metric()
                .setAccountId(ACCOUNT_ID)
                .setName(MetricName.INVENTORY_ITEM_RESOURCE_USAGE.toString())
                .setType(MetricModeType.ABSOLUTE.toString())
                .setTs(System.currentTimeMillis())
                .setValue(48.12f)
View Full Code Here


    @Test
    public void testGet() throws Exception {
        Assert.assertNotNull(objectId);
        MetricDAO metricDao = new MetricDAO(messageDBDatastore);
        Metric metric = metricDao.get(objectId, ACCOUNT_ID);
        Assert.assertNotNull(metric);
        Assert.assertEquals(metric.getId(), objectId);
    }
View Full Code Here

    @Override
    public void process(Exchange exchange) throws Exception {
        String payload = exchange.getIn().getBody(String.class);
        JSONObject json = JSONObject.fromObject(payload);
        consumedCounter.inc();
        Metric metric = processPayload(json);
        exchange.getOut().setBody(metric);
    }
View Full Code Here

            account = (String) payload.get("account");
        }

        LOGGER.info("Received event {} from queue for account {}", consumedCounter.count(), account);

        Metric metric = null;
        try {
            metric = new Metric(payload);
            metricDAO.save(metric);
            processedCounter.inc();
        }
        catch (Exception e) {
            errorCounter.inc();
View Full Code Here

    }

    public Metric get(ObjectId id, String accountId) {
        DBCollection collection = getCollection(accountId);
        BasicDBObject result = (BasicDBObject) collection.findOne(new BasicDBObject("_id", id));
        return new Metric(result);
    }
View Full Code Here

TOP

Related Classes of com.streamreduce.core.model.Metric

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.