File: log_event_buffer.rb

package info (click to toggle)
ruby-sentry-ruby 6.3.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 644 kB
  • sloc: ruby: 5,771; makefile: 8; sh: 4
file content (28 lines) | stat: -rw-r--r-- 797 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# frozen_string_literal: true

require "sentry/telemetry_event_buffer"

module Sentry
  # LogEventBuffer buffers log events and sends them to Sentry in a single envelope.
  #
  # This is used internally by the `Sentry::Client`.
  #
  # @!visibility private
  class LogEventBuffer < TelemetryEventBuffer
    DEFAULT_MAX_EVENTS = 100
    MAX_EVENTS_BEFORE_DROP = 1000

    def initialize(configuration, client)
      super(
        configuration,
        client,
        event_class: LogEvent,
        max_items: configuration.max_log_events || DEFAULT_MAX_EVENTS,
        max_items_before_drop: MAX_EVENTS_BEFORE_DROP,
        envelope_type: "log",
        envelope_content_type: "application/vnd.sentry.items.log+json",
        before_send: configuration.before_send_log
      )
    end
  end
end