Skip to content

Commit

Permalink
Remove span_type option from trace method
Browse files Browse the repository at this point in the history
  • Loading branch information
TonyCTHsu committed Jan 9, 2024
1 parent f239d76 commit d43ff3b
Show file tree
Hide file tree
Showing 18 changed files with 23 additions and 24 deletions.
2 changes: 1 addition & 1 deletion lib/datadog/tracing/contrib/ethon/easy_patch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def datadog_before_request(continue_from: nil)
@datadog_span = Tracing.trace(
Ext::SPAN_REQUEST,
service: uri ? service_name(uri.host, datadog_configuration) : datadog_configuration[:service_name],
span_type: Tracing::Metadata::Ext::HTTP::TYPE_OUTBOUND,
type: Tracing::Metadata::Ext::HTTP::TYPE_OUTBOUND,
**trace_options
)
datadog_trace = Tracing.active_trace
Expand Down
6 changes: 3 additions & 3 deletions lib/datadog/tracing/contrib/grape/endpoint.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def endpoint_start_process(_name, _start, _finish, _id, payload)
span = Tracing.trace(
Ext::SPAN_ENDPOINT_RUN,
service: service_name,
span_type: Tracing::Metadata::Ext::HTTP::TYPE_INBOUND,
type: Tracing::Metadata::Ext::HTTP::TYPE_INBOUND,
resource: resource
)
trace = Tracing.active_trace
Expand Down Expand Up @@ -117,7 +117,7 @@ def endpoint_start_render(*)
span = Tracing.trace(
Ext::SPAN_ENDPOINT_RENDER,
service: service_name,
span_type: Tracing::Metadata::Ext::HTTP::TYPE_TEMPLATE
type: Tracing::Metadata::Ext::HTTP::TYPE_TEMPLATE
)

