* Optimized FastRegexMatcher when the regex contains a case insensitive alternation made with concats too
Signed-off-by: Marco Pracucci <marco@pracucci.com>
* Do not use a pointer to hold whether the matches are case sensitive
Signed-off-by: Marco Pracucci <marco@pracucci.com>
* Improved unit tests based on review feedback
Signed-off-by: Marco Pracucci <marco@pracucci.com>
---------
Signed-off-by: Marco Pracucci <marco@pracucci.com>
* Export single ith test histogram generation functions
Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
* Do not set counter reset hint for non-gauge histograms individually
Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
* Apply suggestions from code review
Co-authored-by: Ganesh Vernekar <ganeshvern@gmail.com>
Signed-off-by: George Krajcsovits <krajorama@users.noreply.github.com>
---------
Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
Signed-off-by: George Krajcsovits <krajorama@users.noreply.github.com>
Co-authored-by: Ganesh Vernekar <ganeshvern@gmail.com>
* Add initial sketch of Codec interface.
Signed-off-by: Charles Korn <charles.korn@grafana.com>
* Introduce JSON codec.
Signed-off-by: Charles Korn <charles.korn@grafana.com>
* Expose Response type so that consuming applications (eg. Mimir) can implement their own Codecs.
Signed-off-by: Charles Korn <charles.korn@grafana.com>
* Add sketch of what supporting different codecs could look like.
Signed-off-by: Charles Korn <charles.korn@grafana.com>
* Rename fallbackCodec to defaultCodec.
Signed-off-by: Charles Korn <charles.korn@grafana.com>
* Remove defaultCodec as a field on API.
Signed-off-by: Charles Korn <charles.korn@grafana.com>
* Rename AddCodec() and clarify expected behaviour.
Signed-off-by: Charles Korn <charles.korn@grafana.com>
* Modify TestRespond to test JsonCodec directly.
Signed-off-by: Charles Korn <charles.korn@grafana.com>
* Refactor existing respond() test in preparation for content negotiation test cases.
Signed-off-by: Charles Korn <charles.korn@grafana.com>
* Add tests for content negotiation.
Signed-off-by: Charles Korn <charles.korn@grafana.com>
* Add missing documentation comments.
Signed-off-by: Charles Korn <charles.korn@grafana.com>
* Add another test case.
Signed-off-by: Charles Korn <charles.korn@grafana.com>
* Rename JsonCodec to JSONCodec.
Signed-off-by: Charles Korn <charles.korn@grafana.com>
* Fix linting issue.
Signed-off-by: Charles Korn <charles.korn@grafana.com>
* Fallback to JSON codec if no acceptable codec can be found for the Accept header.
Signed-off-by: Charles Korn <charles.korn@grafana.com>
* Move custom jsoniter code into json_codec.go.
Signed-off-by: Charles Korn <charles.korn@grafana.com>
---------
Signed-off-by: Charles Korn <charles.korn@grafana.com>
* Correct statement in docs about query results returning either floats or histograms but not both.
* Move documentation for range and instant vectors under their corresponding headings.
Signed-off-by: Charles Korn <charles.korn@grafana.com>
* tsdb: make sharding function a parameter
Instead of relying on `labels.Hash()`, which may change, have the
caller pass in a shard function if required.
For most purposes `tsdb.Options.ShardFunc` is used, but the compactor
may be created independently so `NewLeveledCompactorWithChunkSize` also
takes a shard function parameter.
Regular Prometheus, which does not use block sharding, will have this
parameter as nil.
Rename WithCache functions as WithOptions
Where they now have 2 or more extra parameters.
Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
This is a bit more conservative than we could be. As long as a chunk
isn't the first in a block, we can be pretty sure that the previous
chunk won't disappear. However, the incremental gain of returning
NotCounterReset in these cases is probably very small and might not be
worth the code complications.
Wwith this, we now also pay attention to an explicitly set counter
reset during ingestion. While the case doesn't show up in practice
yet, there could be scenarios where the metric source knows there was
a counter reset even if it might not be visible from the values in the
histogram. It is also useful for testing.
Signed-off-by: beorn7 <beorn@grafana.com>