lib/ddtrace/contrib/grape/patcher.rb in ddtrace-0.10.0 vs lib/ddtrace/contrib/grape/patcher.rb in ddtrace-0.11.0.beta1

- old
+ new

@@ -6,10 +6,11 @@ # Patcher that introduces more instrumentation for Grape endpoints, so that # new signals are executed at the beginning of each step (filters, render and run) module Patcher include Base register_as :grape, auto_patch: true + option :service_name, default: SERVICE @patched = false module_function @@ -29,10 +30,11 @@ # patch all endpoints patch_endpoint_run() patch_endpoint_render() # attach a PIN object globally and set the service once - pin = Datadog::Pin.new(SERVICE, app: 'grape', app_type: Datadog::Ext::AppTypes::WEB) + service = get_option(:service_name) + pin = Datadog::Pin.new(service, app: 'grape', app_type: Datadog::Ext::AppTypes::WEB) pin.onto(::Grape) if pin.tracer && pin.service pin.tracer.set_service_info(pin.service, 'grape', pin.app_type) end