Class: EzLogsAgent::Transport

Inherits:
Object
  • Object
show all
Defined in:
lib/ez_logs_agent/transport.rb

Overview

HTTP Transport Client

Lowest-level component that sends events to the EzLogs server. Performs a single HTTP POST request with no retries or backoff.

Responsibilities:

  • Serialize events to JSON

  • POST to server endpoint

  • Return :success or :failure

Does NOT:

  • Retry failed requests

  • Implement backoff logic

  • Read from Buffer

  • Call Buffer.flush

  • Raise exceptions to host app

Class Method Summary collapse

Class Method Details

.send(events) ⇒ Symbol

Send events to the server

Parameters:

  • events (Array<Hash>)

    Array of event hashes

Returns:

  • (Symbol)

    :success if 2xx response, :failure otherwise



30
31
32
33
34
35
36
37
38
# File 'lib/ez_logs_agent/transport.rb', line 30

def send(events)
  return :success if events.nil? || events.empty?

  response = post_events(events)
  classify_response(response)
rescue => error
  Logger.error("[Transport] send failed: #{error.class} - #{error.message}")
  :failure
end