Prometheus instrumentation library for Go applications


Prometheus Go client library

Build Status Go Report Card go-doc

This is the Go client library for Prometheus. It has two separate parts, one for instrumenting application code, and one for creating clients that talk to the Prometheus HTTP API.

This library requires Go1.9 or later. The minimum required patch releases for older Go versions are Go1.9.7 and Go1.10.3.

Important note about releases and stability

This repository generally follows Semantic Versioning. However, the API client in prometheus/client_golang/api/… is still considered experimental. Breaking changes of the API client will not trigger a new major release. The same is true for selected other new features explicitly marked as EXPERIMENTAL in

Features that require breaking changes in the stable parts of the repository are being batched up and tracked in the v2 milestone. The v2 development happens in a separate branch for the time being. v2 releases off that branch will happen once sufficient stability is reached. In view of the widespread use of this repository, v1 and v2 will coexist for a while to enable a convenient transition.

Instrumenting applications

code-coverage go-doc

The prometheus directory contains the instrumentation library. See the guide on the Prometheus website to learn more about instrumenting applications.

The examples directory contains simple examples of instrumented code.

Client for the Prometheus HTTP API

code-coverage go-doc

The api/prometheus directory contains the client for the Prometheus HTTP API. It allows you to write Go applications that query time series data from a Prometheus server. It is still in alpha stage.

Where is model, extraction, and text?

The model packages has been moved to prometheus/common/model.

The extraction and text packages are now contained in prometheus/common/expfmt.

Contributing and community

