-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Instrument querier inflight requests. #11085
Instrument querier inflight requests. #11085
Conversation
21216cc
to
2fdace3
Compare
func NewQueryHandlerMetrics(registerer prometheus.Registerer, metricsNamespace string) *QueryHandlerMetrics { | ||
return &QueryHandlerMetrics{ | ||
InflightRequests: promauto.With(registerer).NewGaugeVec(prometheus.GaugeOpts{ | ||
Namespace: metricsNamespace, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we set this to loki
?
metricsNamespace
was added for migrating metrics that were using cortex
prefix. But in this case it was already set to loki
I believe, so there is no need to make the prefix configurable now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it should stay flexible but thanks for the notice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Hello @jeschkies!
Please, if the current pull request addresses a bug fix, label it with the |
**What this PR does / why we need it**: means inflight requests are not instrumented anymore. This change adds a middleware that does that. This will add metrics such as ``` cortex_inflight_requests{method="gRPC",route="*logproto.IndexStatsRequest"} 0 cortex_inflight_requests{method="gRPC",route="*queryrange.LabelRequest"} 0 cortex_inflight_requests{method="gRPC",route="*queryrange.LokiRequest"} 0 cortex_inflight_requests{method="gRPC",route="*queryrange.LokiSeriesRequest"} 0 ``` **Checklist** - [ ] Reviewed the [`CONTRIBUTING.md`](https://github.com/grafana/loki/blob/main/CONTRIBUTING.md) guide (**required**) - [ ] Documentation added - [ ] Tests updated - [ ] `CHANGELOG.md` updated - [ ] If the change is worth mentioning in the release notes, add `add-to-release-notes` label - [ ] Changes that require user attention or interaction to upgrade are documented in `docs/sources/setup/upgrade/_index.md` - [ ] For Helm chart changes bump the Helm chart version in `production/helm/loki/Chart.yaml` and update `production/helm/loki/CHANGELOG.md` and `production/helm/loki/README.md`. [Example PR](grafana@d10549e) - [ ] If the change is deprecating or removing a configuration option, update the `deprecated-config.yaml` and `deleted-config.yaml` files respectively in the `tools/deprecated-config-checker` directory. [Example PR](grafana@0d4416a)
**What this PR does / why we need it**: * Instrument querier inflight requests. (#11085) * Recover querier handler from panic. (#10983) **Checklist** - [ ] Reviewed the [`CONTRIBUTING.md`](https://github.com/grafana/loki/blob/main/CONTRIBUTING.md) guide (**required**) - [ ] Documentation added - [ ] Tests updated - [ ] `CHANGELOG.md` updated - [ ] If the change is worth mentioning in the release notes, add `add-to-release-notes` label - [ ] Changes that require user attention or interaction to upgrade are documented in `docs/sources/setup/upgrade/_index.md` - [ ] For Helm chart changes bump the Helm chart version in `production/helm/loki/Chart.yaml` and update `production/helm/loki/CHANGELOG.md` and `production/helm/loki/README.md`. [Example PR](d10549e) - [ ] If the change is deprecating or removing a configuration option, update the `deprecated-config.yaml` and `deleted-config.yaml` files respectively in the `tools/deprecated-config-checker` directory. [Example PR](0d4416a)
**What this PR does / why we need it**: grafana#10858 removed the HTTP and gRPC server from the querier workers. That means inflight requests are not instrumented anymore. This change adds a middleware that does that. This will add metrics such as ``` # HELP cortex_inflight_requests Current number of inflight requests. # TYPE cortex_inflight_requests gauge cortex_inflight_requests{method="gRPC",route="*logproto.IndexStatsRequest"} 0 cortex_inflight_requests{method="gRPC",route="*queryrange.LabelRequest"} 0 cortex_inflight_requests{method="gRPC",route="*queryrange.LokiRequest"} 0 cortex_inflight_requests{method="gRPC",route="*queryrange.LokiSeriesRequest"} 0 ``` **Checklist** - [ ] Reviewed the [`CONTRIBUTING.md`](https://github.com/grafana/loki/blob/main/CONTRIBUTING.md) guide (**required**) - [ ] Documentation added - [ ] Tests updated - [ ] `CHANGELOG.md` updated - [ ] If the change is worth mentioning in the release notes, add `add-to-release-notes` label - [ ] Changes that require user attention or interaction to upgrade are documented in `docs/sources/setup/upgrade/_index.md` - [ ] For Helm chart changes bump the Helm chart version in `production/helm/loki/Chart.yaml` and update `production/helm/loki/CHANGELOG.md` and `production/helm/loki/README.md`. [Example PR](grafana@d10549e) - [ ] If the change is deprecating or removing a configuration option, update the `deprecated-config.yaml` and `deleted-config.yaml` files respectively in the `tools/deprecated-config-checker` directory. [Example PR](grafana@0d4416a)
What this PR does / why we need it:
#10858 removed the HTTP and gRPC server from the querier workers. That means inflight requests are not instrumented anymore. This change adds a middleware that does that.
This will add metrics such as
Checklist
CONTRIBUTING.md
guide (required)CHANGELOG.md
updatedadd-to-release-notes
labeldocs/sources/setup/upgrade/_index.md
production/helm/loki/Chart.yaml
and updateproduction/helm/loki/CHANGELOG.md
andproduction/helm/loki/README.md
. Example PRdeprecated-config.yaml
anddeleted-config.yaml
files respectively in thetools/deprecated-config-checker
directory. Example PR