Comments (7)
I appreciate the warm welcome and the time you put into pointing me to the relevant part of the code.
Lot's of new info - I'll need to do some reading and digging to feel comfortable enough with this flow.
In the meantime, maybe someone has the knowledge and time to investigate this low priority issue and propose a fix.
We really could use the help so please take your time investigating.
from opentelemetry-ruby-contrib.
Thanks for opening this issue and providing us with details.
Do you have a hypothesis as to why this is happening?
from opentelemetry-ruby-contrib.
Thanks for opening this issue and providing us with details.
Do you have a hypothesis as to why this is happening?
I am new to ruby so not sure how to approach and debug this issue. I assume that the context should be set using some mechanism here so the sidekiq code executed after the TracerMiddleware will have context with current span set to the sidekiq span, but don't know how this can be achieved.
from opentelemetry-ruby-contrib.
@blumamir Welcome to the Ruby Community!
I am not familiar enough with Sidekiq (or Redis low level API) to know how it works but I can say with certainty that there is an implicit parent context that is shared as a Fiber local variable so as long as the code executes within the same fiber an new child spans will be attached to the "current" span:
Tracer.in_span
-> Tracer.start_span
-> Trace.current_span
https://github.com/open-telemetry/opentelemetry-ruby/blob/main/api/lib/opentelemetry/trace/tracer.rb#L28
https://github.com/open-telemetry/opentelemetry-ruby/blob/main/sdk/lib/opentelemetry/sdk/trace/tracer.rb#L33
The redis instrumentation does the same:
Looking at the test suite for the sidekiq instrumentation, it looks like it tests that the spans are generated sequentially but does not check their hierarchy:
It is difficult to tell without knowing more about how Sidekiq uses Redis under the hood, e.g. does it indeed execute a redis call as part of the client pipeline or is it batching them and sending all requests for enqueued jobs together? If it is the latter case then the span output you see is correct.
The only thing I can see for certain is that it is using Redis pipelining https://redis.io/topics/pipelining
from opentelemetry-ruby-contrib.
Thanks @arielvalentin :)
I appreciate the warm welcome and the time you put into pointing me to the relevant part of the code.
Lot's of new info - I'll need to do some reading and digging to feel comfortable enough with this flow.
In the meantime, maybe someone has the knowledge and time to investigate this low priority issue and propose a fix.
from opentelemetry-ruby-contrib.
We have the same problem.
I think I have an idea what is happening here. Basically in sidekiq there's:
def push(item)
normed = normalize_item(item)
payload = process_single(item['class'], normed)
if payload
raw_push([payload])
payload['jid']
end
end
process_single
method handles the middleware which creates the "send" span. But the Redis call is happening in the raw_push
method. That's why the Redis call is not the child of the send span.
I think one option to solve this would be to patch the push
method instead of using the client middleware, but I'm open to suggestions.
from opentelemetry-ruby-contrib.
👋 This issue has been marked as stale because it has been open with no activity. You can: comment on the issue or remove the stale label to hold stale off for a while, add the keep
label to hold stale off permanently, or do nothing. If you do nothing this issue will be closed eventually by the stale bot.
from opentelemetry-ruby-contrib.
Related Issues (20)
- Add instrumentation for Ruby Logger leveraging Log Records HOT 1
- Missing instrumentation of Net::LDAP HOT 9
- mysql2: database client span(s) not recorded when using prepared statement with mysql2 HOT 1
- Error Opening Release Request: NoMethodError: undefined method `bump_segment' for nil:NilClass HOT 5
- Non-deterministic Test Error - Kafka Tests Suite
- Rails 7.1 Compatibility
- graphql 2.1.2 tests are failing HOT 10
- Release PR #695 failed with errors
- Remove Explicit Dependencies on ActiveSupport Core Extentions HOT 1
- Add option for X-Ray remote sampling HOT 7
- AWS SDK: Add an option to add tracing information to request headers instead of message attributes HOT 2
- rdkafka instrumentation 0.4.1 fails to install HOT 3
- Release PR #732 failed with errors
- Release PR #732 failed with errors
- Release PR #741 failed with errors HOT 1
- `db.instance.id` Semantic Convention HOT 2
- Unexpected behaviour in OpenTelemetry::Common::Utilities.untraced with opentelemetry-instrumentation-mysql2 HOT 2
- Release PR #796 failed with errors HOT 1
- Rails Data Export HOT 2
- ActiveRecord 7.1 Instrument `transaction.active_record` HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from opentelemetry-ruby-contrib.