Sha256: 6f35d14da99b7b7a1b0b5980da8687f9d915bdcb74c7ff4180feaf053a11bd96

Contents?: true

Size: 741 Bytes

Versions: 6

Compression:

Stored size: 741 Bytes

Contents

require 'active_support/notifications'

ActiveSupport::Notifications.subscribe(/\.faraday$/) do |event, started, finished, _, payload|

  render_http_header = ->(headers) {
    (headers || []).map do |key,value|
      if %{ PRIVATE-TOKEN Authorization }.include?(key)
        value = value.gsub(/./, "*")
      end
      "#{key}: #{value}"
    end.join("\n")
  }

  payload = {
    method:           payload[:method],
    url:              payload[:url].to_s,
    status:           payload[:status],
    response_headers: render_http_header.call(payload[:response_headers]),
    request_headers:  render_http_header.call(payload[:request_headers])
  }

  Vx::Instrumentation.delivery event, payload, event.split("."), started, finished
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
vx-instrumentation-0.1.8 lib/vx/instrumentation/probe/faraday.rb
vx-instrumentation-0.1.7 lib/vx/instrumentation/probe/faraday.rb
vx-instrumentation-0.1.6 lib/vx/instrumentation/probe/faraday.rb
vx-instrumentation-0.1.5 lib/vx/instrumentation/probe/faraday.rb
vx-instrumentation-0.1.4 lib/vx/instrumentation/probe/faraday.rb
vx-instrumentation-0.1.3 lib/vx/instrumentation/probe/faraday.rb