Commit graph

12467 commits

Author SHA1 Message Date
Björn Rabenstein af3618fd35
Merge pull request #13667 from prometheus/beorn7/promql
Improve TestQueryStatistics and fix bugs exposed by it
2024-03-12 16:17:11 +01:00
Bryan Boreham 0bb5588386
labels: optimize String method (#13673)
Use a stack buffer to reduce memory allocations.

`Write(AppendQuote(AvailableBuffer` does not allocate or copy when
the buffer has sufficient space.

Also add a benchmark, with some refactoring.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2024-03-12 11:34:03 +00:00
Bryan Boreham d08f054950
[ENHANCEMENT] TSDB: Check CRC without allocating (#13742)
Use the existing utility function which does this.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2024-03-12 12:24:27 +01:00
Julien ca57bd6352
Merge pull request #13743 from carrychair/main
fix function and struct names in comments
2024-03-12 11:50:25 +01:00
Julien 106d98b986
Merge pull request #13751 from testwill/http_statuscode
chore: use constant instead of numeric literal
2024-03-12 11:41:34 +01:00
guoguangwu 1cccdbaedb chore: use constant instead of numeric literal
Signed-off-by: guoguangwu <guoguangwug@gmail.com>
2024-03-12 17:19:50 +08:00
Julien b4d4dcd9f6
Merge pull request #13739 from bboreham/no-race-prev-go
CI: don't run race-detector on tests with previous Go version
2024-03-11 13:55:19 +01:00
carrychair 856f6e49c8 fix function and struct name
Signed-off-by: carrychair <linghuchong404@gmail.com>
2024-03-09 17:53:17 +08:00
michaelact eea6ab1cdd
[BUGFIX] Azure SD: Fix 'error: parameter virtualMachineScaleSetName cannot be empty' (#13702)
Erroneous code was introduced during a merge-back-to-main at #13399.

Signed-off-by: michaelact <86778470+michaelact@users.noreply.github.com>
2024-03-08 15:19:39 +00:00
Bryan Boreham e8bf2ce4e1
Merge pull request #13735 from bboreham/fix-notifier-relabel
[BUGFIX] Alerts: don't reuse payload after relabeling.
2024-03-08 12:29:36 +00:00
Bryan Boreham 54f50e1498
Merge pull request #13737 from bboreham/fix-scrape-tolerance
[BUGFIX] Scraping: Tolerance should be max 1% of interval
2024-03-08 12:28:04 +00:00
Bryan Boreham e54082a621 CI: don't run race-detector on tests with previous Go version
The purpose of running with a previous Go version is to spot usage of
new language features; we don't need to intensively look for bugs.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2024-03-08 10:38:10 +00:00
Bryan Boreham 6c41ec984f [BUGFIX] Scraping: Tolerance should be max 1% of interval
Previous code set it at minimum 1%, which was not intended.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2024-03-08 10:18:18 +00:00
Bryan Boreham 8c4e4b72a8 Notifier: pass parameters to goroutine explicitly
Avoids possible false sharing between loops.

Plausibly there is no problem in the current code, but it's easy enough to write it more safely.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2024-03-08 09:20:36 +00:00
Bryan Boreham 57c799132b Notifier: don't reuse payload after relabeling
Also clarify why these variables are being cleared.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2024-03-08 09:16:43 +00:00
Björn Rabenstein 9acae57937
Merge pull request #13681 from krajorama/native-latency-histograms
Add native histograms to latency/duration metrics
2024-03-07 20:46:43 +01:00
Bryan Boreham 3d16d39881
Merge pull request #13716 from prometheus/update-go-deps
Update Go dependencies for v2.51
2024-03-07 12:05:58 +00:00
Björn Rabenstein b0c0961f9d
Merge pull request #13725 from prometheus/beorn7/promql2
promql: Fix limiting of extrapolation to negative values
2024-03-07 12:36:17 +01:00
Bryan Boreham 28f8a346bc Wind back gophercloud to 1.8.0
It triggers a failure in TestOpenstackSDInstanceRefresh.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2024-03-07 10:13:59 +00:00
Bryan Boreham 34a655716e Back off google.golang.org/protobuf to v1.32.0
Otherwise we get a compilation error.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2024-03-07 10:13:59 +00:00
Bryan Boreham 3c2c9ac067 Update Go dependencies for v2.51
Simply make update-all-go-deps

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2024-03-07 10:13:59 +00:00
Bryan Boreham e705d83e37
Merge pull request #13721 from bboreham/no-codeql-go
CI: stop running codeql for Go
2024-03-07 10:09:53 +00:00
Bryan Boreham b965aac82d
Merge pull request #13722 from bboreham/split-go-tests
CI: split Go tests into two parts, to run in parallel
2024-03-07 10:09:13 +00:00
beorn7 7f912db15a promql: Fix limiting of extrapolation to negative values
This is a bit tough to explain, but I'll try:

`rate` & friends have a sophisticated extrapolation algorithm.
Usually, we extrapolate the result to the total interval specified in
the range selector. However, if the first sample within the range is
too far away from the beginning of the interval, or if the last sample
within the range is too far away from the end of the interval, we
assume the series has just started half a sampling interval before the
first sample or after the last sample, respectively, and shorten the
extrapolation interval correspondingly. We calculate the sampling
interval by looking at the average time between samples within the
range, and we define "too far away" as "more than 110% of that
sampling interval".

However, if this algorithm leads to an extrapolated starting value
that is negative, we limit the start of the extrapolation interval to
the point where the extrapolated starting value is zero.

At least that was the intention.

What we actually implemented is the following: If extrapolating all
the way to the beginning of the total interval would lead to an
extrapolated negative value, we would only extrapolate to the zero
point as above, even if the algorithm above would have selected a
starting point that is just half a sampling interval before the first
sample and that starting point would not have an extrapolated negative
value. In other word: What was meant as a _limitation_ of the
extrapolation interval yielded a _longer_ extrapolation interval in
this case.

There is an exception to the case just described: If the increase of
the extrapolation interval is more than 110% of the sampling interval,
we suddenly drop back to only extrapolate to half a sampling interval.

This behavior can be nicely seen in the testcounter_zero_cutoff test,
where the rate goes up all the way to 0.7 and then jumps back to 0.6.

This commit changes the behavior to what was (presumably) intended
from the beginning: The extension of the extrapolation interval is
only limited if actually needed to prevent extrapolation to negative
values, but the "limitation" never leads to _more_ extrapolation
anymore.

The difference is subtle, and probably it never bothered anyone.
However, if you calculate a rate of a classic histograms, the old
behavior might create non-monotonic histograms as a result (because of
the jumps you can see nicely in the old version of the
testcounter_zero_cutoff test). With this fix, that doesn't happen
anymore.

Signed-off-by: beorn7 <beorn@grafana.com>
2024-03-07 01:20:33 +01:00
Bryan Boreham 864c994932 CI: split Go tests into two parts, to run in parallel
Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2024-03-06 19:17:49 +00:00
Bryan Boreham 6fd7c0c297
Merge pull request #13717 from ArthurSens/update-clientgolang
Bump client_golang to 1.19, common to 0.49.1
2024-03-06 18:38:44 +00:00
Bryan Boreham 05fbc23930 CI: stop running codeql for Go
It takes around 20 minutes and has never told us anything interesting.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2024-03-06 18:27:01 +00:00
Bryan Boreham d9843fe9b4
Merge pull request #13715 from bboreham/tests-with-stringlabels
CI: run main tests with --tags=stringlabels
2024-03-06 18:15:17 +00:00
Bryan Boreham 620388bf82
Merge pull request #13405 from machine424/ci
chore(ci): Run all tests on the oldest golang version
2024-03-06 18:12:58 +00:00
Bryan Boreham bdfc309c61 Update to prometheus/common without Host member
Commit 4199f18c3e92.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2024-03-06 18:03:49 +00:00
Björn Rabenstein 0a426215b5
Merge pull request #13718 from thirdkeyword/main
docs: fix some typos
2024-03-06 14:17:07 +01:00
Björn Rabenstein 01a960a2a1
Merge pull request #13707 from machine424/lint-fix
add a common-lint-fix make target to make golangci-lint fix found iss…
2024-03-06 14:08:59 +01:00
thirdkeyword 5fc1bf1bf0 docs: fix some typos
Signed-off-by: thirdkeyword <fliterdashen@gmail.com>
2024-03-06 20:55:35 +08:00
Bryan Boreham bbe39af99f
tsdb: zero out Labels and memSeries pointers in pool (#13712)
* tsdb: zero out Labels and memSeries pointers in pool

So that the garbage-collector doesn't see this memory as still in use.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>

---------

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
Signed-off-by: Björn Rabenstein <github@rabenste.in>
Co-authored-by: Björn Rabenstein <github@rabenste.in>
2024-03-06 13:36:34 +01:00
Arthur Silva Sens 07355c9199
Bump client_golang to 1.19
Signed-off-by: Arthur Silva Sens <arthur.sens@coralogix.com>
2024-03-06 09:11:13 -03:00
Bryan Boreham 0eb39a604b
Merge pull request #13714 from bboreham/fix-testendpoints
API tests: fix flaky TestEndpoints
2024-03-06 11:43:29 +00:00
machine424 6998bfab59
add a common-lint-fix make target to make golangci-lint fix found issues if it's supported by the linter
clean up common-lint target

Signed-off-by: machine424 <ayoubmrini424@gmail.com>
2024-03-06 12:06:02 +01:00
Bryan Boreham 63bc17ab9b CI: run main tests with --tags=stringlabels
This is what we use for builds, so do the main testing (with -race) under that flag.

Drop non-stringlabels tests from current Go version; previous Go version still runs them.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2024-03-06 10:32:17 +00:00
Bryan Boreham 25f200bf85 API tests: fix flaky TestEndpoints
When a limit is specified, the API may return arbitrary rows, so don't
check specific response values.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2024-03-06 09:59:18 +00:00
Björn Rabenstein e6b7bbcb6a
Merge pull request #13682 from duricanikolic/yuri/engine-test
SampleRingIterator: add currType field
2024-03-05 23:16:52 +01:00
Bryan Boreham 4c00445540
Merge pull request #13704 from darshanime/fix_ci
Fix lint error
2024-03-05 20:02:40 +00:00
beorn7 7df0b9b92d storage: simplify sampleRing fix
Signed-off-by: beorn7 <beorn@grafana.com>
2024-03-05 15:41:18 +01:00
darshanime 61ce18950f Fix pipeline golangci-lint error
Signed-off-by: darshanime <deathbullet@gmail.com>
2024-03-05 00:45:07 +05:30
Ben Kochie 80cfaa7698
Merge pull request #13654 from prometheus/dependabot/go_modules/google.golang.org/api-0.167.0
build(deps): bump google.golang.org/api from 0.157.0 to 0.167.0
2024-03-04 17:18:59 +01:00
Julien 88622cfa2c
Merge pull request #12551 from nabokihms/alertmanager-relabeling-config
Route different alerts to different alertmanagers
2024-03-04 16:45:00 +01:00
Julien fcdb6c2b14
Merge pull request #13624 from roidelapluie/tolerance
Always align scrapes even if tolerance is bigger than 1% of scrape interval
2024-03-04 16:37:00 +01:00
Ben Kochie 91821b7b21
Merge pull request #13696 from prometheus/dependabot/go_modules/documentation/examples/remote_storage/github.com/stretchr/testify-1.9.0
build(deps): bump github.com/stretchr/testify from 1.8.4 to 1.9.0 in /documentation/examples/remote_storage
2024-03-04 16:32:34 +01:00
dependabot[bot] eb665988b0
build(deps): bump google.golang.org/api from 0.157.0 to 0.167.0
Bumps [google.golang.org/api](https://github.com/googleapis/google-api-go-client) from 0.157.0 to 0.167.0.
- [Release notes](https://github.com/googleapis/google-api-go-client/releases)
- [Changelog](https://github.com/googleapis/google-api-go-client/blob/main/CHANGES.md)
- [Commits](https://github.com/googleapis/google-api-go-client/compare/v0.157.0...v0.167.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-04 15:20:46 +00:00
Julien c0cbb8082b
Merge pull request #13675 from kokes/parser_next_doc
docs: textparse.Parser return type mismatch
2024-03-04 16:19:53 +01:00
Julien 2d9ccf89d0
Merge pull request #13686 from prometheus/dependabot/go_modules/go-opentelemetry-io-0441a389d0
build(deps): bump the go-opentelemetry-io group with 10 updates
2024-03-04 16:19:17 +01:00