prombolt

package module
v0.0.0-...-dfcf01d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 5, 2016 License: MIT Imports: 3 Imported by: 4

README

prombolt Build Status GoDoc Report Card

Package prombolt provides a Prometheus metrics collector for Bolt databases. MIT Licensed.

Usage

Instrumenting your application's Bolt database using prombolt is trivial. Simply wrap the database handle using prombolt.New and register it with Prometheus.

const name = "prombolt.db"

db, err := bolt.Open(name, 0666, nil)
if err != nil {
	log.Fatal(err)
}

// Register prombolt handler with Prometheus
prometheus.MustRegister(prombolt.New(name, db))

mux := http.NewServeMux()
mux.Handle("/", newHandler(db))
// Attach Prometheus metrics handler
mux.Handle("/metrics", prometheus.Handler())

http.ListenAndServe(":8080", mux)

At this point, Bolt metrics should be available for Prometheus to scrape from the /metrics endpoint of your service.

$ curl -s http://localhost:8080/metrics | grep "bolt" | head -n 9
# HELP bolt_bucket_buckets Number of buckets within a bucket, including the top bucket.
# TYPE bolt_bucket_buckets gauge
bolt_bucket_buckets{bucket="foo",database="promboltd.db"} 1
# HELP bolt_bucket_depth Number of levels in B+ tree for a bucket.
# TYPE bolt_bucket_depth gauge
bolt_bucket_depth{bucket="foo",database="promboltd.db"} 1
# HELP bolt_bucket_inlined_buckets Number of inlined buckets for a bucket.
# TYPE bolt_bucket_inlined_buckets gauge
bolt_bucket_inlined_buckets{bucket="foo",database="promboltd.db"} 1

FAQ

Q: can prombolt provide metrics for nested/child buckets?

At this time, prombolt is unable to retrieve metrics for nested/child buckets, because Bolt does not currently provide functionality to iterate nested/child buckets within a parent bucket. See boltdb/bolt#603.

Documentation

Overview

Package prombolt provides a Prometheus metrics collector for Bolt databases.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(name string, db *bolt.DB) prometheus.Collector

New creates a new prometheus.Collector that can be registered with Prometheus to scrape metrics from a Bolt database handle.

Name should specify a unique name for the collector, and will be added as a label to all produced Prometheus metrics.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL