Commit graph

11115 commits

Author SHA1 Message Date
Marco Pracucci 242e82b8e6
Optimize regex star operation (#448)
* Optimize .* regex matcher

Signed-off-by: Marco Pracucci <marco@pracucci.com>

* Consistent benchmark runs for BenchmarkFastRegexMatcher

Signed-off-by: Marco Pracucci <marco@pracucci.com>

* Fixed TestParseExpressions

Signed-off-by: Marco Pracucci <marco@pracucci.com>

---------

Signed-off-by: Marco Pracucci <marco@pracucci.com>
2023-03-09 09:38:41 +01:00
ying-jeanne cfdf2a0594
Merge pull request #447 from grafana/changeValidUntil
Rules: Increase tolerance for missed iterations on alerts
2023-03-08 10:00:07 +01:00
Ying WANG f6b8a939f9 Rules: Increase tolerance for missed iterations on alerts 2023-03-07 17:34:48 +01:00
Marco Pracucci 1e7ad0ec11
Optimized very long case insensitive alternations (#444)
* Optimized very long case insensitive alternations

Signed-off-by: Marco Pracucci <marco@pracucci.com>

* Run common regexps in BenchmarkFastRegexMatcher

Signed-off-by: Marco Pracucci <marco@pracucci.com>

* Modify BenchmarkNewFastRegexMatcher to benchmark the NewFastRegexMatcher() function

Signed-off-by: Marco Pracucci <marco@pracucci.com>

* Reduced allocations by optimizeEqualStringMatchers()

Signed-off-by: Marco Pracucci <marco@pracucci.com>

* Fixed typo in comments

Signed-off-by: Marco Pracucci <marco@pracucci.com>

* Fixed typo in test case name

Signed-off-by: Marco Pracucci <marco@pracucci.com>

---------

Signed-off-by: Marco Pracucci <marco@pracucci.com>
2023-03-02 17:20:52 +01:00
Marco Pracucci 383ea59ce1
Add TestAnalyzeRealQueries (#443)
* Add TestAnalyzeRealQueries

Signed-off-by: Marco Pracucci <marco@pracucci.com>

* Add nolint directive

Signed-off-by: Marco Pracucci <marco@pracucci.com>

---------

Signed-off-by: Marco Pracucci <marco@pracucci.com>
2023-03-01 15:50:04 +01:00
Marco Pracucci eeecfee885
Do not optimize regexps with begin/end text anchors inside (#433)
* Do not optimize regexps with being/end text anchors inside

Signed-off-by: Marco Pracucci <marco@pracucci.com>

* Explicit case for begin/end text in stringMatcherFromRegexpInternal()

Signed-off-by: Marco Pracucci <marco@pracucci.com>

* Added more test cases

Signed-off-by: Marco Pracucci <marco@pracucci.com>

---------

Signed-off-by: Marco Pracucci <marco@pracucci.com>
2023-03-01 14:50:26 +01:00
Marco Pracucci 2e0ecc013f
Fix containsStringMatcher() when the text contains multiple occurrences of a substring (#431)
Signed-off-by: Marco Pracucci <marco@pracucci.com>
2023-03-01 11:18:30 +00:00
Marco Pracucci c77900d58e
Optimized FastRegexMatcher when the regex contains a case insensitive alternation made with concats too (#430)
* 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>
2023-03-01 10:49:25 +01:00
Charles Korn d26f584bfd
Merge pull request #429 from grafana/charleskorn/fix-license-header
Correct license header in `web/api/v1/codec_test.go`.
2023-02-27 23:47:18 +11:00
Charles Korn 94d858d2f4
Correct license header in web/api/v1/codec_test.go.
This was incorrectly added as part of #428.

Signed-off-by: Charles Korn <charles.korn@grafana.com>
2023-02-27 13:34:52 +11:00
Charles Korn 819f9ae856
Merge pull request #428 from grafana/charleskorn/content-negotation-improvements
Implement fully-featured content negotiation for API requests, and allow overriding the default API codec.
2023-02-27 09:43:15 +11:00
Charles Korn 5d62640e9b
Handle case where default codec cannot encode the response.
Signed-off-by: Charles Korn <charles.korn@grafana.com>
2023-02-24 14:47:24 +11:00
Charles Korn 374c3f4dec
Implement fully-featured content negotiation for API requests, and allow overriding the default API codec.
Signed-off-by: Charles Korn <charles.korn@grafana.com>
2023-02-24 14:04:43 +11:00
Charles Korn d2d23d9849
Expose QueryData so that implementations of Codec.CanEncode() can perform a type assertion against Response.Data. (#427)
Signed-off-by: Charles Korn <charles.korn@grafana.com>
2023-02-03 05:38:40 +01:00
George Krajcsovits 47a690022c
Merge pull request #426 from grafana/krajo/merge-upstream-main
merge upstream main
2023-02-01 13:55:42 +01:00
György Krajcsovits 26936c4e91 Merge remote-tracking branch 'upstream/main' into krajo/merge-upstream-main
At 1f0cc09579
2023-02-01 13:35:06 +01:00
George Krajcsovits 1f0cc09579
Export single ith test histogram generation functions (#11911)
* 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>
2023-02-01 16:23:38 +05:30
Charles Korn d9063441c1
Add extension point for returning different content types from API endpoints (#412)
* 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>
2023-02-01 09:33:50 +01:00
Charles Korn e023d896f2
Correct statement in docs about query results returning either floats or histograms but not both. (#11880)
* 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>
2023-01-31 13:34:17 +05:30
Ganesh Vernekar 8e8b718365
Merge pull request #11858 from fayzal-g/fix-chunks-metrics
tsdb: when reading WAL, correctly update chunksRemoved and chunks metrics
2023-01-30 19:45:12 +05:30
Marco Pracucci 82cbf1dd0b
Merge pull request #411 from grafana/refactor-sharding-func
Hardcode the labels stable hash function instead of taking it as an option
2023-01-30 14:39:14 +01:00
Marco Pracucci 950c177c72
Hardcode the labels stable hash function instead of taking it as an option
Signed-off-by: Marco Pracucci <marco@pracucci.com>
2023-01-30 14:21:18 +01:00
George Krajcsovits 300116a20c
Merge pull request #410 from grafana/krajo/fork-sync
Use tgymnich/fork-sync to create PR from upstream merge
2023-01-30 10:57:16 +01:00
György Krajcsovits 9730908c2b Use tgymnich/fork-sync to create PR from upstream merge
Should be able to create upstream to main merge PR.

Uses https://github.com/marketplace/actions/fork-sync  for creating PR
Uses octokit , e.g. https://octokit.github.io/rest.js/v19#repos-get

Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
2023-01-30 10:31:20 +01:00
Marco Pracucci f1986bc584
Merge pull request #406 from grafana/update-upstream
Update upstream Prometheus
2023-01-27 09:34:12 +01:00
Marco Pracucci 2461dee551
Merge remote-tracking branch 'remotes/prometheus/main' into update-upstream 2023-01-26 18:41:17 +01:00
Bartlomiej Plotka 6dcfb71740
Merge pull request #11897 from pracucci/propose-to-change-query-canceled-status-code
API: change HTTP status code from 503/422 to 499 if a request is canceled
2023-01-26 13:51:43 +00:00
Marco Pracucci 3db77b4491
API: change HTTP status code tracked in metrics form 503/422 to 499 if a request is canceled
Signed-off-by: Marco Pracucci <marco@pracucci.com>
2023-01-26 13:06:37 +01:00
Bryan Boreham 2b4c652e10
Merge pull request #369 from grafana/shard-func
* 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>
2023-01-26 11:59:03 +00:00
Kemal Akkoyun 068b6189d8
Merge pull request #11899 from prometheus/dependabot/go_modules/github.com/aws/aws-sdk-go-1.44.187
build(deps): bump github.com/aws/aws-sdk-go from 1.44.186 to 1.44.187
2023-01-26 12:42:50 +01:00
Kemal Akkoyun 0945628a55
Merge pull request #11901 from prometheus/dependabot/github_actions/actions/cache-3.2.3
build(deps): bump actions/cache from 3.2.2 to 3.2.3
2023-01-26 12:42:04 +01:00
Björn Rabenstein 60d763282e
Merge pull request #11864 from prometheus/beorn7/histogram2
histograms: Return actually useful counter reset hints
2023-01-26 11:22:40 +01:00
Bartlomiej Plotka aee77bc790
Merge pull request #11895 from kakkoyun/upgrade_ui_deps
Upgrade UI dependencies
2023-01-26 09:24:10 +00:00
dependabot[bot] ad25842b0b
build(deps): bump actions/cache from 3.2.2 to 3.2.3
Bumps [actions/cache](https://github.com/actions/cache) from 3.2.2 to 3.2.3.
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](https://github.com/actions/cache/compare/v3.2.2...v3.2.3)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-26 09:20:31 +00:00
Kemal Akkoyun c3b358d203
Merge pull request #11893 from kakkoyun/upgrade_several_dependencies
Upgrade several CI dependencies
2023-01-26 10:19:13 +01:00
dependabot[bot] 787e50550b
build(deps): bump github.com/aws/aws-sdk-go from 1.44.186 to 1.44.187
Bumps [github.com/aws/aws-sdk-go](https://github.com/aws/aws-sdk-go) from 1.44.186 to 1.44.187.
- [Release notes](https://github.com/aws/aws-sdk-go/releases)
- [Commits](https://github.com/aws/aws-sdk-go/compare/v1.44.186...v1.44.187)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-26 09:18:37 +00:00
Kemal Akkoyun 441e1df0ee
Update dependencies for 2.42 (#11891)
* Update dependencies

Signed-off-by: Kemal Akkoyun <kakkoyun@gmail.com>

* Revert azure sdk upgrade

Signed-off-by: Kemal Akkoyun <kakkoyun@gmail.com>

Signed-off-by: Kemal Akkoyun <kakkoyun@gmail.com>
2023-01-26 09:12:01 +00:00
dependabot[bot] 104b07511d build(deps): bump bufbuild/buf-setup-action from 1.9.0 to 1.12.0
Bumps [bufbuild/buf-setup-action](https://github.com/bufbuild/buf-setup-action) from 1.9.0 to 1.12.0.
- [Release notes](https://github.com/bufbuild/buf-setup-action/releases)
- [Commits](https://github.com/bufbuild/buf-setup-action/compare/v1.9.0...v1.12.0)

---
updated-dependencies:
- dependency-name: bufbuild/buf-setup-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-26 09:30:07 +01:00
dependabot[bot] b508ae6318 Bump dessant/lock-threads from 3 to 4
Bumps [dessant/lock-threads](https://github.com/dessant/lock-threads) from 3 to 4.
- [Release notes](https://github.com/dessant/lock-threads/releases)
- [Changelog](https://github.com/dessant/lock-threads/blob/master/CHANGELOG.md)
- [Commits](https://github.com/dessant/lock-threads/compare/v3...v4)

---
updated-dependencies:
- dependency-name: dessant/lock-threads
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-26 09:26:37 +01:00
dependabot[bot] 02e0170432 Bump actions/cache from 3.0.11 to 3.2.2
Bumps [actions/cache](https://github.com/actions/cache) from 3.0.11 to 3.2.2.
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](https://github.com/actions/cache/compare/v3.0.11...v3.2.2)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-26 09:26:37 +01:00
dependabot[bot] 9f61e006ba Bump bufbuild/buf-setup-action from 1.9.0 to 1.11.0
Bumps [bufbuild/buf-setup-action](https://github.com/bufbuild/buf-setup-action) from 1.9.0 to 1.11.0.
- [Release notes](https://github.com/bufbuild/buf-setup-action/releases)
- [Commits](https://github.com/bufbuild/buf-setup-action/compare/v1.9.0...v1.11.0)

---
updated-dependencies:
- dependency-name: bufbuild/buf-setup-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-26 09:26:36 +01:00
Kemal Akkoyun bab3b4e3c3 Upgrade dependencies
Signed-off-by: Kemal Akkoyun <kakkoyun@gmail.com>
2023-01-26 09:19:50 +01:00
Julien Pivotto 3a43736a36
Merge pull request #11896 from mmorel-35/patch-1
Use secrets.GITHUB_TOKEN and clean up workflows
2023-01-26 09:15:57 +01:00
Matthieu MOREL c1ab86757a
Update buf.yml
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2023-01-25 20:15:42 +01:00
Matthieu MOREL c0de8d014a
Update repo_sync.yml
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2023-01-25 20:14:25 +01:00
Matthieu MOREL ea1f06885f
Update prombench.yml
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2023-01-25 20:14:02 +01:00
Matthieu MOREL 03c2fcff19
Update lock.yml
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2023-01-25 20:13:35 +01:00
Matthieu MOREL 077fcddc96
Update fuzzing.yml
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2023-01-25 20:13:13 +01:00
Matthieu MOREL ca3abe1eba
Update funcbench.yml
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2023-01-25 20:12:47 +01:00
Matthieu MOREL 1ec0786fa9
Update codeql-analysis.yml
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2023-01-25 20:12:26 +01:00