Module: Aspecto::Opentelemetry

Defined in:
lib/aspecto/opentelemetry.rb,
lib/aspecto/opentelemetry/version.rb,
lib/aspecto/opentelemetry/configurator.rb,
lib/aspecto/opentelemetry/resource/detectors/aspecto.rb

Overview

Aspecto Opentelemetry Distro

Defined Under Namespace

Modules: Resource Classes: Configurator, Error

Constant Summary collapse

VERSION =

TODO!

"0.1.3"

Class Method Summary collapse

Class Method Details

.configure {|configurator| ... } ⇒ Object

Yields:

  • (configurator)


17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/aspecto/opentelemetry.rb', line 17

def configure
  configurator = Configurator.new
  yield configurator if block_given?

  OpenTelemetry::SDK.configure do |c|
    c.service_name = configurator.service_name
    c.resource = Aspecto::Opentelemetry::Resource::Detectors::Aspecto.detect
    c.use_all "OpenTelemetry::Instrumentation::ActionPack" => { enable_recognize_route: true }

    c.add_span_processor(
      OpenTelemetry::SDK::Trace::Export::BatchSpanProcessor.new(
        OpenTelemetry::Exporter::OTLP::Exporter.new(endpoint: "https://otelcol.aspecto.io/v1/trace", headers: {
                                                      "Authorization" => configurator.aspecto_auth
                                                    })
      )
    )
  end
end