Skip to content

Instantly share code, notes, and snippets.

@reklis
Last active December 22, 2015 11:29
Show Gist options
  • Save reklis/6466034 to your computer and use it in GitHub Desktop.
Save reklis/6466034 to your computer and use it in GitHub Desktop.
A basic dashboard to view the results from the Node.js input
<body>
<div class="label">Current Real-Time Server Requests</div>
<div id="request-count">0</div>
<div class="total">Total:
<span id="total-request-count">0</span>
</div>
<div class="footnote">Powered by
<a href="http://brightcontext.com">BrightContext</a>
</div>
</body>
// using http://static.brightcontext.com/js-sdk/bcc.min.js
var
request_count = document.getElementById('request-count'),
total_count = document.getElementById('total-request-count')
;
BCC
.init('your api key here')
.project('www metrics') // your project name here
.feed({
channel: 'weblogs', // your channel name here
name: 'requestmetrics', // your output name here
onmsgreceived: function(output_feed, message_object) {
// onmsgreceived is fired every time the server pushes new calculations
request_count.textContent = message_object.requestCount;
total_count.textContent = message_object.totalCount;
}
})
;
body {
text-align: center;
font-family: Helvetica Neue, Helvetica, Arial, sans-serif;
color: #333;
}
.label {
font-size: 150%;
}
#request-count {
font-size: 300%;
font-weight: bold;
padding-top: 20px;
padding-bottom: 20px;
color: #eee;
background: #333;
display: inline-block;
padding: 40px;
margin: 50px;
}
.total {
font-style: italic;
}
#total-request-count, #request-count {
font-family: Monaco, Courier New, Courier, monospace;
}
.footnote {
position: fixed;
bottom: 0;
font-size: 80%;
padding-bottom: 20px;
width: 100%;
}
a {
color: #FF7A1C;
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment