All Projects → pascaldekloe → metrics

pascaldekloe / metrics

Licence: CC0-1.0 license
atomic measures + Prometheus exposition library

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to metrics

egg-exporter
Egg.js 的 Prometheus 指标收集插件,附带 Grafana 看板。
Stars: ✭ 24 (+9.09%)
Mutual labels:  prometheus-exporter, metrics-exporter
macropower-analytics-panel
It's like Google Analytics, but for Grafana dashboards!
Stars: ✭ 16 (-27.27%)
Mutual labels:  prometheus-exporter
mq-java-exporter
Exporter for IBM MQ metrics https://prometheus.io/
Stars: ✭ 19 (-13.64%)
Mutual labels:  prometheus-exporter
cratedb-prometheus-adapter
CrateDB Prometheus Adapter
Stars: ✭ 53 (+140.91%)
Mutual labels:  prometheus-exporter
pika exporter
Prometheus expoter for Qihoo360/Pika metrics. Suppots Pika 2.x, 3.x
Stars: ✭ 39 (+77.27%)
Mutual labels:  prometheus-exporter
rpi exporter
A Raspberry Pi CPU temperature exporter.
Stars: ✭ 57 (+159.09%)
Mutual labels:  prometheus-exporter
prometheus-async
Async helpers for prometheus_client.
Stars: ✭ 136 (+518.18%)
Mutual labels:  prometheus-exporter
exportarr
AIO Prometheus Exporter for Sonarr, Radarr or Lidarr
Stars: ✭ 119 (+440.91%)
Mutual labels:  prometheus-exporter
planet-exporter
🚀 Determine server network dependencies along with required bandwidth
Stars: ✭ 17 (-22.73%)
Mutual labels:  prometheus-exporter
version exporter
Monitor the versions of the things you run and care about
Stars: ✭ 16 (-27.27%)
Mutual labels:  prometheus-exporter
ansible-prometheus
Ansible role for the management of Prometheus software and Prometheus exporters
Stars: ✭ 63 (+186.36%)
Mutual labels:  prometheus-exporter
radosgw usage exporter
Prometheus exporter for scraping Ceph RADOSGW usage data.
Stars: ✭ 34 (+54.55%)
Mutual labels:  prometheus-exporter
ansible-process exporter
Provision process exporter for prometheus monitoring tool
Stars: ✭ 16 (-27.27%)
Mutual labels:  prometheus-exporter
gethexporter
Monitor your Geth Ethereum Server with Prometheus and Grafana
Stars: ✭ 103 (+368.18%)
Mutual labels:  prometheus-exporter
exporter-toolkit
Utility package to build exporters
Stars: ✭ 139 (+531.82%)
Mutual labels:  prometheus-exporter
jmx exporter-cloudera-hadoop
Prometheus jmx_exporter configurations for Cloudera Hadoop
Stars: ✭ 33 (+50%)
Mutual labels:  prometheus-exporter
dex
Prometheus Docker EXporter
Stars: ✭ 19 (-13.64%)
Mutual labels:  prometheus-exporter
bamboo-prometheus-exporter
Prometheus Exporter For Bamboo
Stars: ✭ 18 (-18.18%)
Mutual labels:  prometheus-exporter
kannel exporter
Kannel exporter for Prometheus
Stars: ✭ 14 (-36.36%)
Mutual labels:  prometheus-exporter
bitnami-docker-mongodb-exporter
Bitnami Docker Image for MongoDB Exporter
Stars: ✭ 22 (+0%)
Mutual labels:  prometheus-exporter

API Build

About

Metrics are measures of quantitative assessment commonly used for comparing, and tracking performance or production. This library offers atomic counters, gauges and historgrams for the Go programming language. Users have the option to expose snapshots in the Prometheus text-format.

This is free and unencumbered software released into the public domain.

Use

Static regisration on package level comes recommened. The declarations also help to document the funcionality that is covered in the code.

// Package Metrics
var (
	ConnectCount = metrics.MustCounter("db_connects_total", "Number of established initiations.")
	CacheBytes   = metrics.MustInteger("db_cache_bytes", "Size of collective responses.")
	DiskUsage    = metrics.Must1LabelRealSample("db_disk_usage_ratio", "device")
)

Update methods operate error free by design, e.g., CacheBytes.Add(-72) or DiskUsage(dev.Name).Set(1 - dev.Free, time.Now()).

Serve HTTP with just http.HandleFunc("/metrics", metrics.ServeHTTP).

< HTTP/1.1 200 OK
< Content-Type: text/plain;version=0.0.4
< Date: Sun, 07 Mar 2021 15:22:47 GMT
< Content-Length: 351
< 
# Prometheus Samples

