Sha256: 61160df43d1a891c62a0445c6d2fe36363b68f49e8d91466e4be7420667faf46
Contents?: true
Size: 853 Bytes
Versions: 1
Compression:
Stored size: 853 Bytes
Contents
require_relative '../lib/prometheus_exporter' require_relative '../lib/prometheus_exporter/client' require_relative '../lib/prometheus_exporter/server' require 'oj' # test how long it takes a custom collector to process 10k messages class Collector def initialize(done) @i = 0 @done = done end def process(message) _parsed = JSON.parse(message) p @i if @i % 100 == 0 @done.call if (@i += 1) == 10_000 end def prometheus_metrics_text end end @start = nil done = lambda do puts "Elapsed for 10k messages is #{Time.now - @start}" end collector = Collector.new(done) server = PrometheusExporter::Server::WebServer.new port: 12349, collector: collector server.start client = PrometheusExporter::Client.new port: 12349, max_queue_size: 20_000 @start = Time.now 10_000.times { client.send_json(hello: "world") } sleep
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
prometheus_exporter-0.1.4 | bench/bench.rb |