Sha256: 8f478f0e0670e2ab369ed8e9a741145fc7dea7ce089e20e8e25e11df2334a87f

Contents?: true

Size: 1.58 KB

Versions: 5

Compression:

Stored size: 1.58 KB

Contents

# frozen_string_literal: true

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

require 'singleton'

module OpenTelemetry
  module SDK
    module Trace
      # NoopSpanProcessor is a singleton implementation of the duck type
      # SpanProcessor that provides synchronous no-op hooks for when a
      # {Span} is started or when a {Span} is ended.
      class NoopSpanProcessor
        include Singleton

        # Called when a {Span} is started, if the {Span#recording?}
        # returns true.
        #
        # This method is called synchronously on the execution thread, should
        # not throw or block the execution thread.
        #
        # @param [Span] span the {Span} that just started.
        def on_start(span); end

        # Called when a {Span} is ended, if the {Span#recording?}
        # returns true.
        #
        # This method is called synchronously on the execution thread, should
        # not throw or block the execution thread.
        #
        # @param [Span] span the {Span} that just ended.
        def on_finish(span); end

        # Export all ended spans 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.
        def force_flush; end

        # Called when {TracerProvider#shutdown} is called.
        def shutdown; end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
opentelemetry-sdk-0.6.0 lib/opentelemetry/sdk/trace/noop_span_processor.rb
opentelemetry-sdk-0.5.1 lib/opentelemetry/sdk/trace/noop_span_processor.rb
opentelemetry-sdk-0.5.0 lib/opentelemetry/sdk/trace/noop_span_processor.rb
opentelemetry-sdk-0.4.0 lib/opentelemetry/sdk/trace/noop_span_processor.rb
opentelemetry-sdk-0.3.0 lib/opentelemetry/sdk/trace/noop_span_processor.rb