Skip to content
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

Check the protected code in SDK Span methods that use self._lock #362

Closed
ocelotl opened this issue Jan 9, 2020 · 6 comments
Closed

Check the protected code in SDK Span methods that use self._lock #362

ocelotl opened this issue Jan 9, 2020 · 6 comments
Assignees
Labels
discussion Issue or PR that needs/is extended discussion. sdk Affects the SDK package.

Comments

@ocelotl
Copy link
Contributor

ocelotl commented Jan 9, 2020

This started when discussing #358, @codeboten and @toumorokoshi raise a valid concern regarding what should and should not be protected by self._lock in several methods of the SDK Span class.

Take a particular good look into this.

@ocelotl ocelotl added the discussion Issue or PR that needs/is extended discussion. label Jan 9, 2020
@ocelotl ocelotl self-assigned this Jan 9, 2020
@ocelotl ocelotl changed the title Check the protected code in SDK Span methods that use self._lock Check the protected code in SDK Span methods that use self._lock Jan 9, 2020
@ocelotl ocelotl added the sdk Affects the SDK package. label Jan 9, 2020
@Oberon00
Copy link
Member

You linked the is_recording_events method here, which just returns the literal True: https://github.com/open-telemetry/opentelemetry-python/pull/358/files#diff-2f7b55162ad705df55ee48eb71914737L280-L281

Was this intentional? If so, how is this related?

@ocelotl
Copy link
Contributor Author

ocelotl commented Jan 10, 2020

Yes, because of this. I am a bit surprised by the implementation of the is_recording_events method, why do we bother asking if the span is recording events if it always is?

@Oberon00
Copy link
Member

Oberon00 commented Jan 10, 2020

Only a SDK.Span is always recording events. A DefaultSpan is not (the SDK returns a default span for spans that are sampled out, for example). Some 3rd party API-implementation may even have a more complex logic to determime if a span is recording events
(BTW, this method was renamed to just isRecording in the spec).

@ocelotl
Copy link
Contributor Author

ocelotl commented Jan 10, 2020

So, what's the idea behind having this in the SDK code of Span.start if it will always be True? Are we having it there so that subclasses that may override is_recording_events will also have that check in place for their corresponding start methods?

@Oberon00
Copy link
Member

They currently don't really serve a purpose, I guess. In this case the blame view of the file would have helped you since I commented on that exact issue in the PR that added the ckeck (and is_recording_events): #141 (comment)

@lzchen
Copy link
Contributor

lzchen commented Dec 18, 2020

Closing due to inactivity.

@lzchen lzchen closed this as completed Dec 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion Issue or PR that needs/is extended discussion. sdk Affects the SDK package.
Projects
None yet
Development

No branches or pull requests

3 participants