Module: Contrast::Agent::Telemetry

Extended by:
Config::EnvVariables
Defined in:
lib/contrast/agent/telemetry/telemetry.rb,
lib/contrast/agent/telemetry/base.rb,
lib/contrast/agent/telemetry/event.rb,
lib/contrast/agent/telemetry/client.rb,
lib/contrast/agent/telemetry/exception.rb,
lib/contrast/agent/telemetry/cache_hash.rb,
lib/contrast/agent/telemetry/identifier.rb,
lib/contrast/agent/telemetry/base64_hash.rb,
lib/contrast/agent/telemetry/metric_event.rb,
lib/contrast/agent/telemetry/exception/base.rb,
lib/contrast/agent/telemetry/exception_hash.rb,
lib/contrast/agent/telemetry/exception/event.rb,
lib/contrast/agent/telemetry/exception/message.rb,
lib/contrast/agent/telemetry/exception/obfuscate.rb,
lib/contrast/agent/telemetry/input_analysis_event.rb,
lib/contrast/agent/telemetry/exception/stack_frame.rb,
lib/contrast/agent/telemetry/startup_metrics_event.rb,
lib/contrast/agent/telemetry/input_analysis_cache_event.rb,
lib/contrast/agent/telemetry/exception/message_exception.rb,
lib/contrast/agent/telemetry/input_analysis_encoding_event.rb

Overview

Tools for supporting the Telemetry feature

Defined Under Namespace

Modules: Exception, Identifier Classes: Base, Base64Hash, CacheHash, Client, Event, ExceptionHash, InputAnalysisCacheEvent, InputAnalysisEncodingEvent, InputAnalysisEvent, MetricEvent, StartupMetricsEvent

Constant Summary collapse

DIR =
'/etc/contrast/ruby-agent/'.cs__freeze
FILE =
'.telemetry'.cs__freeze
CURRENT_DIR =
Dir.pwd.cs__freeze
CONFIG_DIR =
CURRENT_DIR + '/config/contrast/'.cs__freeze
MESSAGE =
{
    disclaimer:
      "\n===================================================================================================" \
      "\n\nThe [Contrast Security] [Ruby Agent] " \
      "collects usage data in order to help us improve compatibility\n" \
      "and security coverage. The data is anonymous and does not contain application data. It is collected\n" \
      "by Contrast and is never shared. You can opt-out of telemetry by setting the\n" \
      "'CONTRAST_AGENT_TELEMETRY_OPTOUT' environment variable to '1' or 'true'.\n" \
      'Read more about [Contrast Security] [Ruby Agent] telemetry: ' \
      "https://docs.contrastsecurity.com/en/ruby-telemetry.html \n\n" \
      "===================================================================================================\n\n"
}.cs__freeze

Constants included from Config::EnvVariables

Config::EnvVariables::ENV_VARIABLES

Class Method Summary collapse

Methods included from Config::EnvVariables

return_value

Class Method Details

.create_telemetry_fileObject

Here we create the .telemetry file. If the file exist we do nothing.

@return[Boolean, nil] true if file is created, false if file already exist and nil if Telemetry is disabled or on unsupported OS.



33
34
35
# File 'lib/contrast/agent/telemetry/telemetry.rb', line 33

def self.create_telemetry_file
  write_mark_file(DIR, FILE, CONFIG_DIR)
end

.disclaimerString

The telemetry disclaimer message, set if needed.

Returns:



40
41
42
# File 'lib/contrast/agent/telemetry/telemetry.rb', line 40

def self.disclaimer
  @_disclaimer = MESSAGE[:disclaimer]
end

.exceptions_enabled?Boolean

Determine if telemetry has been explicitly disabled by opt out or has been left running.

Returns:

  • (Boolean)


47
48
49
50
# File 'lib/contrast/agent/telemetry/telemetry.rb', line 47

def self.exceptions_enabled?
  @_exceptions_enabled = telemetry_exceptions_enabled? if @_exceptions_enabled.nil?
  @_exceptions_enabled
end