Commit Graph

1661 Commits

Author SHA1 Message Date
leonnicolas c7c7509669
testutil compareMetricFamilies: make less error-prone (#1424)
* testutil compareMetricFamilies: make less error-prone

The functions `GatherAndCompare`, `ScrapeAndCompare` and others that use
`compareMetricFamilies` under the hood can return no error if
`metricNames` includes none of the names found in the scraped/gathered
results. To avoid false Positves (an error being the negative case), we
can return an error if there is is at least one name in `metricNames`
that is not in the filtered results.

Fixes: https://github.com/prometheus/client_golang/issues/1351

Signed-off-by: leonnicolas <leonloechner@gmx.de>

* Add missing metricNames to error

In to see which metric names are missing, we can add them to the error
message.

Signed-off-by: leonnicolas <leonloechner@gmx.de>

* Apply suggestions from code review

- remove if nil check
- use two nested loops instead of map
- use new function `hasMetricByName` for readability

Co-authored-by: Bartlomiej Plotka <bwplotka@gmail.com>
Signed-off-by: leonnicolas <60091705+leonnicolas@users.noreply.github.com>

* prometheus/testutil/testutil_test.go: compare complete error

Before we would only compare the error prefix in `TestScrapeAndCompare`.

Signed-off-by: leonnicolas <leonloechner@gmx.de>

---------

Signed-off-by: leonnicolas <leonloechner@gmx.de>
Signed-off-by: leonnicolas <60091705+leonnicolas@users.noreply.github.com>
Co-authored-by: Bartlomiej Plotka <bwplotka@gmail.com>
2024-05-15 10:50:24 +01:00
Jack Cassidy 36b9f46811
add: CollectAndFormat to testutil (#1503)
CollectAndFormat is a helper function that returns the formatted metrics
to the caller, allowing them to use it how they want. This is different
to CollectAndCompare where the comparison is done strictly on behalf of
the caller. Often it is more convenient to perform a simple substring
match on the formatted metric.

Signed-off-by: Jack Cassidy <j.cassidy45@gmail.com>
2024-05-09 15:08:21 +00:00
Ishani Goyal 7d3be80a44
[CI]: Add Concurrency Grouping to GitHub Workflows (#1444)
* Update automerge-dependabot.yml

Signed-off-by: Ishani Goyal <111218213+Ishani217@users.noreply.github.com>

* Update codeql-analysis.yml

Signed-off-by: Ishani Goyal <111218213+Ishani217@users.noreply.github.com>

* Update go.yml

Signed-off-by: Ishani Goyal <111218213+Ishani217@users.noreply.github.com>

* Update golangci-lint.yml

Signed-off-by: Ishani Goyal <111218213+Ishani217@users.noreply.github.com>

---------

Signed-off-by: Ishani Goyal <111218213+Ishani217@users.noreply.github.com>
2024-05-09 12:52:37 +01:00
dependabot[bot] 9308329e89
build(deps): bump the github-actions group with 3 updates (#1510)
Bumps the github-actions group with 3 updates: [dependabot/fetch-metadata](https://github.com/dependabot/fetch-metadata), [github/codeql-action](https://github.com/github/codeql-action) and [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action).


Updates `dependabot/fetch-metadata` from 1.6.0 to 2.1.0
- [Release notes](https://github.com/dependabot/fetch-metadata/releases)
- [Commits](c9c4182bf1...5e5f99653a)

Updates `github/codeql-action` from 3.24.6 to 3.25.3
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](8a470fddaf...d39d31e687)

Updates `golangci/golangci-lint-action` from 4.0.0 to 5.1.0
- [Release notes](https://github.com/golangci/golangci-lint-action/releases)
- [Commits](3cfe3a4abb...9d1e0624a7)

---
updated-dependencies:
- dependency-name: dependabot/fetch-metadata
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github-actions
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: github-actions
- dependency-name: golangci/golangci-lint-action
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github-actions
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-05-09 10:34:35 +01:00
chuanshuo ccf82b1854
improved code more clean (#1511)
* improved code more clean

Signed-off-by: chuanshuo <lilijreey@126.com>

* improved code more clean

Signed-off-by: chuanshuo <lilijreey@126.com>

---------

Signed-off-by: chuanshuo <lilijreey@126.com>
2024-05-09 10:34:07 +01:00
github-actions[bot] 853c5de11e
Merge pull request #1509 from prometheus/dependabot/go_modules/tutorial/whatsup/github.com/prometheus/common-0.53.0
build(deps): bump github.com/prometheus/common from 0.48.0 to 0.53.0 in /tutorial/whatsup
2024-05-01 09:29:50 +00:00
github-actions[bot] 5c4ff38328
Merge pull request #1508 from prometheus/dependabot/go_modules/github.com/prometheus/client_model-0.6.1
build(deps): bump github.com/prometheus/client_model from 0.6.0 to 0.6.1
2024-05-01 09:26:56 +00:00
github-actions[bot] 6b169a1d46
Merge pull request #1507 from prometheus/dependabot/go_modules/golang.org/x/sys-0.19.0
build(deps): bump golang.org/x/sys from 0.18.0 to 0.19.0
2024-05-01 09:26:41 +00:00
dependabot[bot] 0075cb38ea
build(deps): bump github.com/prometheus/common in /tutorial/whatsup
Bumps [github.com/prometheus/common](https://github.com/prometheus/common) from 0.48.0 to 0.53.0.
- [Release notes](https://github.com/prometheus/common/releases)
- [Commits](https://github.com/prometheus/common/compare/v0.48.0...v0.53.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>
2024-05-01 09:26:15 +00:00
dependabot[bot] c4b6d5dbc9
build(deps): bump github.com/prometheus/client_model from 0.6.0 to 0.6.1
Bumps [github.com/prometheus/client_model](https://github.com/prometheus/client_model) from 0.6.0 to 0.6.1.
- [Release notes](https://github.com/prometheus/client_model/releases)
- [Commits](https://github.com/prometheus/client_model/compare/v0.6.0...v0.6.1)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-01 09:23:22 +00:00
dependabot[bot] 9e8b6413bd
build(deps): bump golang.org/x/sys from 0.18.0 to 0.19.0
Bumps [golang.org/x/sys](https://github.com/golang/sys) from 0.18.0 to 0.19.0.
- [Commits](https://github.com/golang/sys/compare/v0.18.0...v0.19.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>
2024-05-01 09:23:20 +00:00
github-actions[bot] 4e21273af7
Merge pull request #1506 from prometheus/dependabot/go_modules/google.golang.org/protobuf-1.34.0
build(deps): bump google.golang.org/protobuf from 1.33.0 to 1.34.0
2024-05-01 09:22:45 +00:00
github-actions[bot] 5ad7da9260
Merge pull request #1505 from prometheus/dependabot/go_modules/github.com/cespare/xxhash/v2-2.3.0
build(deps): bump github.com/cespare/xxhash/v2 from 2.2.0 to 2.3.0
2024-05-01 09:22:38 +00:00
github-actions[bot] 3ade2e28b8
Merge pull request #1504 from prometheus/dependabot/go_modules/github.com/prometheus/common-0.53.0
build(deps): bump github.com/prometheus/common from 0.52.3 to 0.53.0
2024-05-01 09:22:29 +00:00
dependabot[bot] 2cb5120488
build(deps): bump google.golang.org/protobuf from 1.33.0 to 1.34.0
Bumps google.golang.org/protobuf from 1.33.0 to 1.34.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>
2024-05-01 09:18:59 +00:00
dependabot[bot] 772f2a3426
build(deps): bump github.com/cespare/xxhash/v2 from 2.2.0 to 2.3.0
Bumps [github.com/cespare/xxhash/v2](https://github.com/cespare/xxhash) from 2.2.0 to 2.3.0.
- [Commits](https://github.com/cespare/xxhash/compare/v2.2.0...v2.3.0)

---
updated-dependencies:
- dependency-name: github.com/cespare/xxhash/v2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-01 09:18:58 +00:00
dependabot[bot] 7bbdd02c68
build(deps): bump github.com/prometheus/common from 0.52.3 to 0.53.0
Bumps [github.com/prometheus/common](https://github.com/prometheus/common) from 0.52.3 to 0.53.0.
- [Release notes](https://github.com/prometheus/common/releases)
- [Commits](https://github.com/prometheus/common/compare/v0.52.3...v0.53.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>
2024-05-01 09:18:55 +00:00
dongjiang 2f59eb2687
feat(dependency): replace go-spew package (#1499)
* remove go-spew package

Signed-off-by: dongjiang1989 <dongjiang1989@126.com>

* fix gofumpt lint

Signed-off-by: dongjiang1989 <dongjiang1989@126.com>

* fix unittest unicode

Signed-off-by: dongjiang1989 <dongjiang1989@126.com>

* dongjiang, change go-cmp to reflect

Signed-off-by: dongjiang1989 <dongjiang1989@126.com>

* fix lint

Signed-off-by: dongjiang1989 <dongjiang1989@126.com>

* Revert "dongjiang, change go-cmp to reflect"

This reverts commit bfbe25e926.

Signed-off-by: dongjiang1989 <dongjiang1989@126.com>

* change diff func

Signed-off-by: dongjiang1989 <dongjiang1989@126.com>

* dongjiang, update diff package

Signed-off-by: dongjiang1989 <dongjiang1989@126.com>

* update testutil

Signed-off-by: dongjiang1989 <dongjiang1989@126.com>

* Fix imports, goimports friendly

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

---------

Signed-off-by: dongjiang1989 <dongjiang1989@126.com>
Signed-off-by: Kemal Akkoyun <kakkoyun@gmail.com>
Co-authored-by: Kemal Akkoyun <kakkoyun@gmail.com>
2024-04-22 06:49:49 +00:00
github-actions[bot] a330ac5cee
Merge pull request #1502 from prometheus/dependabot/go_modules/golang.org/x/net-0.23.0
build(deps): bump golang.org/x/net from 0.22.0 to 0.23.0
2024-04-19 13:09:53 +00:00
dependabot[bot] 4d3dba3ab1
build(deps): bump golang.org/x/net from 0.22.0 to 0.23.0
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.22.0 to 0.23.0.
- [Commits](https://github.com/golang/net/compare/v0.22.0...v0.23.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-19 13:05:53 +00:00
github-actions[bot] 7fb219118a
Merge pull request #1501 from prometheus/dependabot/go_modules/tutorial/whatsup/golang.org/x/net-0.23.0
build(deps): bump golang.org/x/net from 0.20.0 to 0.23.0 in /tutorial/whatsup
2024-04-19 13:05:18 +00:00
dependabot[bot] 991fecad9f
build(deps): bump golang.org/x/net in /tutorial/whatsup
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.20.0 to 0.23.0.
- [Commits](https://github.com/golang/net/compare/v0.20.0...v0.23.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-19 13:01:36 +00:00
oftenoccur d038ab96c0
chore: fix function name in comment (#1497)
Signed-off-by: oftenoccur <ezc5@sina.com>
2024-04-11 14:53:09 +02:00
github-actions[bot] 6b857f1b8d
Merge pull request #1498 from prometheus/dependabot/go_modules/github.com/prometheus/common-0.52.3
Bump github.com/prometheus/common from 0.48.0 to 0.52.3
2024-04-11 10:36:41 +00:00
dependabot[bot] 5a00ae4179
Bump github.com/prometheus/common from 0.48.0 to 0.52.3
Bumps [github.com/prometheus/common](https://github.com/prometheus/common) from 0.48.0 to 0.52.3.
- [Release notes](https://github.com/prometheus/common/releases)
- [Commits](https://github.com/prometheus/common/compare/v0.48.0...v0.52.3)

---
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>
2024-04-11 10:32:51 +00:00
Arthur Silva Sens e133e49029
Merge pull request #1389 from prometheus/fix-lint-issue
gocollector: Add regex option to allow collection of debug runtime metrics
2024-04-08 11:45:23 -03:00
Arthur Silva Sens 0f500036fc
gocollector: Add regex option to allow collection of debug runtime metrics
Signed-off-by: Arthur Silva Sens <arthur.sens@coralogix.com>
2024-04-08 11:42:03 -03:00
Arthur Silva Sens c586fcc216
Merge pull request #1483 from prometheus/simplify-basemetrics
chore: Refactor how base metrics are added to Sched metrics
2024-04-08 09:41:04 -03:00
Max Lowther 6fdffbf334
fix: remove redundant go module in middleware example (#1492)
* remove extra go module

Signed-off-by: Max Lowther <lowther.max@gmail.com>

* sort imports

Signed-off-by: Max Lowther <lowther.max@gmail.com>

---------

Signed-off-by: Max Lowther <lowther.max@gmail.com>
2024-04-08 09:32:51 +02:00
Sachin Sahu 76fa980794
feat: metrics generation workflow (#1481)
* Scripts to check new Go version

Signed-off-by: Sachin Sahu <sachinksahu.431@gmail.com>

* Changes to test workflow

Signed-off-by: Sachin Sahu <sachinksahu.431@gmail.com>

* Update workflow to run based on Go release cycle

Signed-off-by: Sachin Sahu <75629410+SachinSahu431@users.noreply.github.com>

* Revert deleted files for testing workflow

Signed-off-by: Sachin Sahu <75629410+SachinSahu431@users.noreply.github.com>

* Revert deleted file for testing workflow

Signed-off-by: Sachin Sahu <75629410+SachinSahu431@users.noreply.github.com>

* Fix linting issue

Signed-off-by: Sachin Sahu <75629410+SachinSahu431@users.noreply.github.com>

* Update cron schedule to per month

Signed-off-by: Sachin Sahu <75629410+SachinSahu431@users.noreply.github.com>

* Update bash file

Signed-off-by: Sachin Sahu <75629410+SachinSahu431@users.noreply.github.com>

* Keep latest 3 Go versions in supported_go_versions

Signed-off-by: Sachin Sahu <75629410+SachinSahu431@users.noreply.github.com>

---------

Signed-off-by: Sachin Sahu <sachinksahu.431@gmail.com>
Signed-off-by: Sachin Sahu <75629410+SachinSahu431@users.noreply.github.com>
2024-04-04 08:25:38 +02:00
Arthur Silva Sens e3bea8af78
Merge pull request #1489 from SachinSahu431/update-go-yml
ci: Remove hardcoded supported Go versions from go.yml
2024-04-02 10:24:04 -03:00
Sachin Sahu 1fc81cf736 Modify go.yml file
Signed-off-by: Sachin Sahu <75629410+SachinSahu431@users.noreply.github.com>
2024-04-02 13:10:47 +00:00
Sachin Sahu cd45345437 ci: Remove hardcoded supported Go versions from go.yml
Signed-off-by: Sachin Sahu <75629410+SachinSahu431@users.noreply.github.com>
2024-04-02 05:10:59 +00:00
github-actions[bot] e38b67e77a
Merge pull request #1486 from prometheus/dependabot/go_modules/github.com/prometheus/procfs-0.13.0
Bump github.com/prometheus/procfs from 0.12.0 to 0.13.0
2024-04-01 09:47:24 +00:00
dependabot[bot] 17dafc8498
Bump github.com/prometheus/procfs from 0.12.0 to 0.13.0
Bumps [github.com/prometheus/procfs](https://github.com/prometheus/procfs) from 0.12.0 to 0.13.0.
- [Release notes](https://github.com/prometheus/procfs/releases)
- [Commits](https://github.com/prometheus/procfs/compare/v0.12.0...v0.13.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>
2024-04-01 09:43:57 +00:00
github-actions[bot] af02258d86
Merge pull request #1485 from prometheus/dependabot/go_modules/golang.org/x/sys-0.18.0
Bump golang.org/x/sys from 0.17.0 to 0.18.0
2024-04-01 09:43:27 +00:00
dependabot[bot] 838b8e5ccb
Bump golang.org/x/sys from 0.17.0 to 0.18.0
Bumps [golang.org/x/sys](https://github.com/golang/sys) from 0.17.0 to 0.18.0.
- [Commits](https://github.com/golang/sys/compare/v0.17.0...v0.18.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>
2024-04-01 09:40:09 +00:00
Arthur Silva Sens ec6ba13cc3
chore: Refactor how base metrics are added to Sched metrics
Signed-off-by: Arthur Silva Sens <arthur.sens@coralogix.com>
2024-03-30 17:17:09 -03:00
Igor Drozdov 93cf5d4f5f
Implement Unwrap() for responseWriterDelegator (#1480)
If the ResponseWriter implements any of the following methods,
the ResponseController will call them as appropriate:

Flush()
FlushError() error // alternative Flush returning an error
Hijack() (net.Conn, *bufio.ReadWriter, error)
SetReadDeadline(deadline time.Time) error
SetWriteDeadline(deadline time.Time) error
EnableFullDuplex() error

If the ResponseWriter doesn't implement the methods,
the ResponseController will call Unwrap() method until it
finds a ResponseWriter in the chain

This commit implements Unwrap() method to simply return the
wrapped ResponseWriter

Signed-off-by: Igor Drozdov <ihardrozdov@gmail.com>
2024-03-28 14:42:34 +01:00
Sachin Sahu 50ab457fb7
Auto-update Go Collector Metrics for new Go versions (#1476)
* Autogenerate go_collector_<version>_test.go files

Signed-off-by: Sachin Sahu <75629410+SachinSahu431@users.noreply.github.com>

* Add latest Go version

Signed-off-by: Sachin Sahu <75629410+SachinSahu431@users.noreply.github.com>

* nit: Script to check new Go version

Signed-off-by: Sachin Sahu <75629410+SachinSahu431@users.noreply.github.com>

* Rename file, fix linting issue

Signed-off-by: Sachin Sahu <75629410+SachinSahu431@users.noreply.github.com>

---------

Signed-off-by: Sachin Sahu <75629410+SachinSahu431@users.noreply.github.com>
2024-03-26 12:42:34 +00:00
Arthur Silva Sens 26e3055e51
Merge pull request #1472 from prometheus/i5242
Add LintDuplicateMetric to promlint
2024-03-24 11:03:00 +01:00
Hrishikesh Barman 25074625b7 Add LintDuplicateMetric to promlint
Signed-off-by: Hrishikesh Barman <hrishikeshbman@gmail.com>
2024-03-16 12:12:08 +00:00
github-actions[bot] 7882668df7
Merge pull request #1469 from prometheus/dependabot/go_modules/tutorial/whatsup/google.golang.org/protobuf-1.33.0
Bump google.golang.org/protobuf from 1.32.0 to 1.33.0 in /tutorial/whatsup
2024-03-13 23:37:17 +00:00
github-actions[bot] 6b37369dc8
Merge pull request #1467 from prometheus/dependabot/go_modules/examples/middleware/google.golang.org/protobuf-1.33.0
Bump google.golang.org/protobuf from 1.32.0 to 1.33.0 in /examples/middleware
2024-03-13 23:34:12 +00:00
dependabot[bot] 4549547075
Bump google.golang.org/protobuf in /tutorial/whatsup
Bumps google.golang.org/protobuf from 1.32.0 to 1.33.0.

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-13 23:33:56 +00:00
dependabot[bot] 76e6dfd41b
Bump google.golang.org/protobuf in /examples/middleware
Bumps google.golang.org/protobuf from 1.32.0 to 1.33.0.

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-13 23:30:42 +00:00
github-actions[bot] c5f9c3fbb2
Merge pull request #1466 from prometheus/dependabot/go_modules/google.golang.org/protobuf-1.33.0
Bump google.golang.org/protobuf from 1.32.0 to 1.33.0
2024-03-13 23:29:50 +00:00
dependabot[bot] 4f5e328d87
Bump google.golang.org/protobuf from 1.32.0 to 1.33.0
Bumps google.golang.org/protobuf from 1.32.0 to 1.33.0.

---
updated-dependencies:
- dependency-name: google.golang.org/protobuf
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-13 23:26:18 +00:00
Arthur Silva Sens b59cfc9f6e
Merge pull request #1456 from prometheus/dependabot/github_actions/github-actions-cd65112d37
Bump the github-actions group with 2 updates
2024-03-02 16:01:55 -03:00
Arthur Silva Sens 876e942149
Merge pull request #1462 from prometheus/release-1.19
Merge Release 1.19 back to main
2024-03-02 16:01:24 -03:00