Skip to content

Instantly share code, notes, and snippets.

@yudai
Last active December 28, 2015 18:09
Show Gist options
  • Save yudai/7540823 to your computer and use it in GitHub Desktop.
Save yudai/7540823 to your computer and use it in GitHub Desktop.
Log Instrumentor for OpenStack CPI
module Bosh::OpenStackCloud
class ExconLoggingInstrumentor
def self.instrument(name, params = {}, &block)
params = params.dup
if params.has_key?(:headers) && params[:headers].has_key?('Authorization')
params[:headers] = params[:headers].dup
params[:headers]['Authorization'] = REDACTED
end
if params.has_key?(:password)
params[:password] = REDACTED
end
Bosh::Clouds::Config.logger.debug("#{name} #{params.inspect}")
if block_given?
yield
end
end
end
end
# And add this value to openstack_params
# at https://github.com/cloudfoundry/bosh/blob/master/bosh_openstack_cpi/lib/cloud/openstack/cloud.rb#L45
:connection_options => {:instrumentor => Bosh::OpenStackCloud::ExconLoggingInstrumentor}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment