-
Notifications
You must be signed in to change notification settings - Fork 179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Question] Why doesn't Sinatra instrumentation show full request url in http.target or http.route ? #411
Comments
Do you have any details you can share about your setup? Logs from OTEL_LOG_LEVEL=debug? Screen shots of traces with missing attributes? |
Hello , @arielvalentin I was talking mainly about your tests in this file in your code: it 'records attributes' do
get '/one/endpoint'
_(exporter.finished_spans.first.attributes).must_equal(
'http.host' => 'example.org',
'http.method' => 'GET',
'http.route' => '/endpoint',
'http.scheme' => 'http',
'http.status_code' => 200,
'http.target' => '/endpoint'
)
end
I'm trying to understand why is this expected behaviour for the test and why is in this way to go On the other hand as you requested, I'm able to reproduce this behaviour in my app as well (AS EXPECTED) , with the following config: Application = Rack::Builder.app do
map '/awesome' do
run Awesome::Controller.new
end
end module Awesome
class Controller < Sinatra::Base
SERVICE_NAME = 'awesome'
get '/' do
"This is awesome!"
end
end
end require "opentelemetry/instrumentation/all"
OpenTelemetry::SDK.configure do |c|
c.use_all # enables all instrumentation!
end This is the output of the console exporter and debug variable set:
Gemfile for my app
Thanks in advance. |
Hello again As here: Application = Rack::Builder.app do
use OpenTelemetry::Instrumentation::Rack::Middlewares::TracerMiddleware
map '/awesome' do
run Awesome::Controller.new
end
end Declaring explicitly the middle ware it adds I expected as I told you having by default Don't know if this is intentional or not. as looks like you are picking explicitly
Thanks again for your time |
Yes that is the case. Are you manually configuring the instrumentations in the SDK? If so order does matter since the sinatra instrumentation depends on Rack. We have seen similar reports with ActionPack: #88
I cannot say for sure for every decision. In a lot of cases the code and tests were copied from dd-trace-rb so it could be incorrect.
We need a lot of help updating documentation! If you and your team are available to help with docs and maintenance of the sinatra instrumentation we will be grateful!
Tracers have immutable Instrumentation Scopes ( Would you prefer to have separate spans for Sinatra or not rely on Rack dependency? cc: @scbjans @rdoherty-fastly @robertlaurin Do you all have any insights that you may be able to share? |
We are using: gem 'opentelemetry-sdk', '~> 1'
gem 'opentelemetry-exporter-otlp', '~> 0'
gem 'opentelemetry-instrumentation-all', '~> 0' And we inicialice OTEL in this way: require "opentelemetry/sdk"
require "opentelemetry/exporter/otlp"
require "opentelemetry/instrumentation/all"
OpenTelemetry::SDK.configure do |c|
c.use_all # enables all instrumentation!
end
I think will be easier but not strong opinion still starting with OTEL
Sure I will help you :) , working on the EasyCLA now |
Not sure if I add something new to the conversation: The Sinatra instrumentation uses the current Rack span and enriches it with Sinatra attributes. A benefit from that is that we can now piggyback on Racks configuration options (e.g untraced endpoints). From the issue @arielvalentin mentioned: an example of setting untraced endpoints is given in the comment. I'll also try to look into some documentation efforts next week. |
Thanks all I think it is clear for me I will try to contribute to the documentation as well. |
Hi,
We are testing Sinatra instrumentation in one of our services and we notice that
http.target
orhttp.route
or any other attribute shows the full URL requested into the client.Looks like this is the expected behaviour according to this test here
According to semantic conventions for HTTP full url should be in
http.target
Why is the Rack mapping removed from the
http.target
? We would expecthttp.target
in that specific test mentioned above to be/one/endpoint
Also at some point you will fill up
http.app
with rack mapping as said here ?Thanks
The text was updated successfully, but these errors were encountered: