This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.dripstat.annotations; | |
import java.lang.annotation.ElementType; | |
import java.lang.annotation.Retention; | |
import java.lang.annotation.RetentionPolicy; | |
import java.lang.annotation.Target; | |
/** | |
* @author Prashant Deva | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.dripstat.annotations; | |
import java.lang.annotation.ElementType; | |
import java.lang.annotation.Retention; | |
import java.lang.annotation.RetentionPolicy; | |
import java.lang.annotation.Target; | |
/** | |
* @author Prashant Deva | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@TxnContainer("MyContainer") | |
public class HelloWorldContainer { | |
@Txn("hello") | |
public String getHello() { | |
return "hello, world"; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.dripstat.annotations; | |
import java.lang.annotation.ElementType; | |
import java.lang.annotation.Retention; | |
import java.lang.annotation.RetentionPolicy; | |
import java.lang.annotation.Target; | |
/** | |
* @author Prashant Deva | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.dripstat.annotations; | |
import java.lang.annotation.ElementType; | |
import java.lang.annotation.Retention; | |
import java.lang.annotation.RetentionPolicy; | |
import java.lang.annotation.Target; | |
/** | |
* @author Prashant Deva | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"schema": { | |
"dataSource": "dripstat", | |
"aggregators": [ | |
{ | |
"type": "count", | |
"name": "count" | |
}, | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.dripstat.billing.config.BillingConfig; | |
import net.billforward.exception.*; | |
import net.billforward.model.*; | |
import net.billforward.model.usage.Period; | |
import net.billforward.model.usage.Usage; | |
import net.billforward.model.usage.UsageSession; | |
import java.util.Date; | |
public class RealtimeUsagePriceCalculator |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static List<MultiDataPoint> convertValueResults(DruidValueResult[] results) | |
{ | |
Map<DateTime, List<DruidValueResult>> timeStampToResults = Arrays.stream(results) | |
.collect(groupingBy(r -> DateTime.parse(r.timestamp))); | |
List<MultiDataPoint> multiDataPoints = timeStampToResults.entrySet() | |
.stream() | |
.map(e -> new MultiDataPoint(e.getKey(), e.getValue().stream() | |
.collect(toMap(r -> r.event.name, r -> r.event.value)))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static Filter createFilterForAllTxns(String metricName, ObjectId appId) | |
{ | |
return new Filter() | |
.addAttribute("appid", appId.toString()) | |
.addTag(metricName); | |
} | |
Interval tempInterval = new Interval(interval.getStart(), interval.getEnd().plusSeconds(1)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static Map<Long, Long> multiDataPointsToPerTxnSummedValue(List<MultiDataPoint> countsList) | |
{ | |
Map<DateTime, Map<Long, Long>> timeStampToTxnIdToCountsMap = new HashMap<>(); | |
for (MultiDataPoint multiDataPoint : countsList) | |
{ | |
timeStampToTxnIdToCountsMap.put(multiDataPoint.getTimestamp(), convertToPerTxnData(multiDataPoint.getData())); | |
} | |
return timeStampToTxnIdToCountsMap.entrySet().stream() |