Class: Gitlab::Usage::Metrics::Instrumentations::RedisHLLMetric
- Inherits:
-
BaseMetric
- Object
- BaseMetric
- Gitlab::Usage::Metrics::Instrumentations::RedisHLLMetric
- Defined in:
- lib/gitlab/usage/metrics/instrumentations/redis_hll_metric.rb
Constant Summary
Constants included from TimeFrame
TimeFrame::ALL_TIME_TIME_FRAME_NAME, TimeFrame::DEFAULT_TIMESTAMP_COLUMN, TimeFrame::SEVEN_DAYS_TIME_FRAME_NAME, TimeFrame::TWENTY_EIGHT_DAYS_TIME_FRAME_NAME
Constants included from Gitlab::Utils::UsageData
Gitlab::Utils::UsageData::DISTRIBUTED_HLL_FALLBACK, Gitlab::Utils::UsageData::FALLBACK, Gitlab::Utils::UsageData::HISTOGRAM_FALLBACK, Gitlab::Utils::UsageData::MAX_BUCKET_SIZE
Instance Attribute Summary
Attributes inherited from BaseMetric
#events, #options, #time_frame
Instance Method Summary collapse
-
#initialize(metric_definition) ⇒ RedisHLLMetric
constructor
Usage example.
- #metric_events ⇒ Object
- #value ⇒ Object
Methods inherited from BaseMetric
available?, #available?, #instrumentation
Methods included from TimeFrame
#monthly_time_range, #monthly_time_range_db_params, #weekly_time_range, #weekly_time_range_db_params
Methods included from Gitlab::Utils::UsageData
#add, #add_metric, #alt_usage_data, #average, #count, #distinct_count, #estimate_batch_distinct_count, #histogram, #maximum_id, #measure_duration, #minimum_id, #redis_usage_data, #sum, #track_usage_event, #with_finished_at, #with_metadata, #with_prometheus_client
Constructor Details
#initialize(metric_definition) ⇒ RedisHLLMetric
Usage example
In metric YAML defintion instrumentation_class: RedisHLLMetric
events:
- g_analytics_valuestream
end
15 16 17 18 19 |
# File 'lib/gitlab/usage/metrics/instrumentations/redis_hll_metric.rb', line 15 def initialize(metric_definition) super raise ArgumentError, "options events are required" unless metric_events.present? end |
Instance Method Details
#metric_events ⇒ Object
21 22 23 |
# File 'lib/gitlab/usage/metrics/instrumentations/redis_hll_metric.rb', line 21 def metric_events [:events] end |
#value ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/gitlab/usage/metrics/instrumentations/redis_hll_metric.rb', line 25 def value redis_usage_data do event_params = time_constraints.merge(event_names: metric_events) Gitlab::UsageDataCounters::HLLRedisCounter.unique_events(**event_params) end end |