Poc for new time frames in Redis metric
What does this MR do and why?
Describe in detail what your merge request does and why.
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
How to set up and validate locally
In rails console
Gitlab::UsageDataCounters::MergeRequestCounter.count(:create, time: 1.day.ago)
Gitlab::UsageDataCounters::MergeRequestCounter.count(:create)
metric_definition = Gitlab::Usage::MetricDefinition.definitions['counts.merge_request_create'].attributes
all_time_redis_metric = Gitlab::Usage::Metrics::Instrumentations::RedisMetric.new(metric_definition)
all_time_redis_metric.value
metric_definition_28d = Gitlab::Usage::MetricDefinition.definitions['counts.merge_request_create'].attributes.dup
metric_definition_28d[:time_frame] = '28d'
redis_metric_28d = Gitlab::Usage::Metrics::Instrumentations::RedisMetric.new(metric_definition_28d)
redis_metric_28d.value
To also test RedisHll refcator use following snippet
Gitlab::UsageDataCounters::HLLRedisCounter.track_event('g_edit_by_web_ide', values: [3,2], time: 5.days.ago)
metric_definition_hll = Gitlab::Usage::MetricDefinition.definitions['redis_hll_counters.ide_edit.g_edit_by_web_ide_monthly'].attributes.dup
redis_hll_metric_28d = Gitlab::Usage::Metrics::Instrumentations::RedisHLLMetric.new(metric_definition_hll)
redis_hll_metric_28d.value
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Mikołaj Wawrzyniak