Class: OpenTelemetry::SDK::Metrics::Export::InMemoryMetricPullExporter
- Inherits:
-
MetricReader
- Object
- MetricReader
- OpenTelemetry::SDK::Metrics::Export::InMemoryMetricPullExporter
- Defined in:
- lib/opentelemetry/sdk/metrics/export/in_memory_metric_pull_exporter.rb
Overview
The InMemoryMetricPullExporter behaves as a Metric Reader and Exporter. To be used for testing purposes, not production.
Instance Attribute Summary collapse
-
#metric_snapshots ⇒ Object
readonly
Returns the value of attribute metric_snapshots.
Attributes inherited from MetricReader
Instance Method Summary collapse
- #export(metrics, timeout: nil) ⇒ Object
-
#initialize ⇒ InMemoryMetricPullExporter
constructor
A new instance of InMemoryMetricPullExporter.
- #pull ⇒ Object
- #reset ⇒ Object
- #shutdown ⇒ Object
Methods inherited from MetricReader
Constructor Details
#initialize ⇒ InMemoryMetricPullExporter
Returns a new instance of InMemoryMetricPullExporter.
16 17 18 19 20 |
# File 'lib/opentelemetry/sdk/metrics/export/in_memory_metric_pull_exporter.rb', line 16 def initialize super @metric_snapshots = [] @mutex = Mutex.new end |
Instance Attribute Details
#metric_snapshots ⇒ Object (readonly)
Returns the value of attribute metric_snapshots.
14 15 16 |
# File 'lib/opentelemetry/sdk/metrics/export/in_memory_metric_pull_exporter.rb', line 14 def metric_snapshots @metric_snapshots end |
Instance Method Details
#export(metrics, timeout: nil) ⇒ Object
26 27 28 29 30 31 |
# File 'lib/opentelemetry/sdk/metrics/export/in_memory_metric_pull_exporter.rb', line 26 def export(metrics, timeout: nil) @mutex.synchronize do @metric_snapshots.concat(Array(metrics)) end SUCCESS end |
#pull ⇒ Object
22 23 24 |
# File 'lib/opentelemetry/sdk/metrics/export/in_memory_metric_pull_exporter.rb', line 22 def pull export(collect) end |
#reset ⇒ Object
33 34 35 36 37 |
# File 'lib/opentelemetry/sdk/metrics/export/in_memory_metric_pull_exporter.rb', line 33 def reset @mutex.synchronize do @metric_snapshots.clear end end |
#shutdown ⇒ Object
39 40 41 |
# File 'lib/opentelemetry/sdk/metrics/export/in_memory_metric_pull_exporter.rb', line 39 def shutdown SUCCESS end |