See the contributing guidelines and the Community section of the homepage.

  • Add timer helper function

    Add timer helper function

    @beorn7 we didn't discuss this at all so I'm not sure if I tested how you would like or even implemented the timer correctly, I just went off the API you described in #231

    opened by stuartnelson3 34
  • v1.12.0 exposes some high cardinality metrics

    v1.12.0 exposes some high cardinality metrics

    It seems that v1.12.0 includes some extra high cardinality metrics, most likely autogenerated by Go itself thanks to #955.

    Here's a full diff of metrics between 1.11 and 1.12 -

    Having so many extra metrics exposed by default might cause problems for people with lots of Go services.

    opened by prymitive 30
  • go1.11rc1 modules

    go1.11rc1 modules

    Looks like the v1 directory name is messing with go module's semantic import versioning.

    Note: I'm working outside of the GOPATH


    package main
    import (
    	_ ""
    func main() {}


    go get
    go1.10rc1 download
    go1.11rc1 mod init prom_thing
    go1.11rc1 build


    go: finding latest
    go: finding latest
    build prom_thing: cannot find module for path
    opened by icholy 29
  • Alert Manager API

    Alert Manager API

    This is a reboot of the 9 month old #263 PR. It builds on that work by adding the /status endpoint and reorganises the code so that it is a little DRYer and the package name matches the import path.

    Feedback welcome.

    opened by au-phiware 29
  • Feature Request: Permit histogram's Observe() method to take an observation count

    Feature Request: Permit histogram's Observe() method to take an observation count

    We had a case where we in theory update a histogram at some frequency. In actuality, we only update it when things are happening, and when nothing is happening, we just count the amount of time that has passed and then update it with that many ~zeros~ [edit: observations] when the next thing happens.

    Right now adding a value to a historgram N times takes N calls of Observe(). It would be very nice if we could pass N as a parameter instead, and if I follow the code, it could be done in constant time.

    opened by lavalamp 28
  • Create a public registry interface and separate out HTTP exposition

    Create a public registry interface and separate out HTTP exposition

    @grobie who might be most keen on this. @juliusv whom I gave a short preview in person. But then probably everybody else is interested, @fabxc , @brian-brazil , …

    General context and approch

    This is the first part of the long awaited wider refurbishment of client_golang/prometheus/.... After a lot of struggling, I decided to not go for one breaking big-bang, but cut things into smaller steps after all, mostly to keep the changes manageable and easy to review. I'm aiming for having the invasive breaking changes concentrated in as few steps as possible (ideally one). Some steps will not be breaking at all, but typically there will be breaking changes that only affect quite special cases so that 95+% of users will not be affected. This first step is an example for that, see details below.

    What's happening in this commit?

    This step is about finally creating an exported registry interface. This could not be done by simply export the existing internal implementation because the interface would be way too fat. This commit introduces a qutie lean Registry interface (compared to the previous interval implementation). The functions that act on the default registry are retained (with very few exceptions) so that most use cases won't see a change. However, several of those are deprecated now to clean up the namespace in the future.

    The default registry is kept in the public variable DefaultRegistry. This follows the example of the http package in the standard library (cf. http.DefaultServeMux, http.DefaultClient) with the same implications. (This pattern is somewhat disputed within the Go community but I chose to go with the devil you know instead of creating something more complex or even disallowing any changes to the default registry. The current approach gives everybody the freedom to not touch DefaultRegistry or to do everything with a custom registry to play save.)

    Another important part in making the registry lean is the extraction of the HTTP exposition, which also allows for customization of the HTTP exposition. Note that the separation of metric collection and exposition has the side effect that managing the MetricFamily and Metric protobuf objects in a free-list or pool isn't really feasible anymore. By now (with better GC in more recent Go versions), the returns were anyway dimisishing. To be effective at all, scrapes had to happen more often than GC cycles, and even then most elements of the protobufs (everything excetp the MetricFamily and Metric structs themselves) would still cause allocation churn. In a future breaking change, the signature of the Write method in the Metric interface will be adjusted accordingly. In this commit, avoiding breakage is more important.

    The following issues are fixed by this commit (some solved "on the fly" now that I was touching the code anyway and it would have been stupid to port the bugs): #46 #100 #170 #205

    Documentation including examples have been amended as required.

    What future changes does this commit enable?

    The following items are not yet implemented, but this commit opens the possibility of implementing these independently.

    • The separation of the HTTP exposition allows the implementation of other exposition methods based on the Registry interface, as known from other Prometheus client libraries, e.g. sending the metrics to Graphite. Cf. #197
    • The public Registry interface allows the implementation of convenience tools for testing metrics collection. Those tools can inspect the collected MetricFamily protobufs and compare them to expectation. Also, tests can use their own testing instance of a registry. Cf. #58

    Notable non-goals of this commit

    Non-goals that will be tackled later

    The following two issues are quite closely connected to the changes in this commit but the line has been drawn deliberately to address them in later steps of the refurbishment:

    • InstrumentHandler has many known problems. The plan is to create a saner way to conveniently intrument HTTP handlers and remove the old InstrumentHandler altogether. To keep breakage low for now, even the default handler to expose metrics is still using the old InstrumentHandler. This leads to weird naming inconsistencies but I have deemed it better to not break the world right now but do it in the change that provides better ways of instrumenting HTTP handlers. Cf. #200
    • There is work underway to make the whole handling of metric descriptors (Desc) more intuitive and transparent for the user (including an ability for less strict checking, cf. #47). That's quite invasive from the perspective of the internal code, namely the registry. I deliberately kept those changes out of this commit.
    • While this commit adds new external dependency, the effort to vendor anything within the library that is not visible in any exported types will have to be done later.

    Non-goals that might be tackled later

    There is a strong and understandable urge to divide the prometheus package into a number of sub-packages (like registry, collectors, http, metrics, …). However, to not run into a multitude of circular import chains, this would need to break every single existing usage of the library. (As just one example, if the ubiquitious prometheus.MustRegister (with more than 2,000 uses on GitHub alone) is kept in the prometheus package, but the other registry concerns go into a new registry package, then the prometheus package would import the registry package (to call the actual register method), while at the same time the registry package needs to import the prometheus package to access Collector, Metric, Desc and more. If we moved MustRegister into the registry package, thousands of code lines would have to be fixed (which would be easy if the world was a mono repo, but it is not). If we moved everything else the proposed registry package needs into packages of their own, we would break thousands of other code lines.)

    The main problem is really the top-level functions like MustRegister, Handler, …, which effectively pull everything into one package. Those functions are however very convenient for the easy and very frequent use-cases.

    This problem has to be revisited later.

    For now, I'm trying to keep the amount of exported names in the package as low as possible (e.g. I unexported expvarCollector in this commit because the NewExpvarCollector constructor is enough to export, and it is now consistent with other collectors, like the goCollector).

    Non-goals that won't be tackled anytime soon

    Something that I have played with a lot is "streaming collection", i.e. allow an implementation of the Registry interface that collects metrics incrementally and serves them while doing so. As it has turned out, this has many many issues and makes the Registry interface very clunky. Eventually, I made the call that it is unlikely we will really implement streaming collection; and making the interface more clunky for something that might not even happen is really a big no-no. Note that the Registry interface only creates the in-memory representation of the metric family protobufs in one go. The serializaton onto the wire can still be handled in a streaming fashion (which hasn't been done so far, without causing any trouble, but might be done in the future without breaking any interfaces).

    What are the breaking changes?

    • Signatures of functions pushing to Pushgateway have changed to allow arbitrary grouping (which was planned for a long time anyway, and now that I had to work on the Push code anyway for the registry refurbishment, I finally did it, cf. #100). With the gained insight that pushing to the default registry is almost never the right thing, and now that we are breaking the Push call anyway, all the Push functions were moved to their own package, which cleans up the namespace and is more idiomatic (pushing Collectors is now literally done by push.Collectors(...)).
    • The registry is doing more consistency checks by default now. Past creators of inconsistent metrics could have masked the problem by not setting EnableCollectChecks. Those inconsistencies will now be detected. (But note that a "best effort" metrics collection is now possible with HandlerOpts.ErrorHandling = ContinueOnError.)
    • EnableCollectChecks is gone. The registry is now performing some of those checks anyway (see previous item), and a registry with all of those checks can now be created with NewPedanticRegistry (only used for testing).
    • PanicOnCollectError is gone. This behavior can now be configured when creating a custom HTTP handler.

    This change is Reviewable

    opened by beorn7 27
  • api: reorganize API package and add label values endpoint implementation

    api: reorganize API package and add label values endpoint implementation

    This adds a client side implementation for fetching label values from prometheus api.

    Would love to get some review on this as this is my first contribution here. Some design questions i may have oversimplified:

    1. return a more descriptive value instead of []string? Maybe model.LabelValues?
    2. create a separated interface for metadata api(following the separation on the docs)?

    Related to #290.

    opened by andrestc 26
  • API client doesn't support POST method for Query/QueryRange

    API client doesn't support POST method for Query/QueryRange

    POST support was added to query/query_range API endpoints in prometheus with This client currently only sends GET requests, which means that it isn't won't work for large query string values. As the API stands today:

    Query(ctx context.Context, query string, ts time.Time) (model.Value, error)
    QueryRange(ctx context.Context, query string, r Range) (model.Value, error)

    There isn't really a place to put it, so I see a couple options:

    1. add a NewPOSTAPI method to return an httpAPI instance with a flag to use POST for both query and query_range (this would be done by setting an option in the httpAPI struct-- to be added).
    2. add QueryPost and QueryRangePost to the API interface
    3. add METHOD argument to Query and QueryRange

    I'm not sure what the compatibility guarantees are on this client interface, so I'm not sure how we want to proceed. I'm leaning towards 1 or 2 (probably in that order)

    cc @juliusv

    enhancement help wanted low hanging fruit 
    opened by jacksontj 25
  • new handler instrumentation

    new handler instrumentation

    The main premise is to provide some middleware that a user can compose as s/he wishes, instead of the "all or nothing" approach of the current InstrumentHandler() approach.

    Things to note:

    • This pr makes use of the Observer interface, and additionally adds an ObserverVec interface.
    • The ObserverVec interface was discussed with @beorn7 and necessitated a breaking change to SummaryVec and HistogramVec by changing the return types of their methods for interacting with labels. @beorn7 scanned code usage for this library and saw that while it is a breaking change, in practice he didn't find anyone using methods other than Observe() on the return type, which will not break based on this change. @beorn7 can you confirm this?
    • The tests fail because we are compiling against go-1.6 and go-1.7, while the code requires go-1.8 because of its use of http.Pusher.
    • Additional work needs to be done to check that this works with http/2.
    • The middleware does not register the collectors passed to them. This allows the user to a custom registery, as opposed to the default registry. This is decision is up for discussion.
    • If a user doesn't write an http status in their wrapped handler, our middleware will report the default value (0). If no status is written, go doesn't add a status until all handlers have been executed:
    opened by stuartnelson3 25
  • Consider using for compression

    Consider using for compression

    I have use client_golang to implement a subservice like pushgateway. Every 30s scrape 500k - 700k line metrics from one subservice. And it seems gzip cause very high cpu usage. image

    With this large data, gzip didn't make the request much more quick

    curl -w %{time_connect}:%{time_starttransfer}:%{time_total} -I -H 'Accept-Encoding: gzip' http://k4637v:6060/metrics HTTP/1.1 200 OK Content-Encoding: gzip Content-Length: 4935721 Content-Type: text/plain; version=0.0.4 Date: Wed, 17 Jan 2018 14:25:26 GMT


    curl -w %{time_connect}:%{time_starttransfer}:%{time_total} -I http://k4637v:6060/metrics HTTP/1.1 200 OK Content-Length: 70412653 Content-Type: text/plain; version=0.0.4 Date: Wed, 17 Jan 2018 14:25:52 GMT


    enhancement help wanted 
    opened by tinytub 22
  • Add storage.Warnings to client

    Add storage.Warnings to client


    This adds storage.Warnings to the error return of Query and QueryRange. Unfortunately the client.Do() method interface makes this a bit difficult to implement.

    So either we go down this path (where the specific error is a known type people should check for) or we need to change the Do() methods' interface to return a separate "warning" error.

    opened by jacksontj 21
  • What is the cost of calling the metrics endpoint?

    What is the cost of calling the metrics endpoint?

    What is the cost of calling the metrics endpoint?

    Does it calculate the value of the metrics when we call the endpoint or when the metrics are updated?

    opened by rodoufu 0
  • released tag v1.12.2 doesn't appear to exist on the main branch?

    released tag v1.12.2 doesn't appear to exist on the main branch?

    Whilst looking at a race condition on v1.12.2 I happened to notice that the release tag v1.12.2 doesn't exist on the main branch and appears to live on a release-1.12 branch that has diverged:

    Is that intentional?

    opened by dnwe 1
  • Add possibility to dynamically get label values for http instrumentation

    Add possibility to dynamically get label values for http instrumentation

    Signed-off-by: Quentin Devos [email protected]

    I need to partition the metrics generated by promhttp by the value coming in a specific header, and while I appreciate the design of promhttp is made to be simple and cover only the base use cases, it would be great if we could have a bit more of flexibility.

    It would also give a way to solve #491 elegantly while letting the user control the cardinality of the label they add.

    @bwplotka @kakkoyun

    opened by Okhoshi 0
  • Pushgateway support JWT Auth

    Pushgateway support JWT Auth

    Pushgateway supports basic auth, it's good but not enough. JWT is in common use when authenticating, I thought it should be added as the auth feature. If pleasure, I could implement it.

    opened by totorolee 0
  • Please expose `wrappingCollector` publicly

    Please expose `wrappingCollector` publicly

    We have a number of custom collectors that wrap other collectors - e.g. some cached value is periodically refreshed, where we want to collect metrics about the last refresh time, and also metrics about the value itself.

    Currently for the outer collector to add a label or metric to the inner collector, we either need to reimplement wrappingCollector ourselves, or we need to also apply the labels to the outer collector when it's registered using e.g. WrapRegistererWith, in turn leading to some ugly patterns like

    		r := prometheus.WrapRegistererWith(labels, prometheus.DefaultRegisterer)
    		defer r.Unregister(c)

    repeated for every collector with different labels.

    With a public wrappingCollector we could avoid this by either wrapping it at the layer between the outer and inner collector.

    opened by joewreschnig 0
  • v1.12.2(May 13, 2022)

    • [CHANGE] Added collectors.WithGoCollections that allows to choose what collection of Go runtime metrics user wants: Equivalent of MemStats structure configured using GoRuntimeMemStatsCollection, new based on dedicated runtime/metrics metrics represented by GoRuntimeMetricsCollection option, or both by specifying GoRuntimeMemStatsCollection | GoRuntimeMetricsCollection flag.
    • [CHANGE] :warning: Change in collectors.NewGoCollector metrics: Reverting addition of new ~80 runtime metrics by default. You can enable this back with GoRuntimeMetricsCollection option or GoRuntimeMemStatsCollection | GoRuntimeMetricsCollection for smooth transition.
    • [BUGFIX] Fixed the bug that causes generated histogram metric names to end with _total. ⚠️ This changes 3 metric names in the new Go collector that was reverted from default in this release.
      • go_gc_heap_allocs_by_size_bytes_total -> go_gc_heap_allocs_by_size_bytes,
      • go_gc_heap_frees_by_size_bytes_total -> go_gc_heap_allocs_by_size_bytes
      • go_gc_pauses_seconds_total -> go_gc_pauses_seconds.
    • [CHANCE] Removed -Inf buckets from new Go Collector histograms.

    Full Changelog:

    Source code(tar.gz)
    Source code(zip)
  • v1.11.1(Feb 15, 2022)

    • [SECURITY FIX] promhttp: Check validity of method and code label values (Addressed CVE-2022-21698)

    What's Changed

    • promhttp: Check validity of method and code label values by @bwplotka and @kakkoyun in

    Full Changelog:

    Source code(tar.gz)
    Source code(zip)
  • v1.12.1(Jan 29, 2022)

    • [BUGFIX] Make the Go 1.17 collector concurrency-safe #969
      • Use simpler locking in the Go 1.17 collector #975
    • [BUGFIX] Reduce granularity of histogram buckets for Go 1.17 collector #974
    • [ENHANCEMENT] API client: make HTTP reads more efficient #976

    Full Changelog:

    Source code(tar.gz)
    Source code(zip)
  • v1.12.0(Jan 19, 2022)

    • [CHANGE] example/random: Move flags and metrics into main() #935
    • [FEATURE] API client: Support wal replay status api #944
    • [FEATURE] Use the runtime/metrics package for the Go collector for 1.17+ #955
    • [ENHANCEMENT] API client: Update /api/v1/status/tsdb to include headStats #925
    • [SECURITY FIX] promhttp: Check validity of method and code label values #962 (Addressed CVE-2022-21698)

    What's Changed

    • Address minor issues on the changelog by @kakkoyun in
    • Synchronize common files from prometheus/prometheus by @prombot in
    • Update status badgets by @SuperQ in
    • Updating dependency versions + cleanup by @sivabalan in
    • Synchronize common files from prometheus/prometheus by @prombot in
    • add ExponentialBucketsRange function by @sbunce in
    • Synchronize common files from prometheus/prometheus by @prombot in
    • Update cespare/xxhash dependency by @dtrudg in
    • example/random: Move flags and metrics into main() by @beorn7 in
    • Fix typo by @gozeloglu in
    • Add support for go 1.17 by @mrueg in
    • Synchronize common files from prometheus/prometheus by @prombot in
    • Synchronize common files from prometheus/prometheus by @prombot in
    • API: support wal replay status api by @yeya24 in
    • Update /api/v1/status/tsdb to include headStats by @prymitive in
    • Use the runtime/metrics package for the Go collector for 1.17+ by @mknyszek in
    • promhttp: Check validity of method and code label values by @kakkoyun in
    • go.*: Update dependencies by @kakkoyun in

    New Contributors

    • @sivabalan made their first contribution in
    • @sbunce made their first contribution in
    • @dtrudg made their first contribution in
    • @gozeloglu made their first contribution in
    • @mrueg made their first contribution in
    • @prymitive made their first contribution in
    • @mknyszek made their first contribution in

    Full Changelog:

    Source code(tar.gz)
    Source code(zip)
  • v1.11.0(Jun 7, 2021)

    • [CHANGE] Add new collectors package. #862
    • [CHANGE] prometheus.NewExpvarCollector is deprecated, use collectors.NewExpvarCollector instead. #862
    • [CHANGE] prometheus.NewGoCollector is deprecated, use collectors.NewGoCollector instead. #862
    • [CHANGE] prometheus.NewBuildInfoCollector is deprecated, use collectors.NewBuildInfoCollector instead. #862
    • [FEATURE] Add new collector for database/sql#DBStats. #866
    • [FEATURE] API client: Add exemplars API support. #861
    • [ENHANCEMENT] API client: Add newer fields to Rules API. #855
    • [ENHANCEMENT] API client: Add missing fields to Targets API. #856

    What's Changed

    • Synchronize common files from prometheus/prometheus by @prombot in
    • Synchronize common files from prometheus/prometheus by @prombot in
    • Synchronize common files from prometheus/prometheus by @prombot in
    • Add newer fields to Rules API by @gouthamve in
    • Add missing fields to targets API by @yeya24 in
    • Synchronize common files from prometheus/prometheus by @prombot in
    • Add exemplars API support by @yeya24 in
    • Improve description of MaxAge in summary docs by @Dean-Coakley in
    • Add new collectors package by @johejo in
    • Add collector for database/sql#DBStats by @johejo in
    • Make dbStatsCollector more DRY by @beorn7 in
    • Change maintainers from @beorn7 to @bwplotka/@kakkoyun by @beorn7 in
    • Document implications of negative observations by @beorn7 in
    • Update Go modules by @SuperQ in

    New Contributors

    • @gouthamve made their first contribution in

    Full Changelog:

    Source code(tar.gz)
    Source code(zip)
  • v1.10.0(Mar 18, 2021)

    • [CHANGE] Minimum required Go version is now 1.13.
    • [CHANGE] API client: Add matchers to LabelNames and LabesValues. #828
    • [FEATURE] API client: Add buildinfo call. #841
    • [BUGFIX] Fix build on riscv64. #833

    What's Changed

    • Add by @roidelapluie in
    • Bump prometheus/procfs to 0.3.0 to fix building on riscv64 by @zhsj in
    • Fix typo in comments in
    • Support matchers in labels API by @yeya24 in
    • Add buildinfo method by @ntk148v in
    • Update dependencies by @beorn7 in
    • Synchronize common files from prometheus/prometheus by @prombot in
    • Cut v1.10.0 by @beorn7 in

    New Contributors

    • @zhsj made their first contribution in
    • @ntk148v made their first contribution in

    Full Changelog:

    Source code(tar.gz)
    Source code(zip)
  • v1.9.0(Dec 17, 2020)

    • [FEATURE] NewPidFileFn helper to create process collectors for processes whose PID is read from a file. #804
    • [BUGFIX] promhttp: Prevent endless loop in InstrumentHandler... middlewares with invalid metric or label names. #823

    What's Changed

    • add the NewPidFileFn to helper by @sbookworm in
    • Synchronize common files from prometheus/prometheus by @prombot in
    • Synchronize common files from prometheus/prometheus by @prombot in
    • Added example api code showing how to add auth tokens and user agents to prom client. by @bwplotka in
    • Correct spelling: possibilites -> possibilities by @jubalh in
    • Be more explicit about the multi-line properties of MultiError by @beorn7 in
    • promhttp: Correctly detect invalid metric and label names by @beorn7 in
    •  Cut release 1.9.0 by @beorn7 in

    New Contributors

    • @sbookworm made their first contribution in
    • @jubalh made their first contribution in

    Full Changelog:

    Source code(tar.gz)
    Source code(zip)
  • v1.8.0(Oct 15, 2020)

    • [CHANGE] API client: Use time.Time rather than string for timestamps in RuntimeinfoResult. #777
    • [FEATURE] Export MetricVec to facilitate implementation of vectors of custom Metric types. #803
    • [FEATURE API client: Support /status/tsdb endpoint. #773
    • [ENHANCEMENT] API client: Enable GET fallback on status code 501. #802
    • [ENHANCEMENT] Remove Metric references after reslicing to free up more memory. #784

    What's Changed

    • Add support for tsdb endpoint by @HimaVarsha94 in
    • Use time.Time for timestamps in Runtimeinfo by @mxey in
    • fix tests warning about string(int) type conversions by @johejo in
    • Update collector comment about GC stop-the-world by @roidelapluie in
    • Remove reference to Metric after reslicing by @hummerd in
    • Support go 1.15 by @roidelapluie in
    • Replace with the standard library constant. by @johncming in
    • Synchronize common files from prometheus/prometheus by @prombot in
    • Remove spurious commas from links to the docs site by @beorn7 in
    • API client: Enable fallback on status code 501, too by @beorn7 in
    • Export MetricVec (again) by @beorn7 in
    • Cut v1.8.0 by @beorn7 in

    New Contributors

    • @HimaVarsha94 made their first contribution in
    • @mxey made their first contribution in
    • @hummerd made their first contribution in
    • @johncming made their first contribution in

    Full Changelog:

    Source code(tar.gz)
    Source code(zip)
  • v1.7.1(Jun 23, 2020)

  • v1.7.0(Jun 17, 2020)

    • [CHANGE] API client: Add start/end parameters to LabelNames and LabelValues. #767
    • [FEATURE] testutil: Add GatherAndCount and enable filtering in CollectAndCount #753
    • [FEATURE] API client: Add support for status and runtimeinfo endpoints. #755
    • [ENHANCEMENT] Wrapping nil with a WrapRegistererWith... function creates a no-op Registerer. #764
    • [ENHANCEMENT] promlint: Allow Kelvin as a base unit for cases like color temperature. #761
    • [BUGFIX] push: Properly handle empty job and label values. #752
    Source code(tar.gz)
    Source code(zip)
  • v1.6.0(Apr 28, 2020)

    • [FEATURE] testutil: Add lint checks for metrics, including a sub-package promlint to expose the linter engine for external usage. #739 #743
    • [ENHANCEMENT] API client: Improve error messages. #731
    • [BUGFIX] process collector: Fix process_resident_memory_bytes on 32bit MS Windows. #734
    Source code(tar.gz)
    Source code(zip)
  • v1.5.1(Mar 14, 2020)

  • v1.5.0(Mar 3, 2020)

    • [FEATURE] promauto: Add a factory to allow automatic registration with a local registry. #713
    • [FEATURE] promauto: Add NewUntypedFunc. #713
    • [FEATURE] API client: Support new metadata endpoint. #718
    Source code(tar.gz)
    Source code(zip)
  • v1.4.1(Feb 7, 2020)

  • v1.4.0(Jan 27, 2020)

    • [CHANGE] Go collector: Improve doc string for go_gc_duration_seconds. #702
    • [FEATURE] Support a subset of OpenMetrics, including exemplars. Needs opt-in via promhttp.HandlerOpts. EXPERIMENTAL #706
    • [FEATURE] Add testutil.CollectAndCount. #703
    Source code(tar.gz)
    Source code(zip)
  • v1.3.0(Dec 20, 2019)

  • v1.2.1(Oct 17, 2019)

  • v1.2.0(Oct 15, 2019)

    • [FEATURE] Support pushing to Pushgateway v0.10+. #652
    • [ENHANCEMENT] Improve hashing to make a spurious AlreadyRegisteredError less likely to occur. #657
    • [ENHANCEMENT] API client: Add godoc examples. #630
    • [BUGFIX] promhttp: Correctly call WriteHeader in HTTP middleware. #634
    Source code(tar.gz)
    Source code(zip)
  • v1.1.0(Aug 1, 2019)

    • [CHANGE] API client: Format time as UTC rather than RFC3339Nano. #617
    • [CHANGE] API client: Add warnings to LabelValues and LabelNames calls. #609
    • [FEATURE] Push: Support base64 encoding in grouping key. #624
    • [FEATURE] Push: Add Delete method to Pusher. #613
    Source code(tar.gz)
    Source code(zip)
  • v1.0.0(Jun 15, 2019)

    This release removes all previously deprecated features, resulting in the breaking changes listed below. As this is v1.0.0, semantic versioning applies from now on, with the exception of the API client and parts marked explicitly as experimental.

    • [CHANGE] Remove objectives from the default Summary. (Objectives have to be set explicitly in the SummaryOpts.) #600
    • [CHANGE] Remove all HTTP related feature in the prometheus package. (Use the promhttp package instead.) #600
    • [CHANGE] Remove push.FromGatherer, push.AddFromGatherer, push.Collectors. (Use push.New instead.) #600
    • [CHANGE] API client: Pass warnings through on non-error responses. #599
    • [CHANGE] API client: Add warnings to Series call. #603
    • [FEATURE] Make process collector work on Microsoft Windows. EXPERIMENTAL #596
    • [FEATURE] API client: Add /labels call. #604
    • [BUGFIX] Make AlreadyRegisteredError usable for wrapped registries. #607
    Source code(tar.gz)
    Source code(zip)
  • v0.9.4(Jun 7, 2019)

    • [CHANGE] API client: Switch to alert values as strings. #585
    • [FEATURE] Add a collector for Go module build information. #595
    • [FEATURE] promhttp: Add an counter for internal errors during HTTP exposition. #594
    • [FEATURE] API client: Support target metadata API. #590
    • [FEATURE] API client: Support storage warnings. #562
    • [ENHANCEMENT] API client: Improve performance handling JSON. #570
    • [BUGFIX] Reduce test flakiness. #573
    Source code(tar.gz)
    Source code(zip)
  • v0.9.3(May 16, 2019)

    • [CHANGE] Required Go version is now 1.9+. #561
    • [FEATURE] API client: Add POST with get fallback for Query/QueryRange. #557
    • [FEATURE] API client: Add alerts endpoint. #552
    • [FEATURE] API client: Add rules endpoint. #508
    • [FEATURE] push: Add option to pick metrics format. #540
    • [ENHANCEMENT] Limit time the Go collector may take to collect memstats, returning results from the previous collection in case of a timeout. #568
    • [ENHANCEMENT] Pusher now requires only a thin interface instead of a full http.Client, facilitating mocking and custom HTTP client implementation. #559
    • [ENHANCEMENT] Memory usage improvement for histograms and summaries without objectives. #536
    • [ENHANCEMENT] Summaries without objectives are now lock-free. #521
    • [BUGFIX] promhttp: InstrumentRoundTripperTrace now takes into account a pre-set context. #582
    • [BUGFIX] TestCounterAddLarge now works on all platforms. #567
    • [BUGFIX] Fix promhttp examples. #535 #544
    • [BUGFIX] API client: Wait for done before writing to shared response body. #532
    • [BUGFIX] API client: Deal with discovered labels properly. #529
    Source code(tar.gz)
    Source code(zip)
  • v0.9.2(Dec 7, 2018)

    • [FEATURE] Support for Go modules. #501
    • [FEATURE] Timer.ObserveDuration returns observed duration. #509
    • [ENHANCEMENT] Improved doc comments and error messages. #504
    • [BUGFIX] Fix race condition during metrics gathering. #512
    • [BUGFIX] Fix testutil metric comparison for Histograms and empty labels. #494 #498
    Source code(tar.gz)
    Source code(zip)
  • v0.9.1(Nov 3, 2018)

    • [FEATURE] Add WriteToTextfile function to facilitate the creation of *.prom files for the textfile collector of the node exporter. #489
    • [ENHANCEMENT] More descriptive error messages for inconsistent label cardinality. #487
    • [ENHANCEMENT] Exposition: Use a GZIP encoder pool to avoid allocations in high-frequency scrape scenarios. #366
    • [ENHANCEMENT] Exposition: Streaming serving of metrics data while encoding. #482
    • [ENHANCEMENT] API client: Add a way to return the body of a 5xx response. #479
    Source code(tar.gz)
    Source code(zip)
  • v0.9.0(Oct 15, 2018)

    • [CHANGE] Go1.6 is no longer supported.
    • [CHANGE] More refinements of the Registry consistency checks: Duplicated labels are now detected, but inconsistent label dimensions are now allowed. Collisions with the “magic” metric and label names in Summaries and Histograms are detected now. #108 #417 #471
    • [CHANGE] Changed ProcessCollector constructor. #219
    • [CHANGE] Changed Go counter go_memstats_heap_released_bytes_total to gauge go_memstats_heap_released_bytes. #229
    • [CHANGE] Unexported LabelPairSorter. #453
    • [CHANGE] Removed the Untyped metric from direct instrumentation. #340
    • [CHANGE] Unexported MetricVec. #319
    • [CHANGE] Removed deprecated Set method from Counter #247
    • [CHANGE] Removed deprecated RegisterOrGet and MustRegisterOrGet. #247
    • [CHANGE] API client: Introduced versioned packages.
    • [FEATURE] A Registerer can be wrapped with prefixes and labels. #357
    • [FEATURE] “Describe by collect” helper function. #239
    • [FEATURE] Added package testutil. #58
    • [FEATURE] Timestamp can be explicitly set for const metrics. #187
    • [FEATURE] “Unchecked” collectors are possible now without cheating. #47
    • [FEATURE] Pushing to the Pushgateway reworked in package push to support many new features. (The old functions are still usable but deprecated.) #372 #341
    • [FEATURE] Configurable connection limit for scrapes. #179
    • [FEATURE] New HTTP middlewares to instrument http.Handler and http.RoundTripper. The old middlewares and the pre-instrumented /metrics handler are (strongly) deprecated. #316 #57 #101 #224
    • [FEATURE] “Currying” for metric vectors. #320
    • [FEATURE] A Summary can be created without quantiles. #118
    • [FEATURE] Added a Timer helper type. #231
    • [FEATURE] Added a Graphite bridge. #197
    • [FEATURE] Help strings are now optional. #460
    • [FEATURE] Added process_virtual_memory_max_bytes metric. #438 #440
    • [FEATURE] Added go_gc_cpu_fraction and go_threads metrics. #281 #277
    • [FEATURE] Added promauto package with auto-registering metrics. #385 #393
    • [FEATURE] Add SetToCurrentTime method to Gauge. #259
    • [FEATURE] API client: Add AlertManager, Status, and Target methods. #402
    • [FEATURE] API client: Add admin methods. #398
    • [FEATURE] API client: Support series API. #361
    • [FEATURE] API client: Support querying label values.
    • [ENHANCEMENT] Smarter creation of goroutines during scraping. Solves memory usage spikes in certain situations. #369
    • [ENHANCEMENT] Counters are now faster if dealing with integers only. #367
    • [ENHANCEMENT] Improved label validation. #274 #335
    • [BUGFIX] Creating a const metric with an invalid Desc returns an error. #460
    • [BUGFIX] Histogram observations don't race any longer with exposition. #275
    • [BUGFIX] Fixed goroutine leaks. #236 #472
    • [BUGFIX] Fixed an error message for exponential histogram buckets. #467
    • [BUGFIX] Fixed data race writing to the metric map. #401
    • [BUGFIX] API client: Decode JSON on a 4xx respons but do not on 204 responses. #476 #414
    Source code(tar.gz)
    Source code(zip)
  • v0.8.0(Aug 17, 2016)

    • [CHANGE] Registry is doing more consistency checks. This might break existing setups that used to export inconsistent metrics.
    • [CHANGE] Pushing to Pushgateway moved to package push and changed to allow arbitrary grouping.
    • [CHANGE] Removed SelfCollector.
    • [CHANGE] Removed PanicOnCollectError and EnableCollectChecks methods.
    • [CHANGE] Moved packages to the prometheus/common repo: text, model, extraction.
    • [CHANGE] Deprecated a number of functions.
    • [FEATURE] Allow custom registries. Added Registerer and Gatherer interfaces.
    • [FEATURE] Separated HTTP exposition, allowing custom HTTP handlers (package promhttp) and enabling the creation of other exposition mechanisms.
    • [FEATURE] MustRegister is variadic now, allowing registration of many collectors in one call.
    • [FEATURE] Added HTTP API v1 package.
    • [ENHANCEMENT] Numerous documentation improvements.
    • [ENHANCEMENT] Improved metric sorting.
    • [ENHANCEMENT] Inlined fnv64a hashing for improved performance.
    • [ENHANCEMENT] Several test improvements.
    • [BUGFIX] Handle collisions in MetricVec.
    Source code(tar.gz)
    Source code(zip)
  • 0.7.0(Jul 27, 2015)

    • [CHANGE] Rename ExporterLabelPrefix to ExportedLabelPrefix.
    • [BUGFIX] Closed gaps in metric consistency check.
    • [BUGFIX] Validate LabelName/LabelSet on JSON unmarshaling.
    • [ENHANCEMENT] Document the possibility to create "empty" metrics in a metric vector.
    • [ENHANCEMENT] Fix and clarify various doc comments and the
    • [ENHANCEMENT] - (Kind of) solve "The Proxy Problem" of http.InstrumentHandler.
    • [ENHANCEMENT] Change responseWriterDelegator.written to int64.
    Source code(tar.gz)
    Source code(zip)
  • 0.6.0(Jun 1, 2015)

    • [CHANGE] Rename process_goroutines to go_goroutines.
    • [ENHANCEMENT] Validate label names during YAML decoding.
    • [ENHANCEMENT] Add LabelName regular expression.
    • [BUGFIX] Ensure alignment of struct members for 32-bit systems.
    Source code(tar.gz)
    Source code(zip)
  • 0.5.0(May 6, 2015)

    • [BUGFIX] Removed a weakness in the fingerprinting aka signature code. This makes fingerprinting slower and more allocation-heavy, but the weakness was too severe to be tolerated.
    • [CHANGE] As a result of the above, Metric.Fingerprint is now returning a different fingerprint. To keep the same fingerprint, the new method Metric.FastFingerprint was introduced, which will be used by the Prometheus server for storage purposes (implying that a collision detection has to be added, too).
    • [ENHANCEMENT] The Metric.Equal and Metric.Before do not depend on fingerprinting anymore, removing the possibility of an undetected fingerprint collision.
    • [FEATURE] The Go collector in the exposition library includes garbage collection stats.
    • [FEATURE] The exposition library allows to create constant "throw-away" summaries and histograms.
    • [CHANGE] A number of new reserved labels and prefixes.
    Source code(tar.gz)
    Source code(zip)
  • 0.4.0(Apr 8, 2015)

    • [CHANGE] Return NaN when Summaries have no observations yet.
    • [BUGFIX] Properly handle Summary decay upon Write().
    • [BUGFIX] Fix the documentation link to the consumption library.
    • [FEATURE] Allow the metric family injection hook to merge with existing metric families.
    • [ENHANCEMENT] Removed cgo dependency and conditional compilation of procfs.
    • [MAINTENANCE] Adjusted to changes in matttproud/golang_protobuf_extensions.
    Source code(tar.gz)
    Source code(zip)
atomic measures + Prometheus exposition library

About Atomic measures with Prometheus exposition for the Go programming language. This is free and unencumbered software released into the public doma

Pascal S. de Kloe 22 Jun 10, 2022
An easy to use, extensible health check library for Go applications.

Try browsing the code on Sourcegraph! Go Health Check An easy to use, extensible health check library for Go applications. Table of Contents Example M

Claudemiro 431 May 31, 2022
A simple Cron library for go that can execute closures or functions at varying intervals, from once a second to once a year on a specific date and time. Primarily for web applications and long running daemons.

Cron.go This is a simple library to handle scheduled tasks. Tasks can be run in a minimum delay of once a second--for which Cron isn't actually design

Robert K 210 May 4, 2022
A tool to run queries in defined frequency and expose the count as prometheus metrics.

A tool to run queries in defined frequency and expose the count as prometheus metrics. Supports MongoDB and SQL

S Santhosh Nagaraj 18 Apr 21, 2022
Prometheus support for go-metrics

go-metrics-prometheus This is a reporter for the go-metrics library which will post the metrics to the prometheus client registry . It just updates th

Csergő Bálint 68 Jun 11, 2022
an unofficial prometheus exporter for the Hochwassernachrichtendienst Bayern.

Hochwassernachrichtendienst Exporter an unofficial prometheus exporter for the Hochwassernachrichtendienst Bayern. Usage Usage of ./hochwassernachrich

Maximilian Güntner 3 Mar 21, 2022
rsync wrapper (or output parser) that pushes metrics to prometheus

rsync-prom An rsync wrapper (or output parser) that pushes metrics to prometheus. This allows you to then build dashboards and alerting for your rsync

Michael Stapelberg 26 Jun 22, 2022
Prometheus exporter for Hue Sensors

Prometheus exporter for Hue Sensors This program allows you to gather generic metrics on all your Philips Hue sensors with Prometheus. Installation In

Reinier Schoof 1 Nov 17, 2021
In one particular project, i had to import some key/value data to Prometheus. So i have decided to create my custom-built Node Exporter in Golang.

In one particular project, i had to import some key/value data to Prometheus. So i have decided to create my custom-built Node Exporter in Golang.

Hamid Hosseinzadeh 1 May 19, 2022
Prometheus statistics exporter for Open vSwitch

Prometheus statistics exporter for Open vSwitch Open vSwitch is popular virutal switch that enables high performance software defined networking. Sinc

Ivan 0 Feb 18, 2022
An easy way to add useful startup banners into your Go applications

Try browsing the code on Sourcegraph! Banner Add beautiful banners into your Go applications Table of Contents Motivation Usage API Command line flags

Claudemiro 396 Jun 23, 2022
A simple wrapper to daemonize Go applications.

daemonigo A simple library to daemonize Go programming language applications. Installing $ go get After this command da

Kai Ren 39 May 15, 2022
Enable your Golang applications to self update with S3

s3update Enable your Golang applications to self update with S3. Requires Go 1.8+ This package enables our internal tools to be updated when new commi

Heetch 104 Jun 22, 2021
A BPMN engine, meant to be embedded in Go applications with minim hurdles, and a pleasant developer experience using it.

A BPMN engine, meant to be embedded in Go applications with minim hurdles, and a pleasant developer experience using it. This approach can increase transparency for non-developers.

Martin W. Kirst 32 Jun 26, 2022
A simple package to daemonize Go applications.

A simple package to daemonize Go applications.

Henrique Dias 0 Nov 13, 2021
Chaosblade executor for chaos experiments on Java applications

Chaosblade-exec-jvm: Chaosblade executor for chaos experiments on Java applications Introduction The project is a chaosblade executor based on jvm-san

null 332 Jun 22, 2022
Library to work with MimeHeaders and another mime types. Library support wildcards and parameters.

Mime header Motivation This library created to help people to parse media type data, like headers, and store and match it. The main features of the li

Anton Ohorodnyk 27 May 1, 2022
Evolutionary optimization library for Go (genetic algorithm, partical swarm optimization, differential evolution)

eaopt is an evolutionary optimization library Table of Contents Changelog Example Background Features Usage General advice Genetic algorithms Overview

Max Halford 791 Jun 15, 2022
cross-platform, normalized battery information library

battery Cross-platform, normalized battery information library. Gives access to a system independent, typed battery state, capacity, charge and voltag

null 204 Jun 6, 2022