# TYPE db_connects_total counter
# HELP db_connects_total Number of established initiations.
db_connects_total 4 1615130567389

# TYPE db_cache_bytes gauge
# HELP db_cache_bytes Size of collective responses.
db_cache_bytes 7600 1615130567389

# TYPE db_disk_usage_ratio gauge
db_disk_usage_ratio{device="sda"} 0.19 1615130563595

Package github.com/pascaldekloe/metrics/gostat provides a standard collection of Go metrics which is similar to the setup as provided by the original Prometheus library.

Samples may be fetched in a lazy manner, like how the lazy example does.

Performance

The following benchmarks were measured on a Intel(R) Core(TM) i5-7500 CPU @ 3.40GHz.

name                          time/op
Label/sequential/4-4            22.2ns ± 1%
Label/sequential/4x4-4          25.9ns ± 1%
Label/sequential/4x4x4-4        42.2ns ± 1%
Label/parallel/4-4              45.9ns ± 0%
Label/parallel/4x4-4            50.8ns ± 1%
Label/parallel/4x4x4-4          71.7ns ± 1%
Get/histogram5/sequential-4     89.1ns ± 0%
Get/histogram5/2routines-4       112ns ± 2%
Set/real/sequential-4           6.74ns ± 0%
Set/real/2routines-4            14.8ns ± 4%
Set/sample/sequential-4         18.6ns ± 6%
Set/sample/2routines-4          22.2ns ± 1%
Add/counter/sequential-4        6.75ns ± 0%
Add/counter/2routines-4         21.2ns ± 1%
Add/integer/sequential-4        6.75ns ± 0%
Add/integer/2routines-4         21.2ns ± 1%
Add/histogram5/sequential-4     37.9ns ± 0%
Add/histogram5/2routines-4      85.9ns ± 1%
ServeHTTP/32/counter-4          1.11µs ± 0%
ServeHTTP/32/real-4             2.24µs ± 1%
ServeHTTP/32/integer-4          1.13µs ± 1%
ServeHTTP/32/histogram5-4       9.85µs ± 0%
ServeHTTP/32/label5-4           2.73µs ± 1%
ServeHTTP/32/label2x3x5-4       2.79µs ± 2%
ServeHTTP/32/sample-4           2.70µs ± 1%
ServeHTTP/1024/counter-4        32.1µs ± 1%
ServeHTTP/1024/real-4           62.5µs ± 2%
ServeHTTP/1024/integer-4        32.6µs ± 1%
ServeHTTP/1024/histogram5-4      303µs ± 1%
ServeHTTP/1024/label5-4         76.3µs ± 4%
ServeHTTP/1024/label2x3x5-4     75.8µs ± 3%
ServeHTTP/1024/sample-4         77.7µs ± 3%
ServeHTTP/32768/counter-4       1.18ms ± 1%
ServeHTTP/32768/real-4          2.15ms ± 1%
ServeHTTP/32768/integer-4       1.20ms ± 4%
ServeHTTP/32768/histogram5-4    13.9ms ± 2%
ServeHTTP/32768/label5-4        2.99ms ± 1%
ServeHTTP/32768/label2x3x5-4    2.90ms ± 4%
ServeHTTP/32768/sample-4        2.70ms ± 6%

name                          alloc/op
Label/sequential/4-4             0.00B     
Label/sequential/4x4-4           0.00B     
Label/sequential/4x4x4-4         0.00B     
Label/parallel/4-4               0.00B     
Label/parallel/4x4-4             0.00B     
Label/parallel/4x4x4-4           0.00B     
Get/histogram5/sequential-4      0.00B     
Get/histogram5/2routines-4       0.00B     
Set/real/sequential-4            0.00B     
Set/real/2routines-4             0.00B     
Set/sample/sequential-4          0.00B     
Set/sample/2routines-4           0.00B     
Add/counter/sequential-4         0.00B     
Add/counter/2routines-4          0.00B     
Add/integer/sequential-4         0.00B     
Add/integer/2routines-4          0.00B     
Add/histogram5/sequential-4      0.00B     
Add/histogram5/2routines-4       0.00B     
ServeHTTP/32/counter-4            560B ± 0%
ServeHTTP/32/real-4               512B ± 0%
ServeHTTP/32/integer-4            560B ± 0%
ServeHTTP/32/histogram5-4       1.19kB ± 0%
ServeHTTP/32/label5-4             560B ± 0%
ServeHTTP/32/label2x3x5-4         752B ± 0%
ServeHTTP/32/sample-4             512B ± 0%
ServeHTTP/1024/counter-4          560B ± 0%
ServeHTTP/1024/real-4             560B ± 0%
ServeHTTP/1024/integer-4          560B ± 0%
ServeHTTP/1024/histogram5-4     1.19kB ± 0%
ServeHTTP/1024/label5-4           560B ± 0%
ServeHTTP/1024/label2x3x5-4       576B ± 0%
ServeHTTP/1024/sample-4           560B ± 0%
ServeHTTP/32768/counter-4         565B ± 0%
ServeHTTP/32768/real-4            569B ± 0%
ServeHTTP/32768/integer-4         565B ± 0%
ServeHTTP/32768/histogram5-4    1.26kB ± 0%
ServeHTTP/32768/label5-4          573B ± 0%
ServeHTTP/32768/label2x3x5-4      588B ± 0%
ServeHTTP/32768/sample-4          571B ± 0%

