-
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
Add per-tenant request counter metric to index gateway server #9797
Conversation
This commit add a counter metric with labels `operation`, `tenant`, `status` for gRPC requests that are served by the index gateway. What for? The per-tenant RPS on the index gateway is used to derive the per-tenant shard factor. Why tracking on the server? Unlike tracking index gateway RPS on the client side, tracking on the server side does not yield that many series, even in multi-tenant installations with a lot of tenants, because the amout of index gateway instances is relatively small compared to the amount of queriers and frontends. Signed-off-by: Christian Haudum <christian.haudum@gmail.com>
Signed-off-by: Christian Haudum <christian.haudum@gmail.com>
11d2b44
to
f42c249
Compare
Signed-off-by: Christian Haudum <christian.haudum@gmail.com>
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.
left a minor nit but other than that it LGTM
pkg/loki/modules.go
Outdated
@@ -1242,6 +1244,15 @@ func (t *Loki) initIndexGatewayRing() (_ services.Service, err error) { | |||
return t.indexGatewayRingManager, nil | |||
} | |||
|
|||
func (t *Loki) initIndexGatewayInterceptors() (services.Service, error) { | |||
// Only expose per-tenant metric if index gateway runs as standalone service | |||
if util.StringsContain(t.Cfg.Target, IndexGateway) { |
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.
We actually use this to check if the module was set in the targets. Although it does the same thing under the hood, it would be good to keep things consistent.
if util.StringsContain(t.Cfg.Target, IndexGateway) { | |
if t.Cfg.isModuleEnabled(IndexGateway) { |
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 did not check the function implementation and thought it that it would also return true if the module is a dependency of the target. I think the function name is slightly misleading.
Of course, I will apply your suggestion.
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.
yeah, the naming is confusing. This one checks if the user explicitly enabled the module in the targets flag. There is also isModuleActive
which checks if the module would be initialized.
Signed-off-by: Christian Haudum <christian.haudum@gmail.com>
This commit add a counter metric `loki_index_gateway_requests_total` with labels `operation`, `tenant`, `status` for gRPC requests that are served by the index gateway. **What for?** The per-tenant RPS on the index gateway is used to derive the per-tenant shard factor. **Why tracking on the server?** Unlike tracking index gateway RPS on the client side, tracking on the server side does not yield that many series, even in multi-tenant installations with a lot of tenants, because the amount of index gateway instances is relatively small compared to the amount of queriers and frontends. **Special notes for your reviewer**: The previous approach of tracking requests on the client #9781 has been abandoned. Signed-off-by: Christian Haudum <christian.haudum@gmail.com>
…#9804) **This is a backport of #9797 to k156** --- This commit add a counter metric `loki_index_gateway_requests_total` with labels `operation`, `tenant`, `status` for gRPC requests that are served by the index gateway. **What for?** The per-tenant RPS on the index gateway is used to derive the per-tenant shard factor. **Why tracking on the server?** Unlike tracking index gateway RPS on the client side, tracking on the server side does not yield that many series, even in multi-tenant installations with a lot of tenants, because the amount of index gateway instances is relatively small compared to the amount of queriers and frontends. **Special notes for your reviewer**: The previous approach of tracking requests on the client #9781 has been abandoned. Signed-off-by: Christian Haudum <christian.haudum@gmail.com>
This commit add a counter metric with labels
operation
,tenant
,status
for gRPC requests that are served by the index gateway.What for?
The per-tenant RPS on the index gateway is used to derive the per-tenant shard factor.
Why tracking on the server?
Unlike tracking index gateway RPS on the client side, tracking on the server side does not yield that many series, even in multi-tenant installations with a lot of tenants, because the amout of index gateway instances is relatively small compared to the amount of queriers and frontends.
Special notes for your reviewer:
The previous approach of tracking requests on the client #9781 has been abandoned.
Checklist
CONTRIBUTING.md
guide (required)CHANGELOG.md
updatedadd-to-release-notes
labeldocs/sources/upgrading/_index.md
production/helm/loki/Chart.yaml
and updateproduction/helm/loki/CHANGELOG.md
andproduction/helm/loki/README.md
. Example PR