Skip to content

Instantly share code, notes, and snippets.

View bernerdschaefer's full-sized avatar

Bernerd Schaefer bernerdschaefer

View GitHub Profile
$ ./prometheus
prometheus, version 9dde930 (feature/build-info-and-startup-friendliness)
build user: [email protected]
build date: 20130425-15:07:14
go version: 1.0.3
leveldb version: 1.9.0
protobuf version: 2.5.0
snappy version: 1.1.0
2013/04/25 15:21:51 Pool for job prometheus does not exist; creating and starting...
2013/04/25 15:21:51 All EndPoints for service [ MetricsService ] , registered under root path: /api/
// This callback accumulates the microsecond duration of the reporting
// framework's overhead such that it can be reported.
var requestLatencyAccumulator = func(began time.Time) {
microseconds := float64(time.Since(began) / time.Microsecond)
requestLatency.Add(nil, microseconds)
}
func (registry registry) Handler() http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
// This callback accumulates the microsecond duration of the reporting
// framework's overhead such that it can be reported.
var requestLatencyAccumulator CompletionCallback = func(duration time.Duration) {
microseconds := float64(duration / time.Microsecond)
requestLatency.Add(nil, microseconds)
}
func (registry registry) Handler() http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var (
scrapeInterval = flag.Duration("interval", 60 * time.Second, "Scrape interval")
)
// ...
tick := time.Tick(*scrapeInterval)
for {
select {
case conf = <-configChan:
build/
!Makefile
!.gitkeep
~/.../storage/metric > go test -v
warning: building out-of-date packages:
github.com/prometheus/prometheus/model/generated
github.com/prometheus/prometheus/model
github.com/prometheus/prometheus/storage/raw/index/leveldb
installing these packages with 'go test -i' will speed future tests.
=== RUN TestCurator
--- PASS: TestCurator (0.01 seconds)
=== RUN TestLevelDBGetFingerprintsForLabelSet
require 'queue'
# Simplified version of the pooling from datamapper's data_objects.
# https://github.com/datamapper/do/blob/master/data_objects/lib/data_objects/pooling.rb
class Moped::Session
class << self
alias new __new
end
@__pool_lock = Mutex.new
require 'queue'
module Rack
module Mongoid
module Middleware
class Sessions
def initialize(app)
@app = app
@sessions = Queue.new
@bernerdschaefer
bernerdschaefer / gist:3529920
Created August 30, 2012 14:45
A priority queue backed by a binary heap
{BinaryHeap} = require "binary-heap"
# A non-blocking priority queue, backed by a binary heap. Supports optional
# timeouts for pop() calls.
#
# An example:
# queue = new Queue (x, y) -> x.priority < y.priority
#
# queue.pop 0, (item) -> console.log('worker 1:', item.body)
# queue.pop 0, (item) -> console.log('worker 2:', item.body)
set nocompatible
syntax on
filetype on
filetype indent on
set directory=/tmp
set expandtab
set hidden
set history=1000