Commit graph

11501 commits

Author SHA1 Message Date
Bryan Boreham d7293ea8b5
Merge pull request #12676 from prometheus/otel-resend-count
remote-write: add http.resend_count tracing attribute
2023-08-14 15:47:06 +01:00
Bryan Boreham 1e3fef6ab0
scraping: limit detail on dropped targets, to save memory (#12647)
It's possible (quite common on Kubernetes) to have a service discovery
return thousands of targets then drop most of them in relabel rules.
The main place this data is used is to display in the web UI, where
you don't want thousands of lines of display.

The new limit is `keep_dropped_targets`, which defaults to 0
for backwards-compatibility.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2023-08-14 15:39:25 +01:00
Julien Pivotto 103b8567d6
Merge pull request #12541 from haleyao/main
Remove deleted target from discovery manager
2023-08-14 15:37:59 +02:00
Bryan Boreham 5cea37c069
Merge pull request #12682 from bboreham/contains-same-label-set
promql engine: check unique labels using existing map

ContainsSameLabelset constructs a map with the same hash key as the one used to compile the output of rangeEval, so we can use that one and save work.

Need to hold the timestamp so we can be sure we saw the same series in the same evaluation.
2023-08-14 14:12:47 +01:00
Julien Pivotto ea039fcebf
Merge pull request #11463 from proggga/small_refactor
marathon.go: Simplified conditions in method
2023-08-14 15:09:02 +02:00
Bryan Boreham 0670e4771a promql engine: check unique labels using existing map
`ContainsSameLabelset` constructs a map with the same hash key as
the one used to compile the output of `rangeEval`, so we can use that
one and save work.

Need to hold the timestamp so we can be sure we saw the same series
in the same evaluation.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2023-08-13 18:09:10 +01:00
Bryan Boreham d2ae8dc3cb remote-write: add http.resend_count tracing attribute
As recommended by the OpenTelemetry semantic conventions.

https://opentelemetry.io/docs/specs/otel/trace/semantic_conventions/http/#http-client
Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2023-08-11 16:20:12 +00:00
Julien Pivotto 4a56a6bf59
Merge pull request #12643 from gouthamve/add-otlp-docs
Add initial OTLP ingestion docs
2023-08-08 13:08:22 +02:00
Julien Pivotto e3fabd5fdf
Merge pull request #12664 from prometheus/superq/cleanup_chunk_snapshots
Cleanup temporary chunk snapshot dirs
2023-08-08 13:02:39 +02:00
SuperQ 8d38d59fc5
Cleanup temporary chunk snapshot dirs
Simlar to cleanup of WAL files on startup, cleanup temporary
chunk_snapshot dirs. This prevents storage space leaks due to terminated
snapshots on shutdown.

Signed-off-by: SuperQ <superq@gmail.com>
2023-08-08 09:43:48 +02:00
Julien Pivotto 4c81a8f681
Merge pull request #11578 from chancefeick/fix/querying-documentation
Fix Querying Documentation Links
2023-08-08 09:21:31 +02: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
Goutham acb1f8a097 Fix API endpoint
Signed-off-by: Goutham <gouthamve@gmail.com>
2023-08-03 14:02:32 +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
Goutham Veeramachaneni 9df36c3e5e
Apply suggestions from code review
Co-authored-by: Julien Pivotto <roidelapluie@o11y.eu>
Signed-off-by: Goutham Veeramachaneni <gouthamve+github@gmail.com>
2023-08-03 13:56:54 +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
Goutham 6bb5720141
Add initial OTLP ingestion docs
We still need a guide that we can link users to in https://github.com/prometheus/docs/tree/main/content/docs/guides
This guide should show sending metrics from application directly via
the OTel SDKs and also sending through the Collector.

Signed-off-by: Goutham <gouthamve@gmail.com>
2023-08-03 00:12:15 +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