chore: follow-up to #11151 and #11025 (#11225)

**What this PR does / why we need it**:

- remove usage of `enforce_metric_name` in ksonnet -
https://github.com/grafana/loki/pull/11151
- make `cortex_ruler_client_request_duration_seconds` prefix
configurable
- updates upgrade guide to remove reference to metrics that loki does
not export

**Which issue(s) this PR fixes**:
Fixes #<issue number>

**Special notes for your reviewer**:

**Checklist**
- [x] 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](d10549e3ec)
- [ ] 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](0d4416a4b0)
pull/11123/head^2
Ashwanth 2 years ago committed by GitHub
parent 117f108642
commit 32e9ee8209
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      docs/sources/setup/install/helm/reference.md
  2. 4
      docs/sources/setup/upgrade/_index.md
  3. 20
      pkg/ruler/base/client_pool.go
  4. 6
      pkg/ruler/base/client_pool_test.go
  5. 1
      production/docker/config/loki.yaml
  6. 1
      production/helm/loki/values.yaml
  7. 1
      production/ksonnet/loki-simple-scalable/example/main.jsonnet
  8. 1
      production/ksonnet/loki/config.libsonnet
  9. 1
      production/nomad/loki-distributed/config.yml
  10. 1
      production/nomad/loki-simple/config.yml
  11. 1
      production/nomad/loki/config.yml

@ -2027,7 +2027,6 @@ null
<td>Limits config</td>
<td><pre lang="json">
{
"enforce_metric_name": false,
"max_cache_freshness_per_query": "10m",
"reject_old_samples": true,
"reject_old_samples_max_age": "168h",

@ -241,10 +241,6 @@ Some Loki metrics started with the prefix `cortex_`. In this release they will b
- `cortex_query_scheduler_queue_duration_seconds_sum`
- `cortex_query_scheduler_queue_length`
- `cortex_query_scheduler_running`
- `cortex_quota_cgroup_cpu_max`
- `cortex_quota_cgroup_cpu_period`
- `cortex_quota_cpu_count`
- `cortex_quota_gomaxprocs`
- `cortex_ring_member_heartbeats_total`
- `cortex_ring_member_tokens_owned`
- `cortex_ring_member_tokens_to_own`

@ -48,15 +48,16 @@ func newRulerClientPool(clientCfg grpcclient.Config, logger log.Logger, reg prom
})
return &rulerClientsPool{
client.NewPool("ruler", poolCfg, nil, newRulerClientFactory(clientCfg, reg), clientsCount, logger),
client.NewPool("ruler", poolCfg, nil, newRulerClientFactory(clientCfg, reg, metricsNamespace), clientsCount, logger),
}
}
func newRulerClientFactory(clientCfg grpcclient.Config, reg prometheus.Registerer) client.PoolFactory {
func newRulerClientFactory(clientCfg grpcclient.Config, reg prometheus.Registerer, metricsNamespace string) client.PoolFactory {
requestDuration := promauto.With(reg).NewHistogramVec(prometheus.HistogramOpts{
Name: "cortex_ruler_client_request_duration_seconds",
Help: "Time spent executing requests to the ruler.",
Buckets: prometheus.ExponentialBuckets(0.008, 4, 7),
Namespace: metricsNamespace,
Name: "ruler_client_request_duration_seconds",
Help: "Time spent executing requests to the ruler.",
Buckets: prometheus.ExponentialBuckets(0.008, 4, 7),
}, []string{"operation", "status_code"})
return client.PoolAddrFunc(func(addr string) (client.PoolClient, error) {
@ -64,11 +65,12 @@ func newRulerClientFactory(clientCfg grpcclient.Config, reg prometheus.Registere
})
}
func newRulerPoolClient(clientCfg grpcclient.Config, reg prometheus.Registerer) func(addr string) (client.PoolClient, error) {
func newRulerPoolClient(clientCfg grpcclient.Config, reg prometheus.Registerer, metricsNamespace string) func(addr string) (client.PoolClient, error) {
requestDuration := promauto.With(reg).NewHistogramVec(prometheus.HistogramOpts{
Name: "cortex_ruler_client_request_duration_seconds",
Help: "Time spent executing requests to the ruler.",
Buckets: prometheus.ExponentialBuckets(0.008, 4, 7),
Namespace: metricsNamespace,
Name: "ruler_client_request_duration_seconds",
Help: "Time spent executing requests to the ruler.",
Buckets: prometheus.ExponentialBuckets(0.008, 4, 7),
}, []string{"operation", "status_code"})
return func(addr string) (client.PoolClient, error) {

@ -13,6 +13,8 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"google.golang.org/grpc"
"github.com/grafana/loki/pkg/util/constants"
)
func Test_newRulerClientFactory(t *testing.T) {
@ -36,7 +38,7 @@ func Test_newRulerClientFactory(t *testing.T) {
flagext.DefaultValues(&cfg)
reg := prometheus.NewPedanticRegistry()
factory := newRulerPoolClient(cfg, reg)
factory := newRulerPoolClient(cfg, reg, constants.Loki)
for i := 0; i < 2; i++ {
client, err := factory(listener.Addr().String())
@ -54,7 +56,7 @@ func Test_newRulerClientFactory(t *testing.T) {
require.NoError(t, err)
assert.Len(t, metrics, 1)
assert.Equal(t, "cortex_ruler_client_request_duration_seconds", metrics[0].GetName())
assert.Equal(t, "loki_ruler_client_request_duration_seconds", metrics[0].GetName())
assert.Equal(t, dto.MetricType_HISTOGRAM, metrics[0].GetType())
assert.Len(t, metrics[0].GetMetric(), 1)
assert.Equal(t, uint64(2), metrics[0].GetMetric()[0].GetHistogram().GetSampleCount())

@ -89,7 +89,6 @@ schema_config:
limits_config:
max_cache_freshness_per_query: '10m'
enforce_metric_name: false
reject_old_samples: true
reject_old_samples_max_age: 30m
ingestion_rate_mb: 10

@ -254,7 +254,6 @@ loki:
grpc_listen_port: 9095
# -- Limits config
limits_config:
enforce_metric_name: false
reject_old_samples: true
reject_old_samples_max_age: 168h
max_cache_freshness_per_query: 10m

@ -38,7 +38,6 @@ loki {
},
},
limits_config: {
enforce_metric_name: false,
reject_old_samples_max_age: '168h', //1 week
max_global_streams_per_user: 60000,
ingestion_rate_mb: 75,

@ -208,7 +208,6 @@
query_ingesters_within: '2h', // twice the max-chunk age (1h default) for safety buffer
},
limits_config: {
enforce_metric_name: false,
// align middleware parallelism with shard factor to optimize one-legged sharded queries.
max_query_parallelism: if $._config.queryFrontend.sharded_queries_enabled then
// For a sharding factor of 16 (default), this is 256, or enough for 16 sharded queries.

@ -122,6 +122,5 @@ ruler:
dir: {{ env "NOMAD_ALLOC_DIR" }}/data/ruler
limits_config:
enforce_metric_name: false
reject_old_samples: true
reject_old_samples_max_age: 168h

@ -50,7 +50,6 @@ storage_config:
s3forcepathstyle: true
limits_config:
enforce_metric_name: false
reject_old_samples: true
reject_old_samples_max_age: 168h

@ -50,7 +50,6 @@ storage_config:
s3forcepathstyle: true
limits_config:
enforce_metric_name: false
reject_old_samples: true
reject_old_samples_max_age: 168h

Loading…
Cancel
Save