Skip to content

Instantly share code, notes, and snippets.

@nicohaemhouts
Last active August 29, 2015 14:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nicohaemhouts/54f6673c3afb50caa88a to your computer and use it in GitHub Desktop.
Save nicohaemhouts/54f6673c3afb50caa88a to your computer and use it in GitHub Desktop.
CDS EventsPerSecond
{"description":"CDS EventsPerSecond","endpoint":"","display":"svg","public":true,"require":[],"fileconfigs":{"inlet.js":{"default":true,"vim":false,"emacs":false,"fontSize":12},"data.json":{"default":true,"vim":false,"emacs":false,"fontSize":12},"_.md":{"default":true,"vim":false,"emacs":false,"fontSize":12},"config.json":{"default":true,"vim":false,"emacs":false,"fontSize":12}},"fullscreen":false,"play":false,"loop":false,"restart":false,"autoinit":true,"pause":true,"loop_type":"pingpong","bv":false,"nclones":15,"clone_opacity":0.4,"duration":3000,"ease":"linear","dt":0.01,"ajax-caching":true,"thumbnail":"http://i.imgur.com/GtIjgye.png"}
[
{
"__v": 0,
"_id": "559e6c0bf8e842c65bf7e548",
"gauges": {
"itemMatchService": {
"dbOperationsPerSecond": 2000,
"eventsPerSecond": 0
},
"metrics": {
"numberOfEventsToMatch": 0,
"totalEmsEvtEvents": 425769273,
"totalEmsEvtItems": 301123953,
"totalInterchanges": 14248823
}
},
"timestamp": "2015-07-09T12:41:47.525Z"
},
{
"__v": 0,
"_id": "559e6adff8e842c65bf7e546",
"gauges": {
"itemMatchService": {
"dbOperationsPerSecond": 2000,
"eventsPerSecond": 1778
},
"metrics": {
"numberOfEventsToMatch": 0,
"totalEmsEvtEvents": 425769273,
"totalEmsEvtItems": 301123953,
"totalInterchanges": 14248823
}
},
"timestamp": "2015-07-09T12:36:47.686Z"
},
{
"__v": 0,
"_id": "559e6866bf74e5415b2c6b7d",
"gauges": {
"itemMatchService": {
"dbOperationsPerSecond": 1000,
"eventsPerSecond": 1173
},
"metrics": {
"numberOfEventsToMatch": 41481,
"totalEmsEvtEvents": 425769273,
"totalEmsEvtItems": 301123953,
"totalInterchanges": 14248823
}
},
"timestamp": "2015-07-09T12:26:14.723Z"
},
{
"__v": 0,
"_id": "559e673abf74e5415b2c6b7b",
"gauges": {
"itemMatchService": {
"dbOperationsPerSecond": 4000,
"eventsPerSecond": 0
},
"metrics": {
"numberOfEventsToMatch": 0,
"totalEmsEvtEvents": 425769273,
"totalEmsEvtItems": 301123953,
"totalInterchanges": 14248823
}
},
"timestamp": "2015-07-09T12:21:14.089Z"
},
{
"__v": 0,
"_id": "559e660ebf74e5415b2c6b79",
"gauges": {
"itemMatchService": {
"dbOperationsPerSecond": 4000,
"eventsPerSecond": 1468
},
"metrics": {
"numberOfEventsToMatch": 0,
"totalEmsEvtEvents": 425769273,
"totalEmsEvtItems": 301123953,
"totalInterchanges": 14248823
}
},
"timestamp": "2015-07-09T12:16:14.299Z"
},
{
"__v": 0,
"_id": "559e64e2bf74e5415b2c6b77",
"gauges": {
"itemMatchService": {
"dbOperationsPerSecond": 1000,
"eventsPerSecond": 0
},
"metrics": {
"numberOfEventsToMatch": 0,
"totalEmsEvtEvents": 425769273,
"totalEmsEvtItems": 301123953,
"totalInterchanges": 14248823
}
},
"timestamp": "2015-07-09T12:11:14.135Z"
},
{
"__v": 0,
"_id": "559e6375afb4770d5b83a63e",
"gauges": {
"itemMatchService": {
"dbOperationsPerSecond": 2000,
"eventsPerSecond": 889
},
"metrics": {
"numberOfEventsToMatch": 41885,
"totalEmsEvtEvents": 425769273,
"totalEmsEvtItems": 301123953,
"totalInterchanges": 14248823
}
},
"timestamp": "2015-07-09T12:05:09.444Z"
},
{
"__v": 0,
"_id": "559e6249afb4770d5b83a63c",
"gauges": {
"itemMatchService": {
"dbOperationsPerSecond": 1000,
"eventsPerSecond": 1098
},
"metrics": {
"numberOfEventsToMatch": 0,
"totalEmsEvtEvents": 425769273,
"totalEmsEvtItems": 301123953,
"totalInterchanges": 14248823
}
},
"timestamp": "2015-07-09T12:00:09.961Z"
},
{
"__v": 0,
"_id": "559e6120afb4770d5b83a63a",
"gauges": {
"itemMatchService": {
"dbOperationsPerSecond": 2500,
"eventsPerSecond": 0
},
"metrics": {
"numberOfEventsToMatch": 116550,
"totalEmsEvtEvents": 425769273,
"totalEmsEvtItems": 301123953,
"totalInterchanges": 14248823
}
},
"timestamp": "2015-07-09T11:55:12.236Z"
},
{
"__v": 0,
"_id": "559e5ff1afb4770d5b83a638",
"gauges": {
"itemMatchService": {
"dbOperationsPerSecond": 2500,
"eventsPerSecond": 0
},
"metrics": {
"numberOfEventsToMatch": 0,
"totalEmsEvtEvents": 425769273,
"totalEmsEvtItems": 301123953,
"totalInterchanges": 14248823
}
},
"timestamp": "2015-07-09T11:50:09.171Z"
}
]
var data = tributary.data.map(function (d) {
return {
timestamp: d.timestamp,
eventsPerSecond: d.gauges.itemMatchService.eventsPerSecond + 1
};
});
var width = 884,
height= 503,
padding = 0,
barWidth = width / data.length;
var chart = d3.select("svg")
.attr({
width: width,
height: height
})
.style({
padding : 0
});
var yScale = d3
.scale
.linear()
.range([height, 0])
.domain([0, d3.max(data, function (d) {
return d.eventsPerSecond;
})]);
var bar = chart.selectAll("g")
.data(data)
.enter()
.append("g")
.attr("transform", function (d, i) {
return "translate(" + i * barWidth + ",0)";
});
bar.append("rect")
.attr({
"y" :function (d) {
return yScale(d.eventsPerSecond);
},
"height": function (d) {
return height - yScale(d.eventsPerSecond);
},
"width" : barWidth -5
})
.style({
"fill": "rgba(174,0,52,1)"
});
bar.append("text")
.attr({
"x" : barWidth / 4,
"y" : function (d) {
return yScale(d.eventsPerSecond) + 5
},
"dy" : ".75em"
})
.style({
"fill" : "rgb(255,255,255)"
})
.text(function (d) {
return d.eventsPerSecond -1;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment