Commit graph

9015 commits

Author SHA1 Message Date
Oleg Zaytsev 4d654ee22b
Benchmark Labels.Get() and document the result (#9242)
While implementing a different feature, I found that Labels.Get() was
performing a linear search. I wondered whether it would perform any
better with a binary search approach, and wrote a benchmark: the answer
is that it's probably doesn't worth it, so I just decided to leave the
benchmark and the results for the next reader.

Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com>
2021-08-24 16:35:19 +05:30
Oleg Zaytsev 280eaf33f0
Use global string map for MatchType.String() (#9237)
* Use global string map for MatchType.String()

We were unnecessarily creating a new map for each call of String().

This is a 10x improvement in MatchType.String() performance in time,
from 53ns to 4ns on my i7 laptop, and I guess that this method is being
called quite often so why throw out the resources.

I was surprised that benchmark says that there are no allocations made
in the old version.

I also tries using `//go:generate stringer` and the result is even
better, at about 2.8ns, but having to keep the generated code updated
isn't worth the change (at least it's bigger than a small change I was
intended to do)

Benchmark comparison:

    name \ time/op    old          global_map  stringer
    MatchType_String  53.6ns ± 1%  4.1ns ± 1%  2.8ns ± 1%

    name \ alloc/op   old          global_map  stringer
    MatchType_String   0.00B       0.00B       0.00B

    name \ allocs/op  old          global_map  stringer
    MatchType_String    0.00        0.00        0.00

Old benchmark:

    goos: darwin
    goarch: amd64
    pkg: github.com/prometheus/prometheus/pkg/labels
    cpu: Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
    BenchmarkMatchType_String 	21766578	        54.36 ns/op	       0 B/op	       0 allocs/op
    BenchmarkMatchType_String 	21742339	        53.28 ns/op	       0 B/op	       0 allocs/op
    BenchmarkMatchType_String 	21985470	        53.37 ns/op	       0 B/op	       0 allocs/op
    BenchmarkMatchType_String 	21676282	        53.50 ns/op	       0 B/op	       0 allocs/op
    BenchmarkMatchType_String 	22075573	        53.33 ns/op	       0 B/op	       0 allocs/op
    PASS
    ok  	github.com/prometheus/prometheus/pkg/labels	6.252s

New with global map:

    goos: darwin
    goarch: amd64
    pkg: github.com/prometheus/prometheus/pkg/labels
    cpu: Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
    BenchmarkMatchType_String 	283412692	         4.129 ns/op	       0 B/op	       0 allocs/op
    BenchmarkMatchType_String 	294859941	         4.091 ns/op	       0 B/op	       0 allocs/op
    BenchmarkMatchType_String 	295750158	         4.113 ns/op	       0 B/op	       0 allocs/op
    BenchmarkMatchType_String 	282827982	         4.072 ns/op	       0 B/op	       0 allocs/op
    BenchmarkMatchType_String 	292942393	         4.047 ns/op	       0 B/op	       0 allocs/op
    PASS
    ok  	github.com/prometheus/prometheus/pkg/labels	8.238s

Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com>

* Use array instead of map

Since MatchType is an iota type, we can safely use an array here.

This solution is even better:

    name \ time/op    old          global_map  stringer    array
    MatchType_String  53.6ns ± 1%  4.1ns ± 1%  2.8ns ± 1%  1.0ns ± 1%

    name \ alloc/op   old          global_map  stringer    array
    MatchType_String   0.00B       0.00B       0.00B       0.00B

    name \ allocs/op  old          global_map  stringer    array
    MatchType_String    0.00        0.00        0.00        0.00

Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com>

* Benchmark all MatchType values

Co-authored-by: Ganesh Vernekar <15064823+codesome@users.noreply.github.com>
Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com>

* Use constants for limits

Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com>

Co-authored-by: Ganesh Vernekar <15064823+codesome@users.noreply.github.com>

Co-authored-by: Ganesh Vernekar <15064823+codesome@users.noreply.github.com>
2021-08-24 11:26:16 +05:30
Augustin Husson 54dfee02b2
move codemirror-promql as a prometheus web module (#9188)
* move codemirror-promql as a prometheus web module

Signed-off-by: Augustin Husson <husson.augustin@gmail.com>

* remove unecessary file for the codemirror module

Signed-off-by: Augustin Husson <husson.augustin@gmail.com>

* change license for Apache

Signed-off-by: Augustin Husson <husson.augustin@gmail.com>

* fix codemirror build

Signed-off-by: Augustin Husson <husson.augustin@gmail.com>
2021-08-20 11:39:07 +02:00
Dorian JAMINAIS 05dba96ebf
Add option for the number of ticks in PromConsole.Graph (#9223)
Signed-off-by: Dorian Jaminais-Grellier <dorian@jaminais.fr>
2021-08-20 08:24:31 +02:00
Bryan Boreham 9dfdc3eb36
Speed up BenchmarkPostings_Stats (#9213)
The previous code re-used series IDs 1-1000 many times over, so a lot
of time was spent ensuring the lists of series were in ascending order.
The intended use of `MemPostings.Add()` is that all series IDs are
unique, and changing the benchmark to do this lets it finish ten times
faster.

(It doesn't affect the benchmark result, just the setup code)

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2021-08-18 10:27:21 +01:00
Ganesh Vernekar 328a74ca36
Fix bugs and add enhancements to the chunk snapshot (#9185)
Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
2021-08-17 18:08:16 +01:00
Julius Volz bb05485c79
Fix JS/CSS asset paths for classic /config page (#9202)
Fixes https://github.com/prometheus/prometheus/issues/9130

Signed-off-by: Julius Volz <julius.volz@gmail.com>
2021-08-13 18:10:31 +02:00
Björn Rabenstein 9c43ac451c
Merge pull request #9129 from PhilipGough/bz-1984365
mixin: Filter instance by selected job for Prometheus overview dashboard
2021-08-13 14:03:16 +02:00
Jupiter 84ab705318
32 should better be replaced by "symbolFactor" (#9203)
Signed-off-by: tanghengjian <1040104807@qq.com>
2021-08-13 16:38:53 +05:30
Marco Pracucci 84e786ebc1
Fixed Decoder.Series() error checking (#9201)
Signed-off-by: Marco Pracucci <marco@pracucci.com>
2021-08-13 16:11:41 +05:30
Augustin Husson 7291563d4d
replace yarn by npm (#9198)
Signed-off-by: Augustin Husson <husson.augustin@gmail.com>
2021-08-12 20:25:26 +02:00
Julien Pivotto cab96a06ef
Merge release 2.29 in main (#9196)
* PromQL: Fix start and end keywords masking label and metric names

This commit fixes an issue with the "at modifier" that introduced two
new keywords: `start` and `end`. In grouping options and in metric
names, these keywords took precedence over metric or label names, so
that those metrics and labels could no longer be referenced.

Signed-off-by: Clayton Peters <clayton.peters@man.com>

* Add in additional tests for metrics and/or labels called start/end.

Signed-off-by: Clayton Peters <clayton.peters@man.com>

* *: Cut 2.29.0-rc.0

Signed-off-by: Frederic Branczyk <fbranczyk@gmail.com>

* VERSION: bump to 2.29.0-rc.0

Signed-off-by: Frederic Branczyk <fbranczyk@gmail.com>

* Remove experimental wording on size-based retention

Followup of #9004

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>

* Fix PR reference in changelog

Signed-off-by: George Brighton <george@gebn.co.uk>

* Describe EC2 availability zone IDs at most once per refresh (#9142)

Signed-off-by: George Brighton <george@gebn.co.uk>

* Describe EC2 availability zones at most once per SD load

Closes #9142.

Signed-off-by: George Brighton <george@gebn.co.uk>

* Incorporate feedback

Signed-off-by: George Brighton <george@gebn.co.uk>

* Integrate feedback

Signed-off-by: George Brighton <george@gebn.co.uk>

* Add a compatibility note for macOS users.

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>

* *: Cut v2.29.0-rc.1

Signed-off-by: Frederic Branczyk <fbranczyk@gmail.com>

* Fix `kuma_sd` targetgroup reporting (#9157)

* Bundle all xDS targets into a single group

Signed-off-by: austin ce <austin.cawley@gmail.com>

* *: cut v2.29.0-rc.2

Signed-off-by: Frederic Branczyk <fbranczyk@gmail.com>

* Rename links

Signed-off-by: Levi Harrison <git@leviharrison.dev>

* bump codemirror-promql to 0.17.0

Signed-off-by: Augustin Husson <husson.augustin@gmail.com>

* *: cut v2.29.0

Signed-off-by: Frederic Branczyk <fbranczyk@gmail.com>

* tsdb: align atomically accessed int64 (#9192)

This prevents a panic in 32-bit archs:
https://pkg.go.dev/sync/atomic#pkg-note-BUG

Fixed #9190

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>

* Release 2.29.1 (#9193)

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>

Co-authored-by: Clayton Peters <clayton.peters@man.com>
Co-authored-by: Frederic Branczyk <fbranczyk@gmail.com>
Co-authored-by: George Brighton <george@gebn.co.uk>
Co-authored-by: Austin Cawley-Edwards <austin.cawley@gmail.com>
Co-authored-by: Levi Harrison <git@leviharrison.dev>
Co-authored-by: Augustin Husson <husson.augustin@gmail.com>
2021-08-12 18:38:06 +02:00
Julius Volz b7e9f2481b
Remove search keymap from new expression editor (#9184)
Signed-off-by: Julius Volz <julius.volz@gmail.com>
2021-08-10 17:10:41 +02:00
Levi Harrison 44e2834960
Split Go and React Tests (#8897)
* Added go-ci and react-ci

Co-authored-by: Julien Pivotto <roidelapluie@inuits.eu>
Signed-off-by: Levi Harrison <git@leviharrison.dev>
2021-08-10 16:50:09 +02:00
Bryan Boreham 040ef175eb
Optimise WAL loading by removing extra map and caching min-time (#9160)
* BenchmarkLoadWAL: close WAL after use

So that goroutines are stopped and resources released

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

* BenchmarkLoadWAL: make series IDs co-prime with #workers

Series are distributed across workers by taking the modulus of the
ID with the number of workers, so multiples of 100 are a poor choice.

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

* BenchmarkLoadWAL: simulate mmapped chunks

Real Prometheus cuts chunks every 120 samples, then skips those samples
when re-reading the WAL. Simulate this by creating a single mapped chunk
for each series, since the max time is all the reader looks at.

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

* Fix comment

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

* Remove series map from processWALSamples()

The locks that is commented to reduce contention in are now sharded
32,000 ways, so won't be contended. Removing the map saves memory and
goes just as fast.

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

* loadWAL: Cache the last mmapped chunk time

So we can skip calling append() for samples it will reject.

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

* Improvements from code review

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

* Full stops and capitals on comments

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

* Cache max time in both places mmappedChunks is updated

Including refactor to extract function `setMMappedChunks`, to reduce
code duplication.

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

* Update head min/max time when mmapped chunks added

This ensures we have the correct values if no WAL samples are added for
that series.

Note that `mSeries.maxTime()` was always `math.MinInt64` before, since
that function doesn't consider mmapped chunks.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2021-08-10 14:53:31 +05:30
Bryan Boreham 7407457243
Avoid deadlock when processing duplicate series record (#9170)
* Avoid deadlock when processing duplicate series record

`processWALSamples()` needs to be able to send on its output channel
before it can read the input channel, so reads to allow this in case the
output channel is full.

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

* processWALSamples: update comment

Previous text seems to relate to an earlier implementation.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2021-08-10 13:32:42 +05:30
Levi Harrison fac1b57334
Remove Individual Data Type Caps in Per-shard Buffering for Remote Write (#8921)
* Moved everything to nPending buffer

Signed-off-by: Levi Harrison <git@leviharrison.dev>

* Simplify exemplar capacity addition

Signed-off-by: Levi Harrison <git@leviharrison.dev>

* Added pre-allocation

Signed-off-by: Levi Harrison <git@leviharrison.dev>

* Don't allocate if not sending exemplars

Signed-off-by: Levi Harrison <git@leviharrison.dev>
2021-08-09 15:20:53 -06:00
Julien Pivotto e8663a4eac
Merge pull request #9167 from LeviHarrison/rename-disabled-features-links
Update more "Disabled Features" links to new name
2021-08-09 13:00:23 +02:00
Levi Harrison b9b5adfe62 Rename links
Signed-off-by: Levi Harrison <git@leviharrison.dev>
2021-08-06 21:54:44 -06:00
Ganesh Vernekar ee7e0071d1
Snapshot in-memory chunks on shutdown for faster restarts (#7229)
Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
2021-08-06 17:51:01 +01:00
Austin Cawley-Edwards 5df37892aa
Fix kuma_sd targetgroup reporting (#9157)
* Bundle all xDS targets into a single group

Signed-off-by: austin ce <austin.cawley@gmail.com>
2021-08-06 01:29:15 +02:00
TJ Hoplock 7baf084092
optimize Linode SD by polling for event changes during refresh (#8980)
* optimize Linode SD by polling for event changes during refresh

Most accounts are fairly "static", in the sense that they're not cycling
through instances constantly. So rather than do a full refresh every
interval and potentially make several behind-the-scenes paginated API
calls, this will now poll the `/account/events/` endpoint every minute
with a list of events that we care about. If a matching event is found,
we then do a full refresh.

Co-authored-by: William Smith <wsmith@linode.com>
Signed-off-by: TJ Hoplock <t.hoplock@gmail.com>
Signed-off-by: William Smith <wsmith@linode.com>
2021-08-04 12:05:49 +02:00
Julien Pivotto 03bee3b5df
Merge pull request #9125 from LeviHarrison/docker_sd-host-networking
docker_sd: Support host network mode
2021-08-04 01:14:39 +02:00
Ganesh Vernekar 848cb5a6d6
Enhanced WAL replay for duplicate series record (#7438)
Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
2021-08-03 20:03:54 +05:30
Ganesh Vernekar 8002a3ab80
Breakdown tsdb/head.go into multiple files (#9147)
Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
2021-08-03 14:14:26 +02:00
Levi Harrison c1b1b826ce HostNetworkHost -> HostNetworkingHost
Signed-off-by: Levi Harrison <git@leviharrison.dev>
2021-08-03 05:58:49 -06:00
Julien Pivotto bd7ebf29c9
Merge pull request #9006 from LeviHarrison/fix-consoles-css
Consoles: Fix broken Node Overview page
2021-08-03 12:50:59 +02:00
Julien Pivotto 24165adadc
Merge pull request #9112 from darshanime/add_computer_name
Add computer name to azure sd
2021-07-30 09:58:49 +02:00
jinglina 1a430e5f89
remove redundant parentheses (#9134)
Signed-off-by: jinglina <jinglinax@163.com>
2021-07-29 18:26:57 +05:30
Darshan Chaudhary c4f2e9eec5
Add present_over_time (#9097)
* Add present_over_time

Signed-off-by: darshanime <deathbullet@gmail.com>

* Add tests for present_over_time

Signed-off-by: darshanime <deathbullet@gmail.com>

* Address PR comments

Signed-off-by: darshanime <deathbullet@gmail.com>

* Add documentation for present_over_time

Signed-off-by: darshanime <deathbullet@gmail.com>

* Update documentation

Signed-off-by: darshanime <deathbullet@gmail.com>

* Update documentation comment

Signed-off-by: darshanime <deathbullet@gmail.com>
2021-07-29 12:38:11 +02:00
Frederic Branczyk e2db44b653
Merge pull request #9132 from brancz/dependency-bump
Dependency bump in preparation for 2.29
2021-07-29 10:08:35 +02:00
Frederic Branczyk fd8e8218a7
Update UI dependencies
Signed-off-by: Frederic Branczyk <fbranczyk@gmail.com>
2021-07-29 09:11:14 +02:00
Frederic Branczyk a266d4d2c5
Update Go dependencies
Signed-off-by: Frederic Branczyk <fbranczyk@gmail.com>
2021-07-29 09:11:04 +02:00
Levi Harrison 8baaceab77
Cleaned up a little bit of HTML
Signed-off-by: Levi Harrison <git@leviharrison.dev>
2021-07-28 20:12:06 -04:00
Julien Pivotto 003b7b2172
Merge pull request #9128 from prometheus/richih/1
Make clear that start/end are inclusive
2021-07-28 17:46:39 +02:00
Julien Pivotto 4b5b061427
Merge pull request #9127 from codesome/containerd
Upgrade containerd to v1.5.4
2021-07-28 17:46:01 +02:00
darshanime 898afa2fd9 Add nil checks
Signed-off-by: darshanime <deathbullet@gmail.com>
2021-07-28 19:23:17 +05:30
Philip Gough 751ca03fad mixin: Filter instance by job for Prometheus overview dashboard
Signed-off-by: Philip Gough <philip.p.gough@gmail.com>
2021-07-28 14:34:26 +01:00
Oleg Zaytsev f9482c5bf6
Clarify computeChunkEndTime's purpose (#9049)
I was struggling to understand the purpose of this method until I
tweaked the tests, so I decided to write down my observations.

Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com>
2021-07-28 18:39:05 +05:30
Richard Hartmann d68d3983d8 Make clear that start/end are inclusive
Fixes: https://github.com/prometheus/prometheus/issues/9100

Signed-off-by: Richard Hartmann <richih@richih.org>
2021-07-28 14:52:02 +02:00
Ganesh Vernekar 79cfe2d1ec
Upgrade containerd to v1.5.4
Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
2021-07-28 15:10:34 +05:30
jinglina ed24e51e7c
remove redundant type conversion (#9126)
Signed-off-by: jinglina <jinglinax@163.com>
2021-07-28 13:33:46 +05:30
Levi Harrison 3556302c76
Added docs
Signed-off-by: Levi Harrison <git@leviharrison.dev>
2021-07-27 23:33:40 -04:00
Levi Harrison 89f154d643 Added tests
Signed-off-by: Levi Harrison <git@leviharrison.dev>
2021-07-27 23:33:28 -04:00
Levi Harrison 41be43647b
Implemented host_network_host setting
Signed-off-by: Levi Harrison <git@leviharrison.dev>
2021-07-27 23:20:04 -04:00
Julien Pivotto 8b716d8db7
Merge pull request #9123 from LeviHarrison/change-tls-doc
Add notice to TLS to `client_auth_type`
2021-07-28 01:27:44 +02:00
Bryan Boreham 60804c5a09
remote_write: reduce blocking from garbage-collect of series (#9109)
* Refactor: pass segment-reading function as param

To allow a different implementation to be used when garbage-collecting.

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

* remote_write: reduce blocking from GC of series

Add a method `UpdateSeriesSegment()` which is used together with
`SeriesReset()` to garbage-collect old series. This allows us to
split the lock around queueManager series data and avoid blocking
`Append()` while reading series from the last checkpoint.

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

* Cosmetic: review feedback on comments

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

* remote-write benchmark: include GC of series

Reduce the total number of samples per iteration from 5000*5000
(25 million) which is too big for my laptop, to 1*10000.

Extend `createTimeseries()` to add additional labels, so that the
queue manager is doing more realistic work.

Move the Append() call to a background goroutine - this works because
TestWriteClient uses a WaitGroup to signal completion.

Call `StoreSeries()` and `SeriesReset()` while adding samples, to
simulate the garbage-collection that wal.Watcher does.

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

* Change BenchmarkSampleDelivery to call UpdateSeriesSegment

This matches what Watcher.garbageCollectSeries() is doing now

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2021-07-27 13:21:48 -07:00
Levi Harrison a8850a0819
Add note to docs
Signed-off-by: Levi Harrison <git@leviharrison.dev>

Co-authored-by: Julien Pivotto <roidelapluie@inuits.eu>
2021-07-27 13:43:52 -04:00
Levi Harrison 72865de915
Update exporter-toolkit
Signed-off-by: Levi Harrison <git@leviharrison.dev>
2021-07-27 13:43:32 -04:00
Julien Pivotto 5cc30b716e
Merge pull request #9120 from arajkumar/fix-target_limit-error
scrape: fix 'target_limit exceeded error' when reloading conf with 0
2021-07-27 18:12:55 +02:00