Sha256: 77fbb3a4566407cce1c53a34ce67fb62190c2a3c8860725b803683d993711b5d

Contents?: true

Size: 1.96 KB

Versions: 1

Compression:

Stored size: 1.96 KB

Contents

# frozen_string_literal: true

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

module OpenTelemetry
  module SDK
    module Logs
      module Export
        # LogRecordExporter describes a duck type. It is not required to
        # subclass this class to provide an implementation of LogRecordExporter,
        # provided the interface is satisfied. LogRecordExporter allows
        # different tracing services to export log record data in their own format.
        #
        # To export data an exporter MUST be registered to the {LoggerProvider}
        # using a {LogRecordProcessor} implementation.
        class LogRecordExporter
          def initialize
            @stopped = false
          end

          # Called to export {LogRecordData}s.
          #
          # @param [Enumerable<LogRecordData>] log_record_data the list of
          # {LogRecordData} to be exported.
          # @param [optional Numeric] timeout An optional timeout in seconds.
          #
          # @return [Integer] the result of the export.
          def export(log_record_data, timeout: nil)
            return SUCCESS unless @stopped

            FAILURE
          end

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

          # Called when {LoggerProvider#shutdown} is called, if this exporter is
          # registered to a {LoggerProvider} object.
          #
          # @param [optional Numeric] timeout An optional timeout in seconds.
          def shutdown(timeout: nil)
            @stopped = true
            SUCCESS
          end
        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/export/log_record_exporter.rb