Sha256: 902fe11a44517b01a76798e0f3bdb8043edda36d4e53125813090f00f222ef09

Contents?: true

Size: 1.2 KB

Versions: 17

Compression:

Stored size: 1.2 KB

Contents

# typed: false
# frozen_string_literal: true

unless Rails.env.development?
  # establish the environment for OTEL
  ENV["OTEL_EXPORTER_OTLP_ENDPOINT"] = "https://api.honeycomb.io"

  ENV["OTEL_EXPORTER_OTLP_HEADERS"] = fetch_vault_secret(
    label: "OTEL_EXPORTER_OTLP_HEADERS",
    default: "x-honeycomb-team=your-api-key",
  )

  ENV["OTEL_SERVICE_NAME"] = "plug-#{plug_shortname}-#{Rails.env}"

  require "opentelemetry/sdk"
  require "opentelemetry/exporter/otlp"
  require "opentelemetry/semantic_conventions"

  OpenTelemetry::SDK.configure do |c|
    c.logger = Rails.logger

    c.use_all(
      "OpenTelemetry::Instrumentation::PG" => { db_statement: :obfuscate },
      "OpenTelemetry::Instrumentation::Rack" => { use_rack_events: false },
    )

    if productionish?
      c.add_span_processor(
        OpenTelemetry::SDK::Trace::Export::BatchSpanProcessor.new(
          OpenTelemetry::Exporter::OTLP::Exporter.new,
        ),
      )
    else # useful for testing instrumentation
      c.add_span_processor(
        OpenTelemetry::SDK::Trace::Export::SimpleSpanProcessor.new(
          OpenTelemetry::SDK::Trace::Export::SpanExporter.new,
        ),
      )
    end # development is intentionally disabled
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
hephaestus-0.8.6 config/initializers/opentelemetry.rb
hephaestus-0.8.5 config/initializers/opentelemetry.rb
hephaestus-0.8.4.1 config/initializers/opentelemetry.rb
hephaestus-0.8.4 config/initializers/opentelemetry.rb
hephaestus-0.8.3.4 config/initializers/opentelemetry.rb
hephaestus-0.8.3.3 config/initializers/opentelemetry.rb
hephaestus-0.8.3.2 config/initializers/opentelemetry.rb
hephaestus-0.8.3.1 config/initializers/opentelemetry.rb
hephaestus-0.8.3 config/initializers/opentelemetry.rb
hephaestus-0.8.2 config/initializers/opentelemetry.rb
hephaestus-0.8.1 config/initializers/opentelemetry.rb
hephaestus-0.8.0 config/initializers/opentelemetry.rb
hephaestus-0.7.7.2 config/initializers/opentelemetry.rb
hephaestus-0.7.7 config/initializers/opentelemetry.rb
hephaestus-0.7.6.2 config/initializers/opentelemetry.rb
hephaestus-0.7.6.1 config/initializers/opentelemetry.rb
hephaestus-0.7.6 config/initializers/opentelemetry.rb