Sha256: 4d42f256222197449236007fa799db7e248db1d5289aeab1f225464d7983f219

Contents?: true

Size: 781 Bytes

Versions: 35

Compression:

Stored size: 781 Bytes

Contents

# frozen_string_literal: true

require "sequel"

module Honeycomb
  # Wrap sequel commands in a span
  module Sequel
    def honeycomb_client
      @honeycomb_client || Honeycomb.client
    end

    def honeycomb_client=(client)
      @honeycomb_client = client
    end

    def log_connection_yield(sql, conn, args = nil)
      return super if honeycomb_client.nil?

      honeycomb_client.start_span(name: sql.sub(/\s+.*/, "").upcase) do |span|
        span.add_field "meta.package", "sequel"
        span.add_field "meta.package_version", ::Sequel::VERSION
        span.add_field "type", "db"
        span.add_field "db.sql", sql
        super
      end
    end
  end
end

Sequel::Database.register_extension(:honeycomb, Honeycomb::Sequel)
Sequel::Database.extension :honeycomb

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
honeycomb-beeline-3.1.0 lib/honeycomb/integrations/sequel.rb
honeycomb-beeline-3.0.1 lib/honeycomb/integrations/sequel.rb
honeycomb-beeline-3.0.0 lib/honeycomb/integrations/sequel.rb
honeycomb-beeline-2.11.1.pre.dev lib/honeycomb/integrations/sequel.rb
honeycomb-beeline-2.11.0 lib/honeycomb/integrations/sequel.rb
honeycomb-beeline-2.10.0 lib/honeycomb/integrations/sequel.rb
honeycomb-beeline-2.9.0 lib/honeycomb/integrations/sequel.rb
honeycomb-beeline-2.8.2 lib/honeycomb/integrations/sequel.rb
honeycomb-beeline-2.8.1 lib/honeycomb/integrations/sequel.rb
honeycomb-beeline-2.8.0 lib/honeycomb/integrations/sequel.rb
honeycomb-beeline-2.7.1 lib/honeycomb/integrations/sequel.rb
honeycomb-beeline-2.7.0 lib/honeycomb/integrations/sequel.rb
honeycomb-beeline-2.6.0 lib/honeycomb/integrations/sequel.rb
honeycomb-beeline-2.5.0 lib/honeycomb/integrations/sequel.rb
honeycomb-beeline-2.4.2 lib/honeycomb/integrations/sequel.rb
honeycomb-beeline-2.4.1 lib/honeycomb/integrations/sequel.rb
honeycomb-beeline-2.4.0 lib/honeycomb/integrations/sequel.rb
honeycomb-beeline-2.3.0 lib/honeycomb/integrations/sequel.rb
honeycomb-beeline-2.2.0 lib/honeycomb/integrations/sequel.rb
honeycomb-beeline-2.1.2 lib/honeycomb/integrations/sequel.rb