Class: OpenCensus::Stats::MeasureRegistry
- Inherits:
-
Object
- Object
- OpenCensus::Stats::MeasureRegistry
- Includes:
- Singleton
- Defined in:
- lib/opencensus/stats/measure_registry.rb
Overview
MeasureRegistry
Measure registry is a collection of uniq measures.
Instance Attribute Summary collapse
- #measures ⇒ Hash<String, Measure> readonly
Class Method Summary collapse
-
.clear ⇒ Object
Clear measures registry.
-
.get(name) ⇒ Measure
Get registered measure.
-
.measures ⇒ Array<Measure>
List of registered measures.
-
.register(name:, unit:, type:, description: nil) ⇒ Measure?
Register measure.
-
.unregister(name) ⇒ Object
Un register measure.
Instance Attribute Details
#measures ⇒ Hash<String, Measure> (readonly)
17 18 19 |
# File 'lib/opencensus/stats/measure_registry.rb', line 17 def measures @measures end |
Class Method Details
.clear ⇒ Object
Clear measures registry
54 55 56 |
# File 'lib/opencensus/stats/measure_registry.rb', line 54 def clear instance.measures.clear end |
.get(name) ⇒ Measure
Get registered measure
60 61 62 |
# File 'lib/opencensus/stats/measure_registry.rb', line 60 def get name instance.measures[name] end |
.measures ⇒ Array<Measure>
List of registered measures
66 67 68 |
# File 'lib/opencensus/stats/measure_registry.rb', line 66 def measures instance.measures.values end |
.register(name:, unit:, type:, description: nil) ⇒ Measure?
Register measure.
33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/opencensus/stats/measure_registry.rb', line 33 def register name:, unit:, type:, description: nil return if instance.measures.key? name measure = Measure.new( name: name, unit: unit, type: type, description: description ) instance.measures[name] = measure end |
.unregister(name) ⇒ Object
Un register measure
49 50 51 |
# File 'lib/opencensus/stats/measure_registry.rb', line 49 def unregister name instance.measures.delete name end |