Fix some edge cases when OOO is enabled
Signed-off-by: Vanshikav123 <vanshikav928@gmail.com>
Signed-off-by: Vanshika <102902652+Vanshikav123@users.noreply.github.com>
Signed-off-by: Jesus Vazquez <jesusvzpg@gmail.com>
Co-authored-by: Jesus Vazquez <jesusvzpg@gmail.com>
* NHCB: scrape use state field and not booleans
From comment https://github.com/prometheus/prometheus/pull/14978#discussion_r1800898724
Also make compareLabels read only and move storeLabels to the first
processed classic histogram series.
Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
* Speed up TestConvertClassicHistogramsToNHCB 3x
Reduce the startup time and timeouts
Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
* lint fix
Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
---------
Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
* promtool: Add debug flag for rule tests
This makes it print out the tsdb state (both input_series and rules that
are run) at the end of a test, making reasoning about tests much easier.
Signed-off-by: David Leadbeater <dgl@dgl.cx>
* Reuse generated test name from junit testing
Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
---------
Signed-off-by: David Leadbeater <dgl@dgl.cx>
Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
Co-authored-by: David Leadbeater <dgl@dgl.cx>
turn some loops into subtests to make use of t.Parallel()
requires Go 1.22 to make use of https://go.dev/blog/loopvar-preview
Signed-off-by: machine424 <ayoubmrini424@gmail.com>
scrape: Remove implicit fallback to the Prometheus text format
Remove implicit fallback to the Prometheus text format in case of invalid/missing Content-Type and fail the scrape instead. Add ability to specify a `fallback_scrape_protocol` in the scrape config.
---------
Signed-off-by: alexgreenbank <alex.greenbank@grafana.com>
Signed-off-by: Alex Greenbank <alex.greenbank@grafana.com>
Co-authored-by: Björn Rabenstein <beorn@grafana.com>
When handling recoded histogram chunks the min time of the chunk is
updated by mistake. It should only update when the chunk is completely new.
Otherwise the ongoing chunk's meta will be later than the previously
written samples in it.
Same bug as https://github.com/prometheus/prometheus/pull/14629
Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
When handling recoded histogram chunks the min time of the chunk is
updated by mistake. It should only update when the chunk is completely
new.
Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
promql: Fix stddev/stdvar when aggregating histograms, NaNs, and Infs
Native histograms are ignored when calculating stddev or stdvar.
However, for the first series of each group, a `groupedAggregation` is
always created. If the first series that was encountered is a histogram
then it acts as the equivalent of a 0 point.
This change creates the first `groupedAggregation` with the `seen` field set to `false` if the point is a
histogram, thus ignoring it like the rest of the aggregation function does. A new `groupedAggregation`
will then be created once an actual float value is encountered.
This commit also sets the `floatValue` field of the `groupedAggregation` to `NaN`, if the first
float value of a group is `NaN` or `±Inf`, so that the outcome is consistently `NaN` once those
values are in the mix.
(The added tests fail without this change).
Signed-off-by: Joshua Hesketh <josh@nitrotech.org>
Signed-off-by: beorn7 <beorn@grafana.com>
---------
Signed-off-by: Joshua Hesketh <josh@nitrotech.org>
Signed-off-by: beorn7 <beorn@grafana.com>
Co-authored-by: beorn7 <beorn@grafana.com>
* discovery: add aws/ec2 unit tests
* discovery: initial skeleton for aws/ec2 unit tests
This is a - very likely - not too useful unit test for the AWS SD. It is
commited so other people can check the basic logic and the
implementation.
Signed-off-by: Arpad Kunszt <akunszt@hiya.com>
* discovery: fix linter complains about ec2_test.go
Signed-off-by: Arpad Kunszt <akunszt@hiya.com>
* discovery: add basic unit test for aws
This tests only the basic labelling, not including the VPC related
information.
Signed-off-by: Arpad Kunszt <akunszt@hiya.com>
* discovery: fix linter complains about ec2_test.go
Signed-off-by: Arpad Kunszt <akunszt@hiya.com>
* discovery: other linter fixes in aws/ec2_test.go
Signed-off-by: Arpad Kunszt <akunszt@hiya.com>
* discovery: implement remaining tests for aws/ec2
The coverage is not 100% but I think it is a good starting point if
someone wants to improve that.
Currently it covers all the AWS API calls.
Signed-off-by: Arpad Kunszt <akunszt@hiya.com>
* discovery: make linter happy in aws/ec2_test.go
Signed-off-by: Arpad Kunszt <akunszt@hiya.com>
* discovery: make utility funtcions private
Signed-off-by: Arpad Kunszt <akunszt@hiya.com>
* discover: no global variable in the aws/ec2 test
Signed-off-by: Arpad Kunszt <akunszt@hiya.com>
* discovery: common body for some tests in ec2
Signed-off-by: Arpad Kunszt <akunszt@hiya.com>
* discovery: try to make golangci-lint happy
Signed-off-by: Arpad Kunszt <akunszt@hiya.com>
* discovery: make every non-test function private
Signed-off-by: Arpad Kunszt <akunszt@hiya.com>
* discovery: test for errors first in TestRefresh
Signed-off-by: Arpad Kunszt <akunszt@hiya.com>
* discovery: move refresh tests into the function
This way people can find both the test cases and the execution of the
test at the same place.
Signed-off-by: Arpad Kunszt <akunszt@hiya.com>
* discovery: fix copyright date
Signed-off-by: Arpad Kunszt <akunszt@hiya.com>
* discovery: remove misleading comment
Signed-off-by: Arpad Kunszt <akunszt@hiya.com>
* discovery: rename test for easier identification
Signed-off-by: Arpad Kunszt <akunszt@hiya.com>
* discovery: use static values for the test cases
Signed-off-by: Arpad Kunszt <akunszt@hiya.com>
* discover: try to make the linter happy
Signed-off-by: Arpad Kunszt <akunszt@hiya.com>
* discovery: drop redundant data from ec2 and use common ptr functions
Signed-off-by: Arpad Kunszt <akunszt@hiya.com>
* discovery: use Error instead of Equal
Signed-off-by: Arpad Kunszt <akunszt@hiya.com>
* discovery: merge refreshAZIDs tests into one
Signed-off-by: Arpad Kunszt <akunszt@hiya.com>
---------
Signed-off-by: Arpad Kunszt <akunszt@hiya.com>