Sha256: a84203b314cd7fc97d0a438778a72549b20f69ace21b6609a237d968b7ada738

Contents?: true

Size: 887 Bytes

Versions: 6

Compression:

Stored size: 887 Bytes

Contents

# frozen_string_literal: true

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

module OpenTelemetry
  module SDK
    module Metrics
      module Export
        # Outputs {MetricData} to the console
        #
        # Potentially useful for exploratory purposes.
        class ConsoleMetricPullExporter < MetricReader
          def initialize
            super
            @stopped = false
          end

          def pull
            export(collect)
          end

          def export(metrics, timeout: nil)
            return FAILURE if @stopped

            Array(metrics).each { |metric| pp metric }

            SUCCESS
          end

          def force_flush(timeout: nil)
            SUCCESS
          end

          def shutdown(timeout: nil)
            @stopped = true
            SUCCESS
          end
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
opentelemetry-metrics-sdk-0.5.0 lib/opentelemetry/sdk/metrics/export/console_metric_pull_exporter.rb
opentelemetry-metrics-sdk-0.4.1 lib/opentelemetry/sdk/metrics/export/console_metric_pull_exporter.rb
opentelemetry-metrics-sdk-0.4.0 lib/opentelemetry/sdk/metrics/export/console_metric_pull_exporter.rb
opentelemetry-metrics-sdk-0.3.0 lib/opentelemetry/sdk/metrics/export/console_metric_pull_exporter.rb
opentelemetry-metrics-sdk-0.2.0 lib/opentelemetry/sdk/metrics/export/console_metric_pull_exporter.rb
opentelemetry-metrics-sdk-0.1.0 lib/opentelemetry/sdk/metrics/export/console_metric_pull_exporter.rb