Created
March 20, 2020 17:26
-
-
Save ericmustin/1d0447778bfeac4fc6ec2cacbb8d5ec9 to your computer and use it in GitHub Desktop.
sample_datadog_processing_pipeline
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'ddtrace' | |
Datadog.configure do |c| | |
c.use :rails, service_name: "custom_my_app" | |
c.use :rack, distributed_tracing: true, web_service_name: 'nginx-example-frontend', request_queuing: true | |
c.tracer tags: { 'env' => 'ruby-testing' } | |
end | |
Datadog::Pipeline.before_flush( | |
Datadog::Pipeline::SpanProcessor.new { |span| | |
if span.name && span.name == 'rack.request' && span.parent && span.parent.name && span.parent.name == 'http_server.queue' | |
span.parent.resource = span.resource | |
span.parent.span_type = 'web' | |
span.parent.set_tag('http.method', span.get_tag('http.method') ) | |
span.parent.set_tag('http.url', span.get_tag('http.url') ) | |
span.parent.set_tag('http.base_url', span.get_tag('http.base_url') ) | |
span.parent.set_tag('http.status_code', span.get_tag('http.status_code') ) | |
end | |
} | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment