Usage data counters should be a no-op when usage ping is disabled

Summary

Noted while reviewing https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/30800/diffs#note_193393496

GitLab maintains a number of counters in Redis (and possibly elsewhere) to inform the usage ping. These counters are maintained whether or not the usage ping is enabled.

We can save a bit of redis (especially) load by skipping the counts when the usage ping is disabled.

This becomes more important as we start to track more things over time, as we are doing.

There is a proposal to remove the ability to disable the usage ping: https://gitlab.com/gitlab-org/telemetry/issues/34 - however, in that issue we make a commitment to always having a way to disable it for certain classes of customer. So I think this is worth doing, even if we follow through on that issue.

Steps to reproduce

  • Disable usage ping
  • Create a new commit through the web IDE

What is the current bug behavior?

WEB_IDE_COMMITS_COUNT key is incremented

What is the expected correct behavior?

No-op

Possible fixes

Simplest: make the Gitlab::UsageDataCounters::RedisCounter#increment method take account of whether the usage ping is enabled or not.

Edited Jul 19, 2019 by Nick Thomas
Assignee Loading
Time tracking Loading