name                          allocs/op
Label/sequential/4-4              0.00     
Label/sequential/4x4-4            0.00     
Label/sequential/4x4x4-4          0.00     
Label/parallel/4-4                0.00     
Label/parallel/4x4-4              0.00     
Label/parallel/4x4x4-4            0.00     
Get/histogram5/sequential-4       0.00     
Get/histogram5/2routines-4        0.00     
Set/real/sequential-4             0.00     
Set/real/2routines-4              0.00     
Set/sample/sequential-4           0.00     
Set/sample/2routines-4            0.00     
Add/counter/sequential-4          0.00     
Add/counter/2routines-4           0.00     
Add/integer/sequential-4          0.00     
Add/integer/2routines-4           0.00     
Add/histogram5/sequential-4       0.00     
Add/histogram5/2routines-4        0.00     
ServeHTTP/32/counter-4            5.00 ± 0%
ServeHTTP/32/real-4               5.00 ± 0%
ServeHTTP/32/integer-4            5.00 ± 0%
ServeHTTP/32/histogram5-4         10.0 ± 0%
ServeHTTP/32/label5-4             5.00 ± 0%
ServeHTTP/32/label2x3x5-4         6.00 ± 0%
ServeHTTP/32/sample-4             5.00 ± 0%
ServeHTTP/1024/counter-4          5.00 ± 0%
ServeHTTP/1024/real-4             5.00 ± 0%
ServeHTTP/1024/integer-4          5.00 ± 0%
ServeHTTP/1024/histogram5-4       10.0 ± 0%
ServeHTTP/1024/label5-4           5.00 ± 0%
ServeHTTP/1024/label2x3x5-4       5.00 ± 0%
ServeHTTP/1024/sample-4           5.00 ± 0%
ServeHTTP/32768/counter-4         5.00 ± 0%
ServeHTTP/32768/real-4            5.00 ± 0%
ServeHTTP/32768/integer-4         5.00 ± 0%
ServeHTTP/32768/histogram5-4      10.0 ± 0%
ServeHTTP/32768/label5-4          5.00 ± 0%
ServeHTTP/32768/label2x3x5-4      5.00 ± 0%
ServeHTTP/32768/sample-4          5.00 ± 0%

name                          speed
ServeHTTP/32/counter-4        1.75GB/s ± 0%
ServeHTTP/32/real-4            754MB/s ± 1%
ServeHTTP/32/integer-4        1.67GB/s ± 1%
ServeHTTP/32/histogram5-4      878MB/s ± 0%
ServeHTTP/32/label5-4          889MB/s ± 1%
ServeHTTP/32/label2x3x5-4     1.14GB/s ± 2%
ServeHTTP/32/sample-4          625MB/s ± 1%
ServeHTTP/1024/counter-4      2.03GB/s ± 1%
ServeHTTP/1024/real-4          914MB/s ± 2%
ServeHTTP/1024/integer-4      1.94GB/s ± 1%
ServeHTTP/1024/histogram5-4    946MB/s ± 1%
ServeHTTP/1024/label5-4       1.06GB/s ± 4%
ServeHTTP/1024/label2x3x5-4   1.38GB/s ± 3%
ServeHTTP/1024/sample-4        735MB/s ± 3%
ServeHTTP/32768/counter-4     1.92GB/s ± 1%
ServeHTTP/32768/real-4         929MB/s ± 1%
ServeHTTP/32768/integer-4     1.83GB/s ± 4%
ServeHTTP/32768/histogram5-4   690MB/s ± 2%
ServeHTTP/32768/label5-4       921MB/s ± 1%
ServeHTTP/32768/label2x3x5-4  1.21GB/s ± 4%
ServeHTTP/32768/sample-4       742MB/s ± 5%
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].