Module: Mayu::Metrics
- Extended by:
- T::Sig
- Defined in:
- lib/mayu/metrics.rb,
lib/mayu/metrics/exporter.rb,
lib/mayu/metrics/reporter.rb,
lib/mayu/metrics/collector.rb
Defined Under Namespace
Modules: Collector, Reporter Classes: Exporter, Wrapper
Constant Summary collapse
- InternalStore =
T.type_alias { T::Hash[Symbol, MetricHash] }
- MetricHash =
T.type_alias { T::Hash[Symbol, ValueHash] }
- ValueHash =
T.type_alias { T::Hash[LabelsHash, Float] }
- LabelsHash =
T.type_alias { T::Hash[Symbol, T.untyped] }
Class Method Summary collapse
Class Method Details
.start_collect_and_export(container, exporter_endpoint:, collector_endpoint:, &block) ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/mayu/metrics.rb', line 47 def self.start_collect_and_export( container, exporter_endpoint:, collector_endpoint:, &block ) collector = Metrics::Collector::Server.new(collector_endpoint) collector.start container.spawn( name: "Metrics collector/exporter", restart: true ) do |instance| Async do internal_store = {} Prometheus::Client.config.data_store = Metrics::Collector::DataStore.new(internal_store) registry = Prometheus::Client::Registry.new yield registry Metrics::Exporter::Server.setup( endpoint: exporter_endpoint, registry: ).run collector.run(internal_store) instance.ready! end end end |