Skip to content

Commit

Permalink
Fix Postgres Integration && Add Redis Raw Command Length (#5)
Browse files Browse the repository at this point in the history
* Fix postgres integration
* Add metric for redis raw command length to redis spans
  • Loading branch information
zachmccormick authored Oct 29, 2021
1 parent 043f454 commit 69711ee
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 10 deletions.
10 changes: 0 additions & 10 deletions lib/ddtrace/contrib/pg/patcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,6 @@ def patched?
end

def patch
do_once(:pg) do
begin
patch_pg_client
rescue StandardError => e
Datadog::Tracer.log.error("Unable to apply pg integration: #{e}")
end
end
end

def patch_pg_client
::PG::Connection.send(:include, Connection)
end
end
Expand Down
1 change: 1 addition & 0 deletions lib/ddtrace/contrib/redis/ext.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ module Ext
SPAN_COMMAND = 'redis.command'.freeze
TAG_DB = 'out.redis_db'.freeze
TAG_RAW_COMMAND = 'redis.raw_command'.freeze
METRIC_RAW_COMMAND_LEN = 'redis.raw_command_length'.freeze
TYPE = 'redis'.freeze
end
end
Expand Down
2 changes: 2 additions & 0 deletions lib/ddtrace/contrib/redis/patcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ def call(*args, &block)
span.service = pin.service
span.span_type = Datadog::Contrib::Redis::Ext::TYPE
span.resource = get_command(args)
span.set_metric Datadog::Contrib::Redis::Ext::METRIC_RAW_COMMAND_LEN, args.to_s.length
Datadog::Contrib::Redis::Tags.set_common_tags(self, span)

response = call_without_datadog(*args, &block)
Expand All @@ -63,6 +64,7 @@ def call_pipeline(*args, &block)
commands = get_pipeline_commands(args)
span.resource = commands.join("\n")
span.set_metric Datadog::Contrib::Redis::Ext::METRIC_PIPELINE_LEN, commands.length
span.set_metric Datadog::Contrib::Redis::Ext::METRIC_RAW_COMMAND_LEN, args.to_s.length
Datadog::Contrib::Redis::Tags.set_common_tags(self, span)

response = call_pipeline_without_datadog(*args, &block)
Expand Down

0 comments on commit 69711ee

Please sign in to comment.