Skip to content

Commit

Permalink
[active_record] update the app name for the service details
Browse files Browse the repository at this point in the history
  • Loading branch information
Emanuele Palazzetti committed Jan 26, 2018
1 parent 2be20c3 commit fc319c4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/ddtrace/contrib/active_record/patcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def self.database_service
return @database_service if defined?(@database_service)

@database_service = get_option(:service_name) || adapter_name
get_option(:tracer).set_service_info(@database_service, 'sinatra', Ext::AppTypes::DB)
get_option(:tracer).set_service_info(@database_service, 'active_record', Ext::AppTypes::DB)
@database_service
end

Expand Down
6 changes: 6 additions & 0 deletions spec/ddtrace/contrib/active_record/tracer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,10 @@
expect(span.get_tag('out.port')).to eq('53306')
expect(span.get_tag('sql.query')).to eq(nil)
end

it 'sends the right service information' do
Article.count
services = tracer.writer.services
expect(services['mysql2']).to eq({'app'=>'active_record', 'app_type'=>'db'})
end
end

0 comments on commit fc319c4

Please sign in to comment.