-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
feat: add custom tracing spans with jina>=3.12.0 #861
Conversation
9f197b5
to
5626d75
Compare
I will fix the failing pr after upgrading the jina version to 3.11.1. |
Codecov Report
@@ Coverage Diff @@
## main #861 +/- ##
==========================================
+ Coverage 80.28% 83.24% +2.96%
==========================================
Files 22 22
Lines 1633 1498 -135
==========================================
- Hits 1311 1247 -64
+ Misses 322 251 -71
Flags with carried forward coverage won't be shown. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
971c2b2
to
2c546c5
Compare
self._pool = ThreadPool(processes=num_worker_preprocess) | ||
|
||
self._model = CLIPModel(name, device=self._device, jit=jit, **kwargs) | ||
self._tokenizer = Tokenizer(name) | ||
self._image_transform = clip._transform_ndarray(self._model.image_size) | ||
|
||
if not self.tracer: | ||
self.tracer = NoOpTracer() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that the tracker is enabled by default. Is it possible to use it as an optional function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The NoOpTracer
is a no operations implementation means that it's a pass through, no overhead implementation that is available in the jina[standard] installation. This is a requirement to have a no-operations tracer otherwise using the context managers like with self.tracer.start_as_current_span
will become more complicated. The BaseExecutor already sets the value to None but the NoOpTracer should be used for custom spans even if tracing is turned off.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also the self.tracer
needs to created once based on the configuration arguments otherwise there would be unnecessary overhead trying to create an instance for every request.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Goals:
NoOpTracer
if tracing is disabled so that the operations withself.tracer
become no-op code. TheNoOpTracer
is part of theopentelemetry-api
library downloaded by jinastandard
requirements.encode
requests method.I will post a link to the completed Blog so that the usage of tracing is clear.