-
Notifications
You must be signed in to change notification settings - Fork 3
Conversation
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.
Two comments. But I'm not very well informed in the python stuff.
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.
General implementation looks very good, just minor comments.
- What is the best approach for unimplemented methods? Do nothing or raise?
- I'm not totally sure I fully understand the details of Handle "mixed mode" OT/OTel tracing in OT Bridge open-telemetry/opentelemetry-python#161. Will look into detail/ask you later on.
start_time=None, | ||
ignore_active_span=False, | ||
) -> SpanWrapper: | ||
parent = child_of |
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.
Is this line really needed?
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 saves me from having to specify the else
clause. I like this as it's more compact and less indented.
Please feel free to suggest an alternative (we need to allow parent
to be None
).
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.
You're totally right. I didn't consider one of the if
s.
return int(time.time() * 1e9) | ||
|
||
|
||
# A default event name to be used when logging events when a better event name |
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.
# A default event name to be used when logging events when a better event name | |
# A default event name to be used for logging events when a better event name |
opentracing-shim/tests/test_shim.py
Outdated
# Verify span hasn't ended. | ||
self.assertIsNone(scope.span.unwrap().end_time) | ||
|
||
# Verify span hasn't ended. |
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.
# Verify span hasn't ended. | |
# Verify span hasn't ended after scope had been closed. |
e60e605
to
e3ce0fd
Compare
c42ff3d
to
564cc0e
Compare
d6e82bc
to
665747c
Compare
Add missing stubs for fully implementing the Span and Scope classes from OpenTracing.
- Explicitly use opentracing.* to make OpenTracing imports easily distinguishable. - Leave OpenTelemetry class names as-is.
Since start_span() is a context manager and since we want the OpenTelemetry Span to stop when the SpanWrapper stops, we need to turn start_active_span() into a context manager and yield the ScopeWrapper rather than return it.
Due to the differences between decimal and binary float representations, some time values yield "surprising" results when performing float arithmetic operations to convert seconds to nanoseconds and vice versa.
"ot" isn't clear enough and could lead to confusion.
If the user passes a custom ScopeManager, we want the TracerWrapper to call `active_span` on the custom ScopeManager.
Log a warning instead in order not to break application code.
Let the OTel implementation create event timestamps instead of generating a timestamp in the shim, i.e. outside of OpenTelemetry.
- Remove an unnecessary context manager layers. - Allow creating `ContextWrapper` objects either from a `SpanWrapper` or from a `Span` context manager.
39c1d80
to
8b00729
Compare
Until we figure out how to handle unsupported frameworks (e.g. gevent), we remove the `scope_manager` argument of `create_tracer` to avoid breaking the OpenTelemetry context propagation.
These are obvious and therefore unnecessary.
The API docs are clear about the `references` argument being a list. We don't try to compensate for wrong argument types elsewhere, so no reason to do that here.
Not all classes in the shim are actually wrappers, which makes the XWrapper naming convention confusing. XShim is more neutral.
In the OpenTracing API, when an exception occurs while a span is active, information about the exception is added to the span as logs and a tag is added as well. We re-add this functionality to the shim since we've overridden the `__exit__()` method in which it lives.
Validating the parent type complicates the logic of `start_span()`. Since the OpenTracing API clearly specifies the valid types for a parent span, it's the user's responsibility to specify a valid parent.
Verify that calling `close()` on a `ScopeShim` deactivates the span in the OpenTelemetry tracer.
We shouldn't return OpenTelemetry objects to the OpenTracing API.
Make it clearer that the provided tracer object should be an OpenTelemetry tracer, not an OpenTracing tracer.
81b59ed
to
082183a
Compare
This is an initial implementation of the OpenTracing bridge following received feedback on open-telemetry#120. The bridge is an implementation of the OpenTracing
Tracer
class and includes several other OpenTracing subclasses required for implementing the tracer.The following pieces are still not implemented:
To run the unit tests, use the following:
To test actual tracing, use the following:
Then instrument an app: