Class: Sentry::SpotlightTransport
- Inherits:
- 
      HTTPTransport
      
        - Object
- Transport
- HTTPTransport
- Sentry::SpotlightTransport
 
- Defined in:
- lib/sentry/transport/spotlight_transport.rb
Overview
Designed to just report events to Spotlight in development.
Constant Summary collapse
- DEFAULT_SIDECAR_URL =
- "http://localhost:8969/stream"
- MAX_FAILED_REQUESTS =
- 3
Constants inherited from HTTPTransport
HTTPTransport::CONTENT_TYPE, HTTPTransport::DEFAULT_DELAY, HTTPTransport::GZIP_ENCODING, HTTPTransport::GZIP_THRESHOLD, HTTPTransport::HTTP_ERRORS, HTTPTransport::RATE_LIMIT_HEADER, HTTPTransport::RETRY_AFTER_HEADER, HTTPTransport::USER_AGENT
Constants inherited from Transport
Transport::CLIENT_REPORT_INTERVAL, Transport::CLIENT_REPORT_REASONS, Transport::PROTOCOL_VERSION, Transport::USER_AGENT
Instance Attribute Summary
Attributes inherited from Transport
#discarded_events, #last_client_report_sent, #logger, #rate_limits
Instance Method Summary collapse
- 
  
    
      #conn  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Similar to HTTPTransport connection, but does not support Proxy and SSL. 
- #endpoint ⇒ Object
- 
  
    
      #initialize(configuration)  ⇒ SpotlightTransport 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    A new instance of SpotlightTransport. 
- #on_error ⇒ Object
- #send_data(data) ⇒ Object
Methods inherited from HTTPTransport
Methods inherited from Transport
#any_rate_limited?, #envelope_from_event, #flush, #is_rate_limited?, #record_lost_event, #send_envelope, #send_event, #serialize_envelope
Constructor Details
#initialize(configuration) ⇒ SpotlightTransport
Returns a new instance of SpotlightTransport.
| 12 13 14 15 16 17 18 19 | # File 'lib/sentry/transport/spotlight_transport.rb', line 12 def initialize(configuration) super @sidecar_url = configuration.spotlight.is_a?(String) ? configuration.spotlight : DEFAULT_SIDECAR_URL @failed = 0 @logged = false log_debug("[Spotlight] initialized for url #{@sidecar_url}") end | 
Instance Method Details
#conn ⇒ Object
Similar to HTTPTransport connection, but does not support Proxy and SSL
| 43 44 45 46 47 48 | # File 'lib/sentry/transport/spotlight_transport.rb', line 43 def conn sidecar = URI(@sidecar_url) connection = ::Net::HTTP.new(sidecar.hostname, sidecar.port, nil) connection.use_ssl = false connection end | 
#endpoint ⇒ Object
| 21 22 23 | # File 'lib/sentry/transport/spotlight_transport.rb', line 21 def endpoint "/stream" end | 
#on_error ⇒ Object
| 38 39 40 | # File 'lib/sentry/transport/spotlight_transport.rb', line 38 def on_error @failed += 1 end | 
#send_data(data) ⇒ Object
| 25 26 27 28 29 30 31 32 33 34 35 36 | # File 'lib/sentry/transport/spotlight_transport.rb', line 25 def send_data(data) if @failed >= MAX_FAILED_REQUESTS unless @logged log_debug("[Spotlight] disabling because of too many request failures") @logged = true end return end super end |