Sha256: fe2929becdb63475064b8c5f18c231950e63d918b55dea382e3befe748afff66

Contents?: true

Size: 1.28 KB

Versions: 58

Compression:

Stored size: 1.28 KB

Contents

# typed: false
# frozen_string_literal: true

unless Rails.env.development?
  # establish the environment for OTEL
  ENV["OTEL_EXPORTER_OTLP_ENDPOINT"] = Rails.application.credentials.fetch(:OTEL_EXPORTER_OTLP_ENDPOINT, ENV.fetch("OTEL_EXPORTER_OTLP_ENDPOINT", "https://api.honeycomb.io"))
  ENV["OTEL_EXPORTER_OTLP_HEADERS"] = Rails.application.credentials.fetch(:OTEL_EXPORTER_OTLP_HEADERS, ENV.fetch("OTEL_EXPORTER_OTLP_HEADERS", "x-honeycomb-team=your-api-key"))
  ENV["OTEL_SERVICE_NAME"] = Rails.application.credentials.fetch(:OTEL_SERVICE_NAME, ENV.fetch("OTEL_SERVICE_NAME", "your-service-name"))

  require "opentelemetry/sdk"
  require "opentelemetry/semantic_conventions"

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

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

    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

58 entries across 58 versions & 1 rubygems

Version Path
hephaestus-0.7.2.3 templates/config/initializers/opentelemetry.rb
hephaestus-0.7.2.2 templates/config/initializers/opentelemetry.rb
hephaestus-0.7.2.1 templates/config/initializers/opentelemetry.rb
hephaestus-0.7.2 templates/config/initializers/opentelemetry.rb
hephaestus-0.7.1 templates/config/initializers/opentelemetry.rb
hephaestus-0.7.0 templates/config/initializers/opentelemetry.rb
hephaestus-0.6.4 templates/config/initializers/opentelemetry.rb
hephaestus-0.6.3 templates/config/initializers/opentelemetry.rb
hephaestus-0.6.2 templates/config/initializers/opentelemetry.rb
hephaestus-0.6.1 templates/config/initializers/opentelemetry.rb
hephaestus-0.6.0 templates/config/initializers/opentelemetry.rb
hephaestus-0.5.2 templates/config/initializers/opentelemetry.rb
hephaestus-0.5.1 templates/config/initializers/opentelemetry.rb
hephaestus-0.5.0 templates/config/initializers/opentelemetry.rb
hephaestus-0.4.0 templates/config/initializers/opentelemetry.rb
hephaestus-0.3.1 templates/config/initializers/opentelemetry.rb
hephaestus-0.2.3 templates/config/initializers/opentelemetry.rb
hephaestus-0.2.2 templates/config/initializers/opentelemetry.rb