Commit graph

11482 commits

Author SHA1 Message Date
bwplotka 9254279be1 Add option to auto detect configuration changes.
Fixes https://github.com/prometheus/prometheus/issues/9783#issuecomment-1669341273

Signed-off-by: bwplotka <bwplotka@gmail.com>
2023-08-09 09:06:18 +01:00
Bryan Boreham 8d47b3d497
Merge pull request #12579 from charleskorn/timestamp
Don't recreate iterator for each series on each timestep when evaluating a query with `timestamp()`
2023-08-05 10:51:38 +01:00
Julien Pivotto c3311272d9
Merge pull request #12652 from colega/fix-typo-in-append-histogram-param-name
Fix typo in Appender.AppendHistogram() arg name
2023-08-04 16:37:40 +02:00
Oleg Zaytsev 6ea6def0d3
Use zeropool when replaying agent's DB WAL (#12651)
Same as https://github.com/prometheus/prometheus/pull/12189 but for
tsdb/agent/db.go

Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com>
2023-08-04 10:39:55 +02:00
Oleg Zaytsev c810e7cae3
Fix typo in Appender.AppendHistogram() arg name
Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com>
2023-08-04 10:21:16 +02:00
Pablo Baeyens 5e21b3b2c6
[go.mod] Bump go.opentelemetry.io/collector/pdata to v1.0.0-rcv0014 (#12623)
This is the latest release candidate for the pdata module.
Go will pick the latest released version by default with commands such as `go get`
and ignore pre-released versions, but this version includes updates.

Signed-off-by: Pablo Baeyens <pablo.baeyens@datadoghq.com>
2023-08-03 13:59:37 +02:00
Oleg Zaytsev 61daa30bb1
Pass ref to SeriesLifecycleCallback.PostDeletion (#12626)
When a particular SeriesLifecycleCallback tries to optimize and run
closer to the Head, keeping track of the HeadSeriesRef instead of the
labelsets, it's impossible to handle the PostDeletion callback properly
as there's no way to know which series refs were deleted from the head.

This changes the callback to provide the series refs alongside the
labelsets, so the implementation can choose what to do.

Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com>
2023-08-03 10:56:27 +02:00
Julien Pivotto 95cad0b070
Merge pull request #12640 from prometheus/dependabot/go_modules/github.com/scaleway/scaleway-sdk-go-1.0.0-beta.20
build(deps): bump github.com/scaleway/scaleway-sdk-go from 1.0.0-beta.19 to 1.0.0-beta.20
2023-08-02 16:16:44 +02:00
Bryan Boreham 87cbd26f6b
Merge pull request #12598 from bboreham/labels-json
Faster streaming of Labels to JSON, via jsoniter.
2023-08-02 09:53:19 +01:00
Charles Korn d396282941
Address PR feedback: clarify comment
Signed-off-by: Charles Korn <charles.korn@grafana.com>
2023-08-02 11:48:34 +10:00
dependabot[bot] 17ef701011
build(deps): bump github.com/scaleway/scaleway-sdk-go
Bumps [github.com/scaleway/scaleway-sdk-go](https://github.com/scaleway/scaleway-sdk-go) from 1.0.0-beta.19 to 1.0.0-beta.20.
- [Release notes](https://github.com/scaleway/scaleway-sdk-go/releases)
- [Changelog](https://github.com/scaleway/scaleway-sdk-go/blob/master/CHANGELOG.md)
- [Commits](https://github.com/scaleway/scaleway-sdk-go/compare/v1.0.0-beta.19...v1.0.0-beta.20)

---
updated-dependencies:
- dependency-name: github.com/scaleway/scaleway-sdk-go
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-08-01 23:49:40 +00:00
Oleg Zaytsev cd7d0b69a2
Check nil err first when committing (#12625)
The most common case is to have a nil error when appending series, so
let's check that first instead of checking the 3 error types first.

Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com>
2023-08-01 14:04:45 +02:00
cui fliter f26dfc95e6
fix struct name in comment (#12624)
Signed-off-by: cui fliter <imcusg@gmail.com>
2023-08-01 12:24:42 +02:00
Charles Korn 145d7457fe
Address PR feedback: use loop to create expected test result
Signed-off-by: Charles Korn <charles.korn@grafana.com>
2023-08-01 13:30:12 +10:00
Charles Korn 6087c555ed
Address PR feedback: clarify comment
Signed-off-by: Charles Korn <charles.korn@grafana.com>
2023-08-01 13:30:10 +10:00
Charles Korn fb3935e8f9
Address PR feedback: rename method
Signed-off-by: Charles Korn <charles.korn@grafana.com>
2023-08-01 13:30:07 +10:00
Julien Pivotto 33a67f664e
Merge pull request #12620 from marctc/hetzner_role_exported
sd: change hetzner role type and constants to be exportable
2023-07-31 13:29:43 +02:00
Marc Tuduri 98383fdc63
sd: change hetzner role type and constants to be exportable
Signed-off-by: Marc Tuduri <marctc@protonmail.com>
2023-07-31 12:59:50 +02:00
Łukasz Mierzwa 3c80963e81
Use a linked list for memSeries.headChunk (#11818)
Currently memSeries holds a single head chunk in-memory and a slice of mmapped chunks.
When append() is called on memSeries it might decide that a new headChunk is needed to use for given append() call.
If that happens it will first mmap existing head chunk and only after that happens it will create a new empty headChunk and continue appending
our sample to it.

Since appending samples uses write lock on memSeries no other read or write can happen until any append is completed.
When we have an append() that must create a new head chunk the whole memSeries is blocked until mmapping of existing head chunk finishes.
Mmapping itself uses a lock as it needs to be serialised, which means that the more chunks to mmap we have the longer each chunk might wait
for it to be mmapped.
If there's enough chunks that require mmapping some memSeries will be locked for long enough that it will start affecting
queries and scrapes.
Queries might timeout, since by default they have a 2 minute timeout set.
Scrapes will be blocked inside append() call, which means there will be a gap between samples. This will first affect range queries
or calls using rate() and such, since the time range requested in the query might have too few samples to calculate anything.

To avoid this we need to remove mmapping from append path, since mmapping is blocking.
But this means that when we cut a new head chunk we need to keep the old one around, so we can mmap it later.
This change makes memSeries.headChunk a linked list, memSeries.headChunk still points to the 'open' head chunk that receives new samples,
while older, yet to be mmapped, chunks are linked to it.
Mmapping is done on a schedule by iterating all memSeries one by one. Thanks to this we control when mmapping is done, since we trigger
it manually, which reduces the risk that it will have to compete for mmap locks with other chunks.

Signed-off-by: Łukasz Mierzwa <l.mierzwa@gmail.com>
2023-07-31 11:10:24 +02:00
Julien Pivotto 76dd9b5470
Merge pull request #12618 from prometheus/release-2.46
Merge release 2.46 into main
2023-07-31 10:07:17 +02:00
Julien Pivotto bb90379163
Merge pull request #11404 from gberche-orange/patch-2
docs (label_replace): illustrate use of named capturing group
2023-07-28 13:23:29 +02:00
Goutham Veeramachaneni ad4f514e66
Add OTLP Ingestion endpoint (#12571)
* Add OTLP Ingestion endpoint

We copy files from the otel-collector-contrib. See the README in
`storage/remote/otlptranslator/README.md`.

This supersedes: https://github.com/prometheus/prometheus/pull/11965

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

* Return a 200 OK

It is what the OTEL Golang SDK expect :(

https://github.com/open-telemetry/opentelemetry-go/issues/4363

Signed-off-by: Goutham <gouthamve@gmail.com>

---------

Signed-off-by: gouthamve <gouthamve@gmail.com>
Signed-off-by: Goutham <gouthamve@gmail.com>
2023-07-28 12:35:28 +02:00
Robert Fratto 886945cda7
tsdb/agent: ensure that new series get written to WAL on rollback (#12592)
If a new series is introduced in a storage.Appender instance, that
series should be written to the WAL once the storage.Appender is closed,
even on Rollback.

Previously, new series would only be written to the WAL when calling
Commit. However, because the series is stored in memory regardless,
subsequent calls to Commit may write samples to the WAL which reference
a series ID which that was never written.

Related to #11589. It's likely that this fix also resolves this issue,
but we need more testing from users to see if the problem persists after
this fix; there may be more cases where samples get written to the WAL
in Prometheus Agent mode without the corresponding series record.

Signed-off-by: Robert Fratto <robertfratto@gmail.com>
2023-07-27 09:28:26 -04:00
Ziqi Zhao ed1b307bca
enhance FloatHistogram CopyToSchema method (#12596)
histogram: Improve performance of FloatHistogram.CopyToSchema

Signed-off-by: Ziqi Zhao <zhaoziqi9146@gmail.com>

---------

Signed-off-by: Ziqi Zhao <zhaoziqi9146@gmail.com>
Co-authored-by: Björn Rabenstein <github@rabenste.in>
2023-07-27 13:27:13 +02:00
Björn Rabenstein b1a6d003d1
Merge pull request #12584 from prometheus/beorn7/histogram
histogram: Identify native histograms even without observations
2023-07-27 00:18:17 +02:00
beorn7 c58e20ad0e histogram: Identify native histograms even without observations
Native histograms without observations and with a zero threshold of
zero look the same as classic histograms in the protobuf exposition
format. According to
https://github.com/prometheus/client_golang/issues/1127 , the idea is
to add a no-op span to those histograms to mark them as native
histograms. This commit enables Prometheus to detect that no-op span
and adds a doc comment to the proto spec describing the behavior.

Signed-off-by: beorn7 <beorn@grafana.com>
2023-07-26 17:42:30 +02:00
George Krajcsovits 6cd2d1621f
Hide histogram chunk append and reset header internals (#12352)
tsdb: Hide histogram chunk append and reset header internals

Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
Signed-off-by: George Krajcsovits <krajorama@users.noreply.github.com>
2023-07-26 15:08:16 +02:00
Julien Pivotto 03e549cc39
Merge pull request #8747 from shoce/patch-1
Add instructions how to persist prometheus docker container data
2023-07-26 09:02:48 +02:00
Julien Pivotto cbb69e5142
Merge pull request #12600 from roidelapluie/release246
Release 2.46.0
2023-07-25 14:27:37 +02:00
Julien Pivotto 16c645a6dd Release 2.46.0
Signed-off-by: Julien Pivotto <roidelapluie@o11y.eu>
2023-07-25 13:38:08 +02:00
Bryan Boreham dcadb32eb1 web/api: use stream encoder for embedded labels
This is much more efficient.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2023-07-24 20:42:36 +01:00
Bryan Boreham bb528d4a55 Add jsoniter encoder for Labels
Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2023-07-24 20:13:34 +01:00
Bryan Boreham 54e1046616 web/api: extend BenchmarkRespond with more types of data
Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2023-07-24 20:12:44 +01:00
Julien Pivotto 657da2eb98
Merge pull request #12595 from prometheus/atan2-drop-metric-name
Drop metric name for "atan2" binary operator
2023-07-24 16:48:10 +02:00
Julius Volz 531567d46e Drop metric name for "atan2" binary operator
The operator changes the meaning of the metric, so the metric name should
be dropped. Technically this would be a breaking change, but it's also very
obviously a bug and not likely that anyone depends on it.

Signed-off-by: Julius Volz <julius.volz@gmail.com>
2023-07-24 14:36:02 +02:00
Julien Pivotto 94edd08859
CI: Fix typo: arfefact -> artefacts (#12590)
Signed-off-by: Julien Pivotto <roidelapluie@o11y.eu>
2023-07-22 14:29:34 +01:00
LHHDZ 7d8f9b0978
remote-write receiver: reuse 'ref' to optimize multiple samples for same series (#12580)
reuse 'ref' to optimize multi samples processing efficiency

Signed-off-by: changlin.shi <changlin.shi@ly.com>
2023-07-22 14:24:46 +01:00
Julien Pivotto 9cd4808364
Merge pull request #12581 from roidelapluie/rel-246-rc0
Release 2.46.0-rc.0
2023-07-20 23:20:19 +02:00
Julien Pivotto 034babbf9e Address feedback on CHANGELOG
Signed-off-by: Julien Pivotto <roidelapluie@o11y.eu>
2023-07-20 22:18:17 +02:00
Björn Rabenstein 0e12f11d61
Merge pull request #12583 from prometheus/release-2.46
Merge release-2.46 into main
2023-07-20 18:29:44 +02:00
Björn Rabenstein 9228ac16aa
Merge pull request #12582 from krajorama/error-handling-tsdbutil-chunkfromsamples
tsdbutil/ChunkFromSamplesGeneric should not panic
2023-07-20 18:02:16 +02:00
György Krajcsovits d4e355243a tsdbutil/ChunkFromSamplesGeneric should not panic
Add error handling instead.
Prepares for #12352

Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
2023-07-20 17:01:34 +02:00
Julien Pivotto c37af1eda5 Release 2.46.0-rc.0
Signed-off-by: Julien Pivotto <roidelapluie@o11y.eu>
2023-07-20 16:52:56 +02:00
Julien Pivotto 7905594b52
Merge pull request #12557 from prometheus/beorn7/histogram
scrape: Enable ingestion of multiple exemplars per sample
2023-07-20 15:19:28 +02:00
Björn Rabenstein b2567aeacd
Merge pull request #12575 from prometheus/beorn7/histogram2
histogram: Fix bounds of buckets returned by floatBucketIterator
2023-07-20 13:20:51 +02:00
Charles Korn 6903d6edd8
Add test to confirm timestamp() behaves correctly when evaluating a range query.
Signed-off-by: Charles Korn <charles.korn@grafana.com>
2023-07-20 11:25:33 +10:00
Charles Korn fde6ebb17d
Create per-series iterators only once per selector, rather than recreating it for each time step.
Signed-off-by: Charles Korn <charles.korn@grafana.com>
2023-07-20 11:24:21 +10:00
Charles Korn 993618adea
Don't create a new iterator for every time step.
Signed-off-by: Charles Korn <charles.korn@grafana.com>
2023-07-20 11:24:21 +10:00
Charles Korn b114c0888d
Simplify loop
Signed-off-by: Charles Korn <charles.korn@grafana.com>
2023-07-20 11:24:20 +10:00
Charles Korn a142998052
Expand series set just once
Signed-off-by: Charles Korn <charles.korn@grafana.com>
2023-07-20 11:24:19 +10:00