Sha256: bb5fef0420f6c9e383af237e27411c3f6b8b53a918a01011d5fa841c7c243cc2

Contents?: true

Size: 696 Bytes

Versions: 99

Compression:

Stored size: 696 Bytes

Contents

require "inspec/utils/telemetry/collector"

module Inspec
  # A Global method to add a data series object to the Telemetry Collection.
  # `data_series_name`s are unique, so `:dependency_group` will always return
  # the same object.
  # `data_point` is optional, you may also supply a block with several data points.
  # All data points should allow #to_s
  def self.record_telemetry_data(data_series_name, data_point = nil)
    coll = Inspec::Telemetry::Collector.instance
    return unless coll.telemetry_enabled?

    ds = coll.find_or_create_data_series(data_series_name)
    return unless ds.enabled?

    if block_given?
      ds << yield
    else
      ds << data_point
    end
  end
end

Version data entries

99 entries across 99 versions & 2 rubygems

Version Path
inspec-core-5.22.58 lib/inspec/utils/telemetry/global_methods.rb
inspec-core-5.22.55 lib/inspec/utils/telemetry/global_methods.rb
inspec-core-5.22.40 lib/inspec/utils/telemetry/global_methods.rb
inspec-core-6.6.0 lib/inspec/utils/telemetry/global_methods.rb
inspec-core-5.22.36 lib/inspec/utils/telemetry/global_methods.rb
inspec-core-5.22.29 lib/inspec/utils/telemetry/global_methods.rb
inspec-core-4.56.58 lib/inspec/utils/telemetry/global_methods.rb
inspec-core-5.22.3 lib/inspec/utils/telemetry/global_methods.rb
inspec-core-5.21.29 lib/inspec/utils/telemetry/global_methods.rb
inspec-core-5.18.14 lib/inspec/utils/telemetry/global_methods.rb
inspec-core-5.17.4 lib/inspec/utils/telemetry/global_methods.rb
inspec-core-5.14.0 lib/inspec/utils/telemetry/global_methods.rb
inspec-core-4.56.20 lib/inspec/utils/telemetry/global_methods.rb
inspec-core-5.12.2 lib/inspec/utils/telemetry/global_methods.rb
inspec-core-5.10.5 lib/inspec/utils/telemetry/global_methods.rb
inspec-core-4.56.19 lib/inspec/utils/telemetry/global_methods.rb
inspec-core-5.7.9 lib/inspec/utils/telemetry/global_methods.rb
inspec-core-4.56.17 lib/inspec/utils/telemetry/global_methods.rb
inspec-core-4.52.9 lib/inspec/utils/telemetry/global_methods.rb
inspec-core-4.50.3 lib/inspec/utils/telemetry/global_methods.rb