Class: Aws::Telemetry::OTelProvider

Inherits:
TelemetryProviderBase show all
Defined in:
gems/aws-sdk-core/lib/aws-sdk-core/telemetry/otel.rb

Overview

OTelProvider allows to emit telemetry data based on OpenTelemetry.

To use this provider, require the opentelemetry-sdk gem and then, pass in an instance of a Aws::Telemetry::OTelProvider as the telemetry provider in the client config.

OpenTelemetry supports many ways to export your telemetry data. See here for more information.

Examples:

Configuration

require 'opentelemetry-sdk'

# sets up the OpenTelemetry SDK with their config defaults
OpenTelemetry::SDK.configure

otel_provider = Aws::Telemetry::OTelProvider.new
client = Aws::S3::Client.new(telemetry_provider: otel_provider)

Exporting via console

require 'opentelemetry-sdk'

ENV['OTEL_TRACES_EXPORTER'] ||= 'console'

# configures the OpenTelemetry SDK with defaults
OpenTelemetry::SDK.configure

otel_provider = Aws::Telemetry::OTelProvider.new
client = Aws::S3::Client.new(telemetry_provider: otel_provider)

Instance Attribute Summary

Attributes inherited from TelemetryProviderBase

#context_manager, #tracer_provider

Instance Method Summary collapse

Constructor Details

#initializeOTelProvider

Returns a new instance of OTelProvider.



35
36
37
38
39
40
41
42
43
44
# File 'gems/aws-sdk-core/lib/aws-sdk-core/telemetry/otel.rb', line 35

def initialize
  unless otel_loaded?
    raise ArgumentError,
          'Requires the `opentelemetry-sdk` gem to use OTel Provider.'
  end
  super(
    tracer_provider: OTelTracerProvider.new,
    context_manager: OTelContextManager.new
  )
end