Giter Site home page Giter Site logo

prome's Introduction

prome [Deprecated]

Go GoDoc Go Report Card

Deprecated. This repository has been merged into goutil.

Prometheus Client for easy use.

Why

I wrote this library so i can easily use it in my Go projects.

Features

  • Easy easy.
  • Provide basic Go runtime metrics.
  • Support gin middleware for providing API request counts and duration metrics.
  • Easy for developer to add custom metrics.

Usage

The simplest usage:

func main() {
	client := prome.NewClient("test", "/foo")
	if err := client.ListenAndServe(":9000"); err != nil {
		panic(err)
	}
}

Just include the code above already provides you the Go runtime metrics info. You can run curl "http://127.0.0.1:9000/foo" and get the prometheus data.

11:57 tmp โžœ  curl "http://127.0.0.1:9000/foo"
# HELP test_runtime_gomaxprocs Runtime GOMAXPROCS
# TYPE test_runtime_gomaxprocs gauge
test_runtime_gomaxprocs 4
# HELP test_runtime_memstats_alloc Runtime memstats alloc (Unit: byte)
# TYPE test_runtime_memstats_alloc gauge
test_runtime_memstats_alloc 1.346416e+06
# HELP test_runtime_memstats_last_gc Runtime memstats last GC pause (Unit: ns)
# TYPE test_runtime_memstats_last_gc gauge
test_runtime_memstats_last_gc 0
# HELP test_runtime_memstats_sys Runtime memstats sys (Unit: byte)
# TYPE test_runtime_memstats_sys gauge
test_runtime_memstats_sys 7.2827136e+07
# HELP test_runtime_num_cpu Runtime number of CPUs
# TYPE test_runtime_num_cpu gauge
test_runtime_num_cpu 4
# HELP test_runtime_num_goroutine Runtime number of goroutines
# TYPE test_runtime_num_goroutine gauge
test_runtime_num_goroutine 3
# HELP test_runtime_os_threads Runtime number of OS threads
# TYPE test_runtime_os_threads gauge
test_runtime_os_threads 7

Examples

You can get more examples in the examples directory to find more advenced usage.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.