Skip to content

Reduce redis key size by half for Prometheus::ProxyService

David Wilkins requested to merge dwilkins/gitlab:smaller-prom-redis-keys into master

What does this MR do?

Reduce the size of the redis cache keys used by Prometheus::ProxyService by half

Reduce the refresh queries to Prometheus by half also.

Screenshots

Keys before (notice duplication at Environment:20 ):

"cache:gitlab:Environment:20:GET:query_range:{\"query\"=>\"sum(aws_elb_httpcode_backend_5_xx_sum{container_name!=\\\"POD\\\",environment=\\\"production\\\"}) / sum(aws_elb_request_count_sum{container_name!=\\\"POD\\\",environment=\\\"production\\\"})\", \"start\"=>\"2019-11-12T17:50:42.000Z\", \"end\"=>\"2019-11-13T01:50:42.000Z\", \"step\"=>\"60\"}:Environment:20:GET:query_range:{\"query\"=>\"sum(aws_elb_httpcode_backend_5_xx_sum{container_name!=\\\"POD\\\",environment=\\\"production\\\"}) / sum(aws_elb_request_count_sum{container_name!=\\\"POD\\\",environment=\\\"production\\\"})\", \"start\"=>\"2019-11-12T17:50:42.000Z\", \"end\"=>\"2019-11-13T01:50:42.000Z\", \"step\"=>\"60\"}"

Keys after:

"cache:gitlab:Environment:20:GET:query_range:{\"query\"=>\"sum(aws_elb_httpcode_backend_5_xx_sum{container_name!=\\\"POD\\\",environment=\\\"production\\\"}) / sum(aws_elb_request_count_sum{container_name!=\\\"POD\\\",environment=\\\"production\\\"})\", \"start\"=>\"2019-11-12T17:40:04.000Z\", \"end\"=>\"2019-11-13T01:40:04.000Z\", \"step\"=>\"60\"}"

Keys before and after can be measured with a command like:

redis-cli -s /Users/dwilkins/source/gitlab/gdk-demo/redis/redis.socket KEYS '*query_range*'

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • [-] Label as security and @ mention @gitlab-com/gl-security/appsec
  • [-] The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • [-] Security reports checked/validated by a reviewer from the AppSec team
Edited by Peter Leitzen

Merge request reports