Sha256: 3394aecdfdeb1fcfe67121226bda101ccaa024f771ed6437a90a9363a1d6ccbb

Contents?: true

Size: 1.65 KB

Versions: 9

Compression:

Stored size: 1.65 KB

Contents

class ProconBypassMan::ReportProconPerformanceMeasurementsJob < ProconBypassMan::BaseJob
  extend ProconBypassMan::HasExternalApiSetting

  # @param [ProconBypassMan::Procon::PerformanceMeasurement::MeasurementCollection] measurement_collection
  def self.perform(measurement_collection)
    return if measurement_collection.nil?

    collected_spans_size = measurement_collection.spans.size
    metric = ProconBypassMan::Procon::PerformanceMeasurement.summarize(
      spans: measurement_collection.spans
    )
    body = {
      timestamp: measurement_collection.timestamp_key,
      interval_from_previous_succeed_max: metric.interval_from_previous_succeed_max,
      interval_from_previous_succeed_p50: metric.interval_from_previous_succeed_p50,
      write_time_max: metric.write_time_max,
      write_time_p50: metric.write_time_p50,
      read_time_max: metric.read_time_max,
      read_time_p50: metric.read_time_p50,
      time_taken_max: metric.time_taken_max,
      time_taken_p50: metric.time_taken_p50,
      time_taken_p95: metric.time_taken_p95,
      time_taken_p99: metric.time_taken_p99,
      read_error_count: metric.read_error_count,
      write_error_count: metric.write_error_count,
      gc_count: metric.gc_count,
      gc_time: metric.gc_time,
      succeed_rate: metric.succeed_rate,
      load_agv: ProconBypassMan::LoadAgv.new.get,
      collected_spans_size: collected_spans_size,
    }
    ProconBypassMan.logger.info(body)

    ProconBypassMan::ProconPerformanceHttpClient.new(
      path: path,
      server: api_server,
    ).post(body: body)
  end

  def self.path
    "/api/devices/#{ProconBypassMan.device_id}/procon_performance_metrics"
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
procon_bypass_man-0.3.6 lib/procon_bypass_man/background/jobs/report_procon_performance_measurements_job.rb
procon_bypass_man-0.3.5 lib/procon_bypass_man/background/jobs/report_procon_performance_measurements_job.rb
procon_bypass_man-0.3.4 lib/procon_bypass_man/background/jobs/report_procon_performance_measurements_job.rb
procon_bypass_man-0.3.3.1 lib/procon_bypass_man/background/jobs/report_procon_performance_measurements_job.rb
procon_bypass_man-0.3.3 lib/procon_bypass_man/background/jobs/report_procon_performance_measurements_job.rb
procon_bypass_man-0.3.2 lib/procon_bypass_man/background/jobs/report_procon_performance_measurements_job.rb
procon_bypass_man-0.3.1 lib/procon_bypass_man/background/jobs/report_procon_performance_measurements_job.rb
procon_bypass_man-0.3.0 lib/procon_bypass_man/background/jobs/report_procon_performance_measurements_job.rb
procon_bypass_man-0.2.3 lib/procon_bypass_man/background/jobs/report_procon_performance_measurements_job.rb