Commit Graph

512 Commits

Author SHA1 Message Date
beorn7 70253f4dd0 Fix typo in doc comment
Signed-off-by: beorn7 <beorn@grafana.com>
2022-01-11 14:07:18 +01:00
beorn7 5b19c553c3 Merge branch 'master' into sparsehistogram 2022-01-11 14:01:38 +01:00
Manuel Rüger 8535b62021 Add new go:build lines for go 1.17
Signed-off-by: Manuel Rüger <manuel@rueg.eu>
2021-12-17 23:38:35 +01:00
Gökhan Özeloğlu 55320aa8b0 Fix typo
Signed-off-by: Gökhan Özeloğlu <gozeloglu@gmail.com>
2021-11-25 11:21:10 +03:00
beorn7 263be8dab7 Refactoring of sparse histograms
Signed-off-by: beorn7 <beorn@grafana.com>
2021-09-01 01:26:06 +02:00
beorn7 24099603bc Implement strategy to limit the sparse bucket count
Signed-off-by: beorn7 <beorn@grafana.com>
2021-08-31 13:28:27 +02:00
beorn7 84fcafffb1 Merge branch 'master' into sparsehistogram 2021-08-18 16:41:04 +02:00
Seth Bunce 2261d5cda1
add ExponentialBucketsRange function (#899)
This function calculates exponential buckets with different arguments
than the existing ExponentialBuckets function. Instead of specifying the
start and factor, the user can specify the min and max bucket value. We
have been doing it this way internally at my company for some time.

Signed-off-by: Seth Bunce <seth.bunce@getcruise.com>
2021-08-12 16:56:44 +01:00
beorn7 9ef5f90a76 Allow a zero threshold of zero
Signed-off-by: beorn7 <beorn@grafana.com>
2021-07-20 19:01:13 +02:00
beorn7 aa6f67a9e6 Add TODO about bucket search optimization
Signed-off-by: beorn7 <beorn@grafana.com>
2021-06-29 14:52:37 +02:00
beorn7 6c4e0ef740 Add tests for sparse histogram
Signed-off-by: beorn7 <beorn@grafana.com>
2021-06-23 21:56:26 +02:00
beorn7 31318b7523 Switch to base-2 buckets
This seem what OTel is converging towards, see
https://github.com/open-telemetry/oteps/pull/149 .

I see pros and cons with base-10 vs base-2. They are discussed in
detail in that OTel PR, and the gist of the discussion is pretty much
in line with my design doc. Since the balance is easy to tip here, I
think we should go with base-2 if OTel picks base-2. This also seems
to be in agreement with several proprietary solution (see again the
discussion on that OTel PR.)

The idea to make the number of buckets per power of 2 (or formerly 10)
a power of 2 itself was also sketched out in the design doc
already. It guarantees mergeability of different resolutions. I was
undecided between making it a recommendation or mandatory. Now I think
it should be mandatory as it has the additional benefit of playing
well with OTel's plans.

This commit also addresses a number of outstanding TODOs.

Signed-off-by: beorn7 <beorn@grafana.com>
2021-06-23 16:48:03 +02:00
SuperQ 6d946b5526
Update status badgets
Update to new locations
* Switch to CircleCI build badge.
* Use new pkg.go.dev for docs.

Signed-off-by: SuperQ <superq@gmail.com>
2021-06-23 10:12:43 +02:00
beorn7 5aa8534cd0 Merge branch 'master' into sparsehistogram 2021-06-11 14:58:43 +02:00
beorn7 f34145a85e Document implications of negative observations
Signed-off-by: beorn7 <beorn@grafana.com>
2021-05-26 23:41:30 +02:00
beorn7 81a9556c8b Make dbStatsCollector more DRY
Signed-off-by: beorn7 <beorn@grafana.com>
2021-05-20 22:31:53 +02:00
Mitsuo Heijo a66da1df4a
Add collector for database/sql#DBStats (#866)
* Add collector for database/sql#DBStats

Signed-off-by: Mitsuo Heijo <mitsuo.heijo@gmail.com>
2021-05-20 22:22:17 +02:00
Mitsuo Heijo e07445a773
Add new collectors package
Signed-off-by: Mitsuo Heijo <mitsuo.heijo@gmail.com>
2021-05-08 10:43:31 +09:00
Dean Coakley 3998a677f9
Improve description of MaxAge in summary docs (#864)
* Improve description of MaxAge in summary docs

Signed-off-by: Dean Coakley <dean.s.coakley@gmail.com>
2021-05-04 15:58:41 +02:00
beorn7 553ed73917 Fix lint warning
Signed-off-by: beorn7 <beorn@grafana.com>
2021-05-03 16:58:07 +02:00
beorn7 b7a540a1b2 Fix test
Signed-off-by: beorn7 <beorn@grafana.com>
2021-05-03 16:09:28 +02:00
beorn7 d6983369d2 Merge branch 'master' into beorn7/histogram 2021-04-03 17:28:55 +02:00
beorn7 e92283d644 Fix linter ignores
Signed-off-by: beorn7 <beorn@grafana.com>
2021-03-16 17:19:03 +01:00
beorn7 6635a8f35b Bump minumim required Go version to 1.13
Since 1.16 is out, we still support the last four minor releases.

The bump was required by the prometheus/procfs package using the new
`%w` printf directives. However, it also allows us to remove some
special casing about build info.

Signed-off-by: beorn7 <beorn@grafana.com>
2021-03-11 20:45:00 +01:00
debiandebiandebian 9443f4449b Fix typo in comments
Signed-off-by: debiandebiandebian <debiandebiandebiandebian@gmail.com>
2021-02-08 08:58:51 +09:00
beorn7 08104a0ef9 Minor doc comment fixes
Signed-off-by: beorn7 <beorn@grafana.com>
2021-01-29 22:24:27 +01:00
beorn7 98eb6cbf7c promhttp: Correctly detect invalid metric and label names
Without this fix, the `InstrumentHandler...` middlewares get locked in
an endless loop in case of an invalid Collector, eating all the memory.

Signed-off-by: beorn7 <beorn@grafana.com>
2020-12-09 17:58:53 +01:00
beorn7 34ca120377 Be more explicit about the multi-line properties of MultiError
Signed-off-by: beorn7 <beorn@grafana.com>
2020-12-02 19:53:38 +01:00
Michael Vetter cf6dc82780 Correct spelling: possibilites -> possibilities
Signed-off-by: Michael Vetter <jubalh@iodoru.org>
2020-12-01 21:20:26 +01:00
sbookworm 469ec2747b add the NewPidFileFn to helper
Signed-off-by: sbookworm <lisong.cruise@gmail.com>
2020-10-23 09:23:59 +08:00
beorn7 85aa957f63 Export MetricVec (again)
MetricVec was already exported in early versions of this library, but
nobody really used it to implement vectors of custom Metric
implementations. Now #796 has shown up with a fairly special use case
for which I'd prefer a custom implementation of a special
"auto-sampling histogram" outside of this library. Therefore, I'd like
to reinstate support for creating vectors of custom Metric
implementations.

I played around for quite some while with the option of a separate
package providing the tools one would need to create vectors of custom
Metric implementations. However, with the current structure of the
prometheus/client_golang/prometheus package, this leads to a lot of
complications with circular dependencies. (The new package would need
the primitives from the prometheus package, while the existing metric
vectors like GaugeVec need to import the new vector package to not
duplicate the implementation. Separating vector types from the main
prometheus package is out of the question at this point because that
would be a breaking change.)

Signed-off-by: beorn7 <beorn@grafana.com>
2020-10-15 14:32:54 +02:00
beorn7 b54b73c7b1 Remove spurious commas from links to the docs site
I assume older Nanoc versions rendered the anchors with commas, but
the current doesn't.

Also, this adds the same link to another doc comment where it is also
relevant.

Signed-off-by: beorn7 <beorn@grafana.com>
2020-09-07 22:31:29 +02:00
Björn Rabenstein c650ae9fa1
Merge pull request #784 from hummerd/master
Remove reference to Metric after reslicing
2020-07-25 00:01:35 +02:00
Björn Rabenstein 77b35d0377
Merge pull request #783 from roidelapluie/gc15
Update collector comment about GC stop-the-world
2020-07-24 23:48:32 +02:00
Dima Kozlov 0c48254b62 remove reference to metrics after reslicing
Signed-off-by: Dima Kozlov <hummerd@mail.ru>
2020-07-22 23:12:23 +03:00
Julien Pivotto 4759649876 Update collector comment about GC stop-the-world
Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2020-07-22 01:42:37 +02:00
Mitsuo Heijo 916659fee0 fix tests warning about string(int) type conversions
See https://github.com/golang/go/issues/32479

Signed-off-by: Mitsuo Heijo <mitsuo.heijo@gmail.com>
2020-07-06 21:19:31 +09:00
Mark Hansen 7687ac2137 histogram.go: fix copy/paste typo
This method calls NewConstHistogram.

Signed-off-by: Mark Hansen <mark@markhansen.co.nz>
2020-06-21 13:47:29 +10:00
Tom Wilkie 9c8ba1f945 Review feedback: add comment and tests for WrapRegistererWith.
Signed-off-by: Tom Wilkie <tom.wilkie@gmail.com>
2020-06-04 11:51:51 +01:00
Tom Wilkie 614377c550 Review feedback: use one line.
Signed-off-by: Tom Wilkie <tom.wilkie@gmail.com>
2020-06-04 10:57:40 +01:00
Tom Wilkie 8961609f91 Ensure that nil registers are treat as a no-op, even when wrapping.
Signed-off-by: Tom Wilkie <tom.wilkie@gmail.com>
2020-06-04 10:30:51 +01:00
beorn7 3ba240a80f Improve doc comments in promauto
In particular, point out that `With(nil)` is valid.

Signed-off-by: beorn7 <beorn@grafana.com>
2020-06-03 13:56:49 +02:00
Matt Layher 3afa5ab1e1
testutil/promlint: allow Kelvin as a base unit for color temperature
Signed-off-by: Matt Layher <mdlayher@gmail.com>
2020-05-28 11:54:54 -04:00
Björn Rabenstein bff02dd561
Merge pull request #754 from prometheus/beorn7/deprecation
Add lint:ignore for protobuf deprecation
2020-05-18 15:31:02 +02:00
Björn Rabenstein d8b51d4981
Merge pull request #753 from prometheus/beorn7/test
Improve CollectAndCount
2020-05-15 13:19:43 +02:00
beorn7 dba1478b8a Add lint:ignore for protobuf deprecation
`github.com/golang/protobuf/proto` is deprecated in lieu of
`google.golang.org/protobuf/proto`. However, we cannot simply
migrate. Types from the proto package are exposed to users of packages
in this repo. If we migrate here, users have to migrate to. Thus, we
could only migrate with a major version bump.

In different news, with all the inline lint:ignore comments, including
the existing ones, there is no need to repeat the exception in the
Makefile.

A current version of `staticcheck` is happy with the code after this
commit. golangci-lint is broken at the moment, however, and ignores
the lint:ignore comments in the code as well as those via envvar.

Signed-off-by: beorn7 <beorn@grafana.com>
2020-05-14 20:11:22 +02:00
beorn7 0577ef6c57 Improve CollectAndCount
Now that we have also added CollectAndLint and GatherAndLint, I
thought we should bring CollectAndCount in line. So:

- Add GatherAndCount.
- Add filtering by metric name.
- Add tests.

Minor wart: CollectAndCount should now return `(int, error)`, but that
would be a breaking change as the current version just returns
`int`. I decided to let the new version panic when it should return an
error. An error is anyway very unlikely, so the biggest annoyance here
is really just the inconsistency.

Signed-off-by: beorn7 <beorn@grafana.com>
2020-05-14 00:17:45 +02:00
beorn7 389d3c3b9a Properly handle empty job and label values
An empty job name was always an error, but it was previously only
detected when pushing to the PGW and receiving an error. With this
commit, the error is detected before pushing.

An empty label value should have been OK but was encoded in a way that
couldn't be pushed to the
PGW. Cf. https://github.com/prometheus/pushgateway/issues/344 . This
commit changes the creation of the path in the URL so that it works
with empty label values.

Signed-off-by: beorn7 <beorn@grafana.com>
2020-05-13 23:35:31 +02:00
Michael Cristina be019d1f24 Fix typo in godoc help text
Signed-off-by: Michael Cristina <mcristina444@gmail.com>
2020-05-02 10:44:25 -05:00
beorn7 dc79bd6093 Improve various comments
Signed-off-by: beorn7 <beorn@grafana.com>
2020-04-25 15:59:53 +02:00