Commit Graph

1840 Commits

Author SHA1 Message Date
github-actions[bot] 38fb2b1818
Merge pull request #1633 from prometheus/dependabot/go_modules/github.com/klauspost/compress-1.17.10
build(deps): bump github.com/klauspost/compress from 1.17.9 to 1.17.10
2024-10-01 09:29:50 +00:00
dependabot[bot] cb4b0c6a9d
build(deps): bump github.com/klauspost/compress from 1.17.9 to 1.17.10
Bumps [github.com/klauspost/compress](https://github.com/klauspost/compress) from 1.17.9 to 1.17.10.
- [Release notes](https://github.com/klauspost/compress/releases)
- [Changelog](https://github.com/klauspost/compress/blob/master/.goreleaser.yml)
- [Commits](https://github.com/klauspost/compress/compare/v1.17.9...v1.17.10)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-01 09:22:25 +00:00
dependabot[bot] 9cd37f90ea
build(deps): bump golang.org/x/sys from 0.24.0 to 0.25.0
Bumps [golang.org/x/sys](https://github.com/golang/sys) from 0.24.0 to 0.25.0.
- [Commits](https://github.com/golang/sys/compare/v0.24.0...v0.25.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-10-01 09:22:16 +00:00
Matt Harbison 25bda7ceb5
process_collector: fill in virtual and resident memory values on macOS using optional cgo (#1616)
Unfortunately, these values aren't available from getrusage(2), or any other
builtin Go API.  Go itself doesn't provide a mechanism (like on Windows) to call
into system libraries.  Using a 3rd party package[1] to dynamically call system
libraries was proposed and rejected, to avoid adding to the number of
dependencies.  That leaves using cgo, which is used here when available.  When
not available (either because of cross compiling or explicitly disabling it), a
stub function is linked instead, and the metrics are not exported.  That way,
cross compiling of other platforms is unaffected (and can also still be done
with Darwin too, but at the cost of not exporting these metrics).

Note that building an amd64 image on an arm64 mac or vice-versa is cross
compiling, and will use the stub method by default.  This can be avoided by
setting `CGO_ENABLED=1` in the environment to force the use of cgo for both
architectures.

I'm unsure of the usefulness of the potential adjustment made to the virtual
memory value after calling `mach_vm_region()`.  I've not seen that code get run
with a native amd64 or arm64 image, or with an amd64 image running under
Rosetta.  But that's what the `ps(1)` command does, and I think we should report
what the system tools do.

When I was testing this on a beta of macOS 15 with Go 1.21.13 (the current
minimum support for this module), the amd64 image ran fine under Rosetta, but
the arm64 image immediately printed a message that it was killed, even prior to
the cgo call.  This seems to be a recurring issue on macOS[2][3], and passing
`-ldflags -s` to `go build` avoided the issue.  Go 1.23.1 worked out of the box,
without fiddling with linker flags, so I don't think this is an issue- Go 1.21
is simply too old to support macOS 15, but I thought it was worth noting.  I
supposed we could gate the cgo code with an additional build flag, if anyone is
concerned about this.

[1] https://github.com/ebitengine/purego
[2] https://github.com/golang/go/issues/19841#issuecomment-293334802
[3] https://github.com/golang/go/issues/11887#issuecomment-125694604

Signed-off-by: Matt Harbison <mharbison72@gmail.com>
2024-09-27 17:29:44 +01:00
PrometheusBot 86f3496868
Update common Prometheus files (#1628)
Signed-off-by: prombot <prometheus-team@googlegroups.com>
2024-09-23 15:02:05 +01:00
Arianna Vespri ff60566f1b
Refactor default runtime metrics tests for Go collector so that default runtime metric set autogenerates (#1631)
* Enable autogeneration for default runtime metrics list in collectors tests according to Go version

Signed-off-by: Arianna Vespri <arianna.vespri@yahoo.it>

* Adapt withDefaultRuntimeMetrics function to work regardless of the Go version

Signed-off-by: Arianna Vespri <arianna.vespri@yahoo.it>

* Autogenerate go collector test for go1.23

Signed-off-by: Arianna Vespri <arianna.vespri@yahoo.it>

* Modify gen_go_collector_set.go to please linter and regenerate files

Signed-off-by: Arianna Vespri <arianna.vespri@yahoo.it>

* Simplify gen_go_collector_set.go logic by modifying func computeMetricsList

Signed-off-by: Arianna Vespri <arianna.vespri@yahoo.it>

* Slight simplification of withDefaultRuntimeMetrics func

Signed-off-by: Arianna Vespri <arianna.vespri@yahoo.it>

* Refactor withDefaultRuntimeMetrics with generated default runtime metrics subsets

Signed-off-by: Arianna Vespri <arianna.vespri@yahoo.it>

---------

Signed-off-by: Arianna Vespri <arianna.vespri@yahoo.it>
2024-09-23 14:55:38 +01:00
Arthur Silva Sens 64158c5c00
Merge pull request #1626 from ying-jeanne/add-example-for-customlabels
examples: Add custom labels example
2024-09-19 09:09:16 +01:00
Ying WANG 86cdda8cb1
Merge branch 'main' into add-example-for-customlabels 2024-09-18 09:22:59 +02:00
Ying WANG 6efd27deef
Update examples/customlabels/main.go
Co-authored-by: Bartlomiej Plotka <bwplotka@gmail.com>
Signed-off-by: Ying WANG <74549700+ying-jeanne@users.noreply.github.com>
2024-09-18 09:20:45 +02:00
Arthur Silva Sens 39e7c23b95
Merge pull request #1627 from prometheus/release-1.20
Merge Release 1.20 back to main
2024-09-17 10:39:34 +02:00
Ying WANG b079872c87
examples: Add custom labels example
Signed-off-by: Ying WANG <ying.wang@grafana.com>
2024-09-16 00:15:30 +02:00
George Krajcsovits 05fcde9fe4
Merge pull request #1623 from krajorama/data-race-in-histogram-write
native histogram: Fix race between Write and addExemplar
2024-09-07 07:57:39 +02:00
György Krajcsovits 209f4c041e Add changelog
Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
2024-09-06 12:41:51 +02:00
György Krajcsovits 1e398ccb12 native histogram: Fix race between Write and addExemplar
Follow-up to 1608

Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
2024-09-06 11:01:04 +02:00
PrometheusBot ac114f315e
Update common Prometheus files (#1622)
Signed-off-by: prombot <prometheus-team@googlegroups.com>
2024-09-06 07:55:35 +01:00
Owen Williams c29b98675f
Merge pull request #1618 from prometheus/owilliams/utf8-testing
Set allow-utf-8 in Format during tests to avoid escaping.
2024-09-05 15:24:18 -04:00
Owen Williams 4d20de5bfa Set allow-utf-8 in Format during tests to avoid escaping.
For https://github.com/open-telemetry/opentelemetry-go/pull/5755

Signed-off-by: Owen Williams <owen.williams@grafana.com>
2024-09-05 15:16:46 -04:00
Arthur Silva Sens ef2f87ea98
Merge pull request #1620 from prometheus/arthursens/prepare-1.20.3
Add changelog entry for 1.20.3
2024-09-05 09:29:29 -03:00
Arthur Silva Sens 937ac63d3d
Add changelog entry for 1.20.3
Signed-off-by: Arthur Silva Sens <arthursens2005@gmail.com>
2024-09-05 09:23:41 -03:00
George Krajcsovits 6e9914db5a
Merge pull request #1608 from krajorama/index-out-of-range-native-histogram-exemplar
bugfix: native histogram: exemplars index out of range
2024-09-04 21:21:43 +02:00
György Krajcsovits d6b8c8925b Update comments with more explanations
Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
2024-09-04 21:10:22 +02:00
György Krajcsovits 504566f07c Use simplified solution from #1609 for the data race
Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
2024-09-04 21:10:22 +02:00
György Krajcsovits dc8e9a4d8a fix: native histogram: Simplify and fix addExemplar
mdIdx was redundant when len(exemplars)>1, so got rid of it, rIdx
is enough.

Don't compare timestamp of incoming exemplar to timestamp of
minimal distance exemplar. Most of the time the incoming exemplar
will be newer. And if not, the previous code just replaced an
exemplar one index after the minimal distance exemplar. Which had
an index out of range bug, plus is essentially random.

Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
2024-09-04 21:10:22 +02:00
György Krajcsovits dc819ceb1b Use a trivial solution to #1605
Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
2024-09-04 21:10:22 +02:00
György Krajcsovits e061dfae88 native histogram: use exemplars in concurrency test
Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
2024-09-04 21:10:22 +02:00
cuisongliu 89f21b2cba
api: Add ability to CloseIdleConnection for one-off httpClient use cases. (#1513)
Signed-off-by: cuisongliu <cuisongliu@qq.com>
2024-09-04 16:00:55 +01:00
Matt Harbison a5e134014f
process_collector: fill in most statistics on macOS (#1600)
* process_collector: fill in most statistics on macOS

Unfortunately, the virtual memory, resident memory, and network stats will
require access to undocumented C functions.  I was warned off of cgo in IRC
because it would then have to be enabled in a bunch of different projects that
use this module, but I already was against it because that would break the
ability to cross-compile.  There is no interface to `dlopen` built into golang.
The `github.com/ebitengine/purego` module looks promising (I can cross-compile
and call these methods), but I'm currently getting unexpected results.  I'll
follow up with that separately if I can get it working, but hopefully this stuff
is pretty uncontroversial.

Tested on macOS 10.14.6 (amd64), macOS 14.6.1 (amd64), and macOS 15.0 (arm64)
by spawning `/usr/bin/ulimit -a -S` and `/usr/sbin/lsof -c $my_process` from
the test exporter process, and `ps -o lstart,vsize,rss,utime,stime,command` from
the shell, and comparing results with the exported metrics.

I can't find documentation for `RLIMIT_AS` on macOS (specifically if it's in
bytes or pages).  It's currently being reported back as `RLIM_INFINITY`, which
seems reasonable, because I've come across reports that the value is ignored
anyway[1].  The bash 3.2 code for the built-in `ulimit` divides the value
reported by `getrusage(2)` by 1024 when printing, as it does for `RLIMIT_DATA`,
which is documented as being bytes in `getrusage(2)`.  The help for `ulimit`
indicates it prints both in kbytes, so it's reasonable to assume this is already
in bytes.

[1] https://issues.chromium.org/issues/40581251#comment3

Signed-off-by: Matt Harbison <mharbison72@gmail.com>

* Update prometheus/process_collector_darwin.go

Co-authored-by: Ben Kochie <superq@gmail.com>
Signed-off-by: Matt Harbison <57785103+mharbison72@users.noreply.github.com>

---------

Signed-off-by: Matt Harbison <mharbison72@gmail.com>
Signed-off-by: Matt Harbison <57785103+mharbison72@users.noreply.github.com>
Co-authored-by: Ben Kochie <superq@gmail.com>
Co-authored-by: Bartlomiej Plotka <bwplotka@gmail.com>
2024-09-04 15:56:01 +01:00
PrometheusBot 97aa0493eb
Update common Prometheus files (#1615)
Signed-off-by: prombot <prometheus-team@googlegroups.com>
2024-09-03 10:00:24 +01:00
Bartlomiej Plotka fa4f164b6d
examples: Improved GoCollector example. (#1589)
Signed-off-by: bwplotka <bwplotka@gmail.com>
2024-09-02 16:43:16 +02:00
github-actions[bot] 30da80dfe1
Merge pull request #1614 from prometheus/dependabot/github_actions/github-actions-aadb7c6e64
build(deps): bump github/codeql-action from 3.25.15 to 3.26.6 in the github-actions group across 1 directory
2024-09-02 11:48:22 +00:00
dependabot[bot] fd3057a6e0
build(deps): bump github/codeql-action
Bumps the github-actions group with 1 update in the / directory: [github/codeql-action](https://github.com/github/codeql-action).


Updates `github/codeql-action` from 3.25.15 to 3.26.6
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](afb54ba388...4dd16135b6)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: github-actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-02 11:41:39 +00:00
Ben Kochie 2cc3a2f5e8
Update Dagger and build. (#1610)
* Update Dagger and build

* Update dagger actions to use pinnning.
* Add /dagger to dependabot to keep the Dagger modules up-to-date.
* Update dagger default Go version.
* Update tutorials/whatsup Go version.
* Update actions to use pinning.

Signed-off-by: SuperQ <superq@gmail.com>

---------

Signed-off-by: SuperQ <superq@gmail.com>
Signed-off-by: Arthur Silva Sens <arthursens2005@gmail.com>
Co-authored-by: Arthur Silva Sens <arthursens2005@gmail.com>
2024-09-02 11:40:53 +00:00
Parth Lawania 850b6c0898
changed the name of all variables with min/max name (#1606)
* changed the name of all variables with min/max name

Signed-off-by: Parth Lawania <parthlawania@gmail.com>

* removed predeclared ignore condition for min and max identifiers

Signed-off-by: Parth Lawania <parthlawania@gmail.com>

---------

Signed-off-by: Parth Lawania <parthlawania@gmail.com>
Co-authored-by: Parth Lawania <parth.lawania@super.money>
2024-09-02 07:41:40 -03:00
github-actions[bot] 67683fd07e
Merge pull request #1612 from prometheus/dependabot/go_modules/github.com/prometheus/common-0.57.0
build(deps): bump github.com/prometheus/common from 0.55.0 to 0.57.0
2024-09-01 09:09:58 +00:00
github-actions[bot] 0ac5bf38af
Merge pull request #1611 from prometheus/dependabot/go_modules/golang.org/x/sys-0.24.0
build(deps): bump golang.org/x/sys from 0.22.0 to 0.24.0
2024-09-01 09:09:45 +00:00
dependabot[bot] 25ed766abc
build(deps): bump github.com/prometheus/common from 0.55.0 to 0.57.0
Bumps [github.com/prometheus/common](https://github.com/prometheus/common) from 0.55.0 to 0.57.0.
- [Release notes](https://github.com/prometheus/common/releases)
- [Changelog](https://github.com/prometheus/common/blob/main/RELEASE.md)
- [Commits](https://github.com/prometheus/common/compare/v0.55.0...v0.57.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-09-01 09:02:44 +00:00
dependabot[bot] 4c369166c3
build(deps): bump golang.org/x/sys from 0.22.0 to 0.24.0
Bumps [golang.org/x/sys](https://github.com/golang/sys) from 0.22.0 to 0.24.0.
- [Commits](https://github.com/golang/sys/compare/v0.22.0...v0.24.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-09-01 09:02:39 +00:00
Arthur Silva Sens 0a90db7327
Merge pull request #1602 from prometheus/superq/update_go
Update supported Go versions
2024-08-31 18:13:14 -03:00
SuperQ c85ae6b1fe
Update supported Go versions
Now that 1.23 is out, update the supported version matrix to Go 1.21
through 1.23. This allows us to start using `log/slog`.
* Update generated tests.

Signed-off-by: SuperQ <superq@gmail.com>
2024-08-31 22:47:31 +02:00
Arthur Silva Sens ffc4cc6470
Merge pull request #1603 from prometheus/superq/cleanup_lint
Update linting
2024-08-31 12:19:12 -03:00
SuperQ e080e48d5b
Update linting
* Update golangci-lint from upstream prometheus repo.
* Ignore min/max in predeclared.
* Fix `Errorf()` use.

Signed-off-by: SuperQ <superq@gmail.com>
2024-08-30 18:09:51 +02:00
Arthur Silva Sens dbf72fc1a2
Merge pull request #1593 from prometheus/release-1.20
Merge release-1.20 back to main
2024-08-25 14:50:40 -03:00
Arthur Silva Sens 67121dc55a
Merge pull request #1596 from mrueg/fix-uncompressed-content-header
fix: Unset Content-Encoding header when uncompressed
2024-08-23 16:09:01 -03:00
Manuel Rüger 187acd4ca1 Cut 1.20.2
Signed-off-by: Manuel Rüger <manuel@rueg.eu>
2024-08-23 18:55:43 +02:00
Manuel Rüger f7f8f3a1e2 fix: Unset Content-Encoding header when uncompressed
Fixes: #1595
Signed-off-by: Manuel Rüger <manuel@rueg.eu>
2024-08-23 18:53:42 +02:00
Arthur Silva Sens 2254d6c308
Merge pull request #1587 from prometheus/fix-processcollector
Fix processcollector
2024-08-20 08:43:51 -03:00
bwplotka 4a15d05846 Cut 1.20.1
Signed-off-by: bwplotka <bwplotka@gmail.com>
2024-08-20 11:46:16 +01:00
bwplotka f2dd7b35fd Use pedantic registry in other places too, to double check.
Signed-off-by: bwplotka <bwplotka@gmail.com>
2024-08-20 11:44:35 +01:00
Arthur Silva Sens 261fe84cd4 bugfix: Pass network metrics to processCollector's Describe() function
Signed-off-by: Arthur Silva Sens <arthursens2005@gmail.com>
2024-08-20 11:44:35 +01:00
Arthur Silva Sens 5bf3341b66 Use NewPedanticRegistry in Process' Collector tests
Signed-off-by: Arthur Silva Sens <arthursens2005@gmail.com>
2024-08-20 11:44:35 +01:00