Commit Graph

1526 Commits

Author SHA1 Message Date
bwplotka 076c389ae2 Last touches (readability and consistency)
Changes:

* Comments for "now" are more explicit and not inlined.
* populateMetrics is simpler and bit more efficient without timestamp to time to timestamp conversionts for more common code.
* Test consistency and simplicity - the fewer variables the better.
* Fixed inconsistency for v2 and MetricVec - let's pass opt.now consistently.
* We don't need TestCounterXXXTimestamp - we test CT in many other places already.
* Added more involved test for counter vectors with created timestamp.
* Refactored normalization for simplicity.
* Make histogram, summaries now consistent.
* Simplified histograms CT flow and implemented proper CT on reset.

TODO for next PRs:
* NewConstSummary and NewConstHistogram - ability to specify CTs there.

Signed-off-by: bwplotka <bwplotka@gmail.com>
2023-09-20 12:08:24 +01:00
Arthur Silva Sens 226eb8dcd4
Backport created timestamp to existing tests
Signed-off-by: Arthur Silva Sens <arthur.sens@coralogix.com>
2023-08-24 17:05:26 -03:00
Arthur Silva Sens 3c7e78cf3e
Extend Counters, Summaries and Histograms with creation timestamp
Signed-off-by: Arthur Silva Sens <arthur.sens@coralogix.com>
2023-08-24 17:05:20 -03:00
PrometheusBot 51d24f8680
Update common Prometheus files (#1332)
Signed-off-by: prombot <prometheus-team@googlegroups.com>
2023-08-15 09:39:13 +02:00
Ben Kochie c17edf09ed
Merge pull request #1304 from prometheus/dependabot/go_modules/google.golang.org/protobuf-1.31.0
Bump google.golang.org/protobuf from 1.30.0 to 1.31.0
2023-08-14 22:18:20 +02:00
dependabot[bot] 8483c5dab8
Bump google.golang.org/protobuf from 1.30.0 to 1.31.0
Bumps google.golang.org/protobuf from 1.30.0 to 1.31.0.

---
updated-dependencies:
- dependency-name: google.golang.org/protobuf
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-08-14 14:54:09 +00:00
Ben Kochie 760a55a415
Merge pull request #1330 from prometheus/dependabot/go_modules/tutorial/whatsup/github.com/prometheus/common-0.44.0
Bump github.com/prometheus/common from 0.42.0 to 0.44.0 in /tutorial/whatsup
2023-08-14 16:53:27 +02:00
Ben Kochie f58d0fd655
Merge pull request #1284 from prometheus/dependabot/go_modules/github.com/prometheus/common-0.44.0
Bump github.com/prometheus/common from 0.42.0 to 0.44.0
2023-08-14 16:53:10 +02:00
dependabot[bot] 85f4592a0c
Bump github.com/prometheus/common from 0.42.0 to 0.44.0
Bumps [github.com/prometheus/common](https://github.com/prometheus/common) from 0.42.0 to 0.44.0.
- [Release notes](https://github.com/prometheus/common/releases)
- [Commits](https://github.com/prometheus/common/compare/v0.42.0...v0.44.0)

---
updated-dependencies:
- dependency-name: github.com/prometheus/common
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-08-14 13:46:29 +00:00
dependabot[bot] 802a963a20
Bump github.com/prometheus/common in /tutorial/whatsup
Bumps [github.com/prometheus/common](https://github.com/prometheus/common) from 0.42.0 to 0.44.0.
- [Release notes](https://github.com/prometheus/common/releases)
- [Commits](https://github.com/prometheus/common/compare/v0.42.0...v0.44.0)

---
updated-dependencies:
- dependency-name: github.com/prometheus/common
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-08-14 13:43:04 +00:00
Ben Kochie fa04b7b613
Merge pull request #1328 from prometheus/dependabot/go_modules/examples/middleware/github.com/prometheus/client_golang-1.16.0
Bump github.com/prometheus/client_golang from 1.13.1 to 1.16.0 in /examples/middleware
2023-08-14 15:41:41 +02:00
Ben Kochie adb018069e
Merge pull request #1329 from prometheus/dependabot/go_modules/tutorial/whatsup/github.com/prometheus/client_golang-1.16.0
Bump github.com/prometheus/client_golang from 1.15.1-0.20230416215738-0963f595c689 to 1.16.0 in /tutorial/whatsup
2023-08-14 15:41:19 +02:00
Ben Kochie 301a7bdb7f
Merge pull request #1331 from prometheus/dependabot/go_modules/golang.org/x/sys-0.11.0
Bump golang.org/x/sys from 0.10.0 to 0.11.0
2023-08-14 15:40:40 +02:00
dependabot[bot] f215f759c6
Bump golang.org/x/sys from 0.10.0 to 0.11.0
Bumps [golang.org/x/sys](https://github.com/golang/sys) from 0.10.0 to 0.11.0.
- [Commits](https://github.com/golang/sys/compare/v0.10.0...v0.11.0)

---
updated-dependencies:
- dependency-name: golang.org/x/sys
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-08-14 13:30:38 +00:00
dependabot[bot] 390448ff3c
Bump github.com/prometheus/client_golang in /tutorial/whatsup
Bumps [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) from 1.15.1-0.20230416215738-0963f595c689 to 1.16.0.
- [Release notes](https://github.com/prometheus/client_golang/releases)
- [Changelog](https://github.com/prometheus/client_golang/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prometheus/client_golang/commits/v1.16.0)

---
updated-dependencies:
- dependency-name: github.com/prometheus/client_golang
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-08-14 13:30:30 +00:00
dependabot[bot] 0e33cf9a99
Bump github.com/prometheus/client_golang in /examples/middleware
Bumps [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) from 1.13.1 to 1.16.0.
- [Release notes](https://github.com/prometheus/client_golang/releases)
- [Changelog](https://github.com/prometheus/client_golang/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prometheus/client_golang/compare/v1.13.1...v1.16.0)

---
updated-dependencies:
- dependency-name: github.com/prometheus/client_golang
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-08-14 13:30:29 +00:00
Ben Kochie 4abd83d655
Update building (#1326)
* Remove unused / non-standard .go-version.
* Cleanup indenting in Makefile.
* Enable dependabot for subdirs.
* Update golanci-lint CI.
* Update go.mod version directives to match supported versions.
* Disable golanci-lint unused-parameter.

Signed-off-by: SuperQ <superq@gmail.com>
2023-08-14 15:29:51 +02:00
Bartlomiej Plotka 6f576e2c6f
histogram docs: Fixed minor nit. (#1324)
Signed-off-by: bwplotka <bwplotka@gmail.com>
2023-08-13 14:11:06 +01:00
Arthur Silva Sens 1a88780343
Bump prometheus/client_model (#1323)
By upgrading prometheus/client_model, several test functions had to be re-written due to 2 breaking changes made in protobuf when parsing messages to text:
1. '<' and '>' characters were replaced with '{' and '}' respectively.
2. The text format is non-deterministic. More information in https://github.com/golang/protobuf/issues/1121

Signed-off-by: Arthur Silva Sens <arthur.sens@coralogix.com>
2023-08-11 20:17:55 +01:00
Kemal Akkoyun 06d4592b1c
Add Go 1.21 support (#1325)
* Add Go 1.21 support

Signed-off-by: Kemal Akkoyun <kakkoyun@gmail.com>

* Update README.md

Signed-off-by: Kemal Akkoyun <kakkoyun@gmail.com>

---------

Signed-off-by: Kemal Akkoyun <kakkoyun@gmail.com>
2023-08-11 12:27:52 +02:00
Björn Rabenstein cdd7f45dc5
Merge pull request #1322 from sengi/docs
docs: trivial grammar fixes to improve readability in promauto Godoc
2023-08-08 15:02:33 +02:00
Chris Banks f16b435f04
docs: trivial grammar fixes to improve readability
Fix a few typos / grammatical errors in the Godoc comments for promauto.
Only trivial stuff but slightly helps readability of the docs.

Signed-off-by: Chris Banks <chris.banks@digital.cabinet-office.gov.uk>
2023-08-05 11:41:47 +01:00
dependabot[bot] e6d9092baf
Bump github.com/prometheus/procfs from 0.11.0 to 0.11.1 (#1319)
Bumps [github.com/prometheus/procfs](https://github.com/prometheus/procfs) from 0.11.0 to 0.11.1.
- [Release notes](https://github.com/prometheus/procfs/releases)
- [Commits](https://github.com/prometheus/procfs/compare/v0.11.0...v0.11.1)

---
updated-dependencies:
- dependency-name: github.com/prometheus/procfs
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-01 18:56:09 +01:00
dependabot[bot] 99e905a3d5
Bump golang.org/x/sys from 0.9.0 to 0.10.0 (#1320)
Bumps [golang.org/x/sys](https://github.com/golang/sys) from 0.9.0 to 0.10.0.
- [Commits](https://github.com/golang/sys/compare/v0.9.0...v0.10.0)

---
updated-dependencies:
- dependency-name: golang.org/x/sys
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-01 17:12:04 +01:00
ZiViZiViZ 23387fe2f4
Add missing tick "`" in README (#1321)
Cosmetic change

Signed-off-by: ZiViZiViZ <95288998+ZiViZiViZ@users.noreply.github.com>
2023-08-01 17:11:49 +01:00
Tiago Silva 59c00e3e9c
Fix data-race in metric without code and method but with `WithLabelFromCtx` (#1318)
This commit fixes a data race that exists when the metric used in any
`promhttp` middleware doesn't collect the `code` and `method` but uses
`WithLabelFromCtx` to collect values from context.

The problem happens because when no `code` and `method` tags are
collected, the `labels` function returns a pre-initialized map
`emptyLabels` for every request.

When one or multipe `WithLabelFromCtx` options are configured, the
returned map from the `labels` function call is used to collect the
metrics from context which creates a multi-write data race.

Signed-off-by: Tiago Silva <tiago.silva@goteleport.com>
2023-08-01 17:11:17 +01:00
PrometheusBot 7f2db5f1ed
Update common Prometheus files (#1302)
Signed-off-by: prombot <prometheus-team@googlegroups.com>
2023-07-26 12:54:03 +01:00
dependabot[bot] 6e3b962584
Bump github.com/prometheus/procfs from 0.10.1 to 0.11.0 (#1305)
Bumps [github.com/prometheus/procfs](https://github.com/prometheus/procfs) from 0.10.1 to 0.11.0.
- [Release notes](https://github.com/prometheus/procfs/releases)
- [Commits](https://github.com/prometheus/procfs/compare/v0.10.1...v0.11.0)

---
updated-dependencies:
- dependency-name: github.com/prometheus/procfs
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-26 12:53:49 +01:00
Bartlomiej Plotka 90b169a60d
Merge pull request #1314 from prometheus/beorn7/histogram
histogram: Enable detection of a native histogram without observations
2023-07-26 13:53:11 +02:00
dependabot[bot] 98025d8797
Bump google.golang.org/grpc from 1.45.0 to 1.53.0 in /tutorial/whatsup (#1307)
Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.45.0 to 1.53.0.
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](https://github.com/grpc/grpc-go/compare/v1.45.0...v1.53.0)

---
updated-dependencies:
- dependency-name: google.golang.org/grpc
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-26 12:46:42 +01:00
dependabot[bot] 3b6fb7aa3f
Bump golang.org/x/sys from 0.8.0 to 0.9.0 (#1306)
Bumps [golang.org/x/sys](https://github.com/golang/sys) from 0.8.0 to 0.9.0.
- [Commits](https://github.com/golang/sys/compare/v0.8.0...v0.9.0)

---
updated-dependencies:
- dependency-name: golang.org/x/sys
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-26 12:46:32 +01:00
beorn7 3d82c94432 histogram: Add a no-op span for an otherwise empty histogram
Fixes #1127.

If a native histogram has no observations and a zero threshold of
zero, then it is indistinguishable from a classic histogram. To give
scrapers a hint that it is indeed a native histogram, we add a no-op
span.

This needs follow-up PRs in prometheus/prometheus and
prometheus/client_model.

Signed-off-by: beorn7 <beorn@grafana.com>
2023-07-20 17:34:00 +02:00
beorn7 f9db3821a8 histograms: Small code comment and code formatting improvements
Signed-off-by: beorn7 <beorn@grafana.com>
2023-07-20 16:13:28 +02:00
Quentin D 644c80d136
Do not allocate memory when there's no constraints (#1296)
Signed-off-by: Quentin Devos <4972091+Okhoshi@users.noreply.github.com>
2023-06-27 12:21:36 +01:00
Diogo Teles Sant'Anna 553eb4c7a8
ci: define minimal permissions to github workflows (#1295)
Signed-off-by: Diogo Teles Sant'Anna <diogoteles@google.com>
2023-06-19 09:53:04 +01:00
PrometheusBot f6bb79e03d
Update common Prometheus files (#1297)
Signed-off-by: prombot <prometheus-team@googlegroups.com>
2023-06-19 09:12:39 +01:00
Bartlomiej Plotka c3fa5a74f1
Merge pull request #1293 from prometheus/release-1.16
Merge v1.16.0 to main
2023-06-15 12:57:21 +02:00
Bartlomiej Plotka 3583c1e1d0
Cut v1.16.0 (#1292)
Signed-off-by: bwplotka <bwplotka@gmail.com>
2023-06-15 11:46:32 +01:00
Bartlomiej Plotka 2feda42e44
Fixed README & CHANGELOG; Added fmt makefile command (+bingo) for easier contributions. (#1289)
* Fixed README; Added fmt command for easier contributions.

Signed-off-by: bwplotka <bwplotka@gmail.com>

* Updated golint.

Signed-off-by: bwplotka <bwplotka@gmail.com>

* Update Makefile

Co-authored-by: Kemal Akkoyun <kakkoyun@users.noreply.github.com>
Signed-off-by: Bartlomiej Plotka <bwplotka@gmail.com>

---------

Signed-off-by: bwplotka <bwplotka@gmail.com>
Signed-off-by: Bartlomiej Plotka <bwplotka@gmail.com>
Co-authored-by: Kemal Akkoyun <kakkoyun@users.noreply.github.com>
2023-06-13 14:54:49 +01:00
Björn Rabenstein 5b9cf9c6a8
Merge pull request #1290 from prometheus/fix-nh-docstring-refs
Fix docstring references to renamed native histogram fields / functions.
2023-06-13 15:54:22 +02:00
Julius Volz 1b19d5f458 Fix docstring references to renamed native histogram fields / functions.
Signed-off-by: Julius Volz <julius.volz@gmail.com>
2023-06-13 10:36:40 +02:00
Bartlomiej Plotka 7352ab7f80
Moving fully to GH actions. (#1288)
Signed-off-by: bwplotka <bwplotka@gmail.com>
2023-06-08 12:44:53 +01:00
Aviv Litman e4ff34d23e
Improve metricUnits runtime (#1286)
We tested this function runtime in both cases using "testing",
and the runtime for this pr is much shorter.

Signed-off-by: alitman <alitman@redhat.com>
2023-06-08 11:35:32 +01:00
Krishna Dutt Panchagnula 781ea28024
added circleci as gh action YAML (#1281)
* added circleci as gh action YAML

Signed-off-by: krishnaduttPanchagnula <krishnadutt123@gmail.com>

* merged all changes into one

Signed-off-by: krishnaduttPanchagnula <krishnadutt123@gmail.com>

---------

Signed-off-by: krishnaduttPanchagnula <krishnadutt123@gmail.com>
2023-06-08 10:51:42 +01:00
Bulat Khasanov a09a1d34cb
Reduce constrainLabels allocations (#1272)
* Add bench

Signed-off-by: Bulat Khasanov <afti@yandex.ru>

* Reduce constrainLabels allocations

Signed-off-by: Bulat Khasanov <afti@yandex.ru>

---------

Signed-off-by: Bulat Khasanov <afti@yandex.ru>
2023-06-07 08:39:02 +01:00
dependabot[bot] 8840afcfc2
Bump github.com/prometheus/procfs from 0.9.0 to 0.10.1 (#1283)
Bumps [github.com/prometheus/procfs](https://github.com/prometheus/procfs) from 0.9.0 to 0.10.1.
- [Release notes](https://github.com/prometheus/procfs/releases)
- [Commits](https://github.com/prometheus/procfs/compare/v0.9.0...v0.10.1)

---
updated-dependencies:
- dependency-name: github.com/prometheus/procfs
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-06-07 08:12:43 +01:00
Björn Rabenstein 5e78d5f66b
Merge pull request #1279 from prometheus/beorn7/histogram
Fix bug in bucket key calculation
2023-05-29 00:09:18 +02:00
Han Kang b8cb86a865
add process start time header to client_golang prometheus (#1278)
* add process start time header to client_golang prometheus

Signed-off-by: Han Kang <hankang@google.com>

* Apply suggestions from code review

Co-authored-by: Bartlomiej Plotka <bwplotka@gmail.com>
Signed-off-by: Han Kang <hankang@google.com>

* fix up changes due to incorporation of feedback

* fix lint issues

---------

Signed-off-by: Han Kang <hankang@google.com>
Co-authored-by: Bartlomiej Plotka <bwplotka@gmail.com>
2023-05-26 12:58:36 +01:00
beorn7 77e97da564 histogram: Fix bug in bucket key calculation
The current code doesn't work fork negative schemas if the observed
value should go into a bucket with a non-positive key.

Signed-off-by: beorn7 <beorn@grafana.com>
2023-05-25 19:03:43 +02:00
beorn7 30948120dc histogram: expose bug in bucket key calculation
The current code doesn't work fork negative schemas if the observed
value should go into a bucket with a non-positive key.

Signed-off-by: beorn7 <beorn@grafana.com>
2023-05-25 19:02:28 +02:00