Sha256: 7c8c508dd7dcd85d25b02103864ec64cd6f508543220d1fed06654eed8a029c9

Contents?: true

Size: 1.83 KB

Versions: 1

Compression:

Stored size: 1.83 KB

Contents

# frozen_string_literal: true

# Copyright The OpenTelemetry Authors
#
# SPDX-License-Identifier: Apache-2.0

module OpenTelemetry
  module SDK
    module Logs
      # LogRecordProcessor describes a duck type and provides a synchronous no-op hook for when a
      # {LogRecord} is emitted. It is not required to subclass this
      # class to provide an implementation of LogRecordProcessor, provided the interface is
      # satisfied.
      class LogRecordProcessor
        # Called when a {LogRecord} is emitted. Subsequent calls are not
        # permitted after shutdown is called.
        # @param [LogRecord] log_record The emitted {LogRecord}
        # @param [Context] context The {Context}
        def on_emit(log_record, context); end

        # Export all log records to the configured `Exporter` that have not yet
        # been exported.
        #
        # This method should only be called in cases where it is absolutely
        # necessary, such as when using some FaaS providers that may suspend
        # the process after an invocation, but before the `Processor` exports
        # the completed spans.
        #
        # @param [optional Numeric] timeout An optional timeout in seconds.
        # @return [Integer] Export::SUCCESS if no error occurred, Export::FAILURE if
        #   a non-specific failure occurred, Export::TIMEOUT if a timeout occurred.
        def force_flush(timeout: nil)
          Export::SUCCESS
        end

        # Called when {LoggerProvider#shutdown} is called.
        #
        # @param [optional Numeric] timeout An optional timeout in seconds.
        # @return [Integer] Export::SUCCESS if no error occurred, Export::FAILURE if
        #   a non-specific failure occurred, Export::TIMEOUT if a timeout occurred.
        def shutdown(timeout: nil)
          Export::SUCCESS
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
opentelemetry-logs-sdk-0.1.0 lib/opentelemetry/sdk/logs/log_record_processor.rb