span.set_tag(Tracing::Metadata::Ext::TAG_COMPONENT, Ext::TAG_COMPONENT)
Expand Down Expand Up @@ -164,7 +164,7 @@ def endpoint_run_filters(name, start, finish, id, payload)
span = Tracing.trace(
Ext::SPAN_ENDPOINT_RUN_FILTERS,
service: service_name,
span_type: Tracing::Metadata::Ext::HTTP::TYPE_INBOUND,
type: Tracing::Metadata::Ext::HTTP::TYPE_INBOUND,
start_time: start
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def trace(keywords)
formatter = GRPC::Formatting::FullMethodStringFormatter.new(keywords[:method])

options = {
span_type: Tracing::Metadata::Ext::HTTP::TYPE_OUTBOUND,
type: Tracing::Metadata::Ext::HTTP::TYPE_OUTBOUND,
service: service_name, # Maintain client-side service name configuration
resource: formatter.resource_name,
on_error: on_error
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def trace(keywords)
formatter = GRPC::Formatting::MethodObjectFormatter.new(keywords[:method])

options = {
span_type: Tracing::Metadata::Ext::HTTP::TYPE_INBOUND,
type: Tracing::Metadata::Ext::HTTP::TYPE_INBOUND,
service: service_name, # TODO: Remove server-side service name configuration
resource: formatter.resource_name,
on_error: on_error
Expand Down
2 changes: 1 addition & 1 deletion lib/datadog/tracing/contrib/hanami/action_tracer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def call(env)
Ext::SPAN_ACTION,
resource: @action.to_s,
service: configuration[:service_name],
span_type: Tracing::Metadata::Ext::HTTP::TYPE_INBOUND
type: Tracing::Metadata::Ext::HTTP::TYPE_INBOUND
) do |span_op, trace_op|
span_op.set_tag(Tracing::Metadata::Ext::TAG_COMPONENT, Ext::TAG_COMPONENT)
span_op.set_tag(Tracing::Metadata::Ext::TAG_OPERATION, Ext::TAG_OPERATION_ACTION)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def render(env, response)
Ext::SPAN_RENDER,
service: configuration[:service_name],
resource: action_klass.to_s,
span_type: Tracing::Metadata::Ext::HTTP::TYPE_INBOUND
type: Tracing::Metadata::Ext::HTTP::TYPE_INBOUND
) do |span_op, _trace_op|
span_op.set_tag(Tracing::Metadata::Ext::TAG_COMPONENT, Ext::TAG_COMPONENT)
span_op.set_tag(Tracing::Metadata::Ext::TAG_OPERATION, Ext::TAG_OPERATION_RENDER)
Expand Down
2 changes: 1 addition & 1 deletion lib/datadog/tracing/contrib/hanami/router_tracing.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def call(env)
Tracing.trace(
Ext::SPAN_ROUTING,
service: configuration[:service_name],
span_type: Tracing::Metadata::Ext::HTTP::TYPE_INBOUND
type: Tracing::Metadata::Ext::HTTP::TYPE_INBOUND
) do |span_op, trace_op|
begin
span_op.set_tag(Tracing::Metadata::Ext::TAG_COMPONENT, Ext::TAG_COMPONENT)
Expand Down
2 changes: 1 addition & 1 deletion lib/datadog/tracing/contrib/mongodb/subscribers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def started(event)
# thread is involved in this execution so thread-local storage should be safe. Reference:
# https://github.com/mongodb/mongo-ruby-driver/blob/master/lib/mongo/monitoring.rb#L70
# https://github.com/mongodb/mongo-ruby-driver/blob/master/lib/mongo/monitoring/publishable.rb#L38-L56
span = Tracing.trace(Ext::SPAN_COMMAND, service: service, span_type: Ext::SPAN_TYPE_COMMAND)
span = Tracing.trace(Ext::SPAN_COMMAND, service: service, type: Ext::SPAN_TYPE_COMMAND)
set_span(event, span)

# build a quantized Query using the Parser module
Expand Down
2 changes: 1 addition & 1 deletion lib/datadog/tracing/contrib/que/tracer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class Tracer
def call(job)
trace_options = {
service: configuration[:service_name],
span_type: Tracing::Metadata::Ext::AppTypes::TYPE_WORKER,
type: Tracing::Metadata::Ext::AppTypes::TYPE_WORKER,
on_error: configuration[:on_error]
}

Expand Down
4 changes: 2 additions & 2 deletions lib/datadog/tracing/contrib/rack/middlewares.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def call(env)
# (i.e. Apache, nginx) if the header is properly set
frontend_span = compute_queue_time(env)

trace_options = { span_type: Tracing::Metadata::Ext::HTTP::TYPE_INBOUND }
trace_options = { type: Tracing::Metadata::Ext::HTTP::TYPE_INBOUND }
trace_options[:service] = configuration[:service_name] if configuration[:service_name]

# start a new request span and attach it to the current Rack environment;
Expand Down Expand Up @@ -250,7 +250,7 @@ def configuration
def trace_http_server(span_name, start_time:)
Tracing.trace(
span_name,
span_type: Tracing::Metadata::Ext::HTTP::TYPE_PROXY,
type: Tracing::Metadata::Ext::HTTP::TYPE_PROXY,
start_time: start_time,
service: configuration[:web_service_name]
)
Expand Down
2 changes: 1 addition & 1 deletion lib/datadog/tracing/contrib/rest_client/request_patch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def datadog_trace_request(uri)
span = Tracing.trace(
Ext::SPAN_REQUEST,
service: datadog_configuration[:split_by_domain] ? uri.host : datadog_configuration[:service_name],
span_type: Tracing::Metadata::Ext::HTTP::TYPE_OUTBOUND
type: Tracing::Metadata::Ext::HTTP::TYPE_OUTBOUND
)

trace = Tracing.active_trace
Expand Down
2 changes: 1 addition & 1 deletion lib/datadog/tracing/contrib/shoryuken/tracer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def call(worker_instance, queue, sqs_msg, body)
Tracing.trace(
Ext::SPAN_JOB,
service: @shoryuken_service,
span_type: Tracing::Metadata::Ext::AppTypes::TYPE_WORKER,
type: Tracing::Metadata::Ext::AppTypes::TYPE_WORKER,
on_error: @on_error
) do |span|
span.set_tag(Contrib::Ext::Messaging::TAG_SYSTEM, Ext::TAG_MESSAGING_SYSTEM)
Expand Down
2 changes: 1 addition & 1 deletion lib/datadog/tracing/contrib/sidekiq/server_tracer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def call(worker, job, queue)
Datadog::Tracing.trace(
Ext::SPAN_JOB,
service: service,
span_type: Datadog::Tracing::Metadata::Ext::AppTypes::TYPE_WORKER,
type: Datadog::Tracing::Metadata::Ext::AppTypes::TYPE_WORKER,
on_error: @on_error
) do |span|
span.resource = resource
Expand Down
4 changes: 2 additions & 2 deletions lib/datadog/tracing/contrib/sinatra/tracer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ module Base
def render(engine, data, *)
return super unless Tracing.enabled?

Tracing.trace(Ext::SPAN_RENDER_TEMPLATE, span_type: Tracing::Metadata::Ext::HTTP::TYPE_TEMPLATE) do |span|
Tracing.trace(Ext::SPAN_RENDER_TEMPLATE, type: Tracing::Metadata::Ext::HTTP::TYPE_TEMPLATE) do |span|
span.set_tag(Tracing::Metadata::Ext::TAG_COMPONENT, Ext::TAG_COMPONENT)
span.set_tag(Tracing::Metadata::Ext::TAG_OPERATION, Ext::TAG_OPERATION_RENDER_TEMPLATE)

Expand Down Expand Up @@ -52,7 +52,7 @@ def route_eval
Tracing.trace(
Ext::SPAN_ROUTE,
service: configuration[:service_name],
span_type: Tracing::Metadata::Ext::HTTP::TYPE_INBOUND,
type: Tracing::Metadata::Ext::HTTP::TYPE_INBOUND,
resource: "#{request.request_method} #{datadog_route}",
) do |span, trace|
span.set_tag(Ext::TAG_APP_NAME, settings.name || settings.superclass.name)
Expand Down
2 changes: 1 addition & 1 deletion lib/datadog/tracing/contrib/sinatra/tracer_middleware.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def call(env)
Tracing.trace(
Ext::SPAN_REQUEST,
service: configuration[:service_name],
span_type: Tracing::Metadata::Ext::HTTP::TYPE_INBOUND
type: Tracing::Metadata::Ext::HTTP::TYPE_INBOUND
) do |span|
begin
# this is kept nil until we set a correct one (either in the route or with a fallback in the ensure below)
Expand Down
2 changes: 1 addition & 1 deletion lib/datadog/tracing/contrib/sneakers/tracer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def initialize(app, *args)
def call(deserialized_msg, delivery_info, metadata, handler)
trace_options = {
service: configuration[:service_name],
span_type: Tracing::Metadata::Ext::AppTypes::TYPE_WORKER,
type: Tracing::Metadata::Ext::AppTypes::TYPE_WORKER,
on_error: configuration[:on_error]
}

Expand Down
5 changes: 2 additions & 3 deletions lib/datadog/tracing/tracer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ def trace(
start_time: nil,
tags: nil,
type: nil,
span_type: nil,
_context: nil,
&block
)
Expand Down Expand Up @@ -163,7 +162,7 @@ def trace(
service: service,
start_time: start_time,
tags: tags,
type: span_type || type,
type: type,
_trace: trace,
&block
)
Expand All @@ -180,7 +179,7 @@ def trace(
service: service,
start_time: start_time,
tags: tags,
type: span_type || type,
type: type,
_trace: trace
)
end
Expand Down
2 changes: 1 addition & 1 deletion spec/datadog/tracing/tracer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
end

context 'span_type:' do
let(:options) { { span_type: span_type } }
let(:options) { { type: span_type } }
let(:span_type) { 'my-span_type' }

it 'sets the span resource' do
Expand Down

0 comments on commit d43ff3b

Please sign in to comment.