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

Allow to start_as_current_span with end_on_exit=False #1519

Merged
merged 5 commits into from
Jan 21, 2021

Conversation

anton-ryzhov
Copy link
Contributor

Description

start_as_current_span is just a helper that combines start_span and use_span methods. But it doesn't allow to change end_on_exit attribute. When it's required user have to call two underlying methods explicitly. Wrapper should expose all attributes to cover all cases.

Example use case:

def demo():
    with tracer.start_as_current_span('task', end_on_exit=False) as span:
        # Do some synchronous task preparation 
        # that must be part of the span
        task_data = ...

        # Contunue asynchronously
        executor.submit(
            tracer.use_span(span, use_span=True)(task_handler),
            task_data,
        )

Type of change

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

How Has This Been Tested?

Unit tests updated respectively

Does This PR Require a Contrib Repo Change?

Answer the following question based on these examples of changes that would require a Contrib Repo Change:

  • The OTel specification has changed which prompted this PR to update the method interfaces of opentelemetry-api/ or opentelemetry-sdk/

  • The method interfaces of opentelemetry-instrumentation/ have changed

  • The method interfaces of test/util have changed

  • Scripts in scripts/ that were copied over to the Contrib repo have changed

  • Configuration files that were copied over to the Contrib repo have changed (when consistency between repositories is applicable) such as in

    • pyproject.toml
    • isort.cfg
    • .flake8
  • When a new .github/CODEOWNER is added

  • Major changes to project information, such as in:

    • README.md
    • CONTRIBUTING.md
  • Yes. - Link to PR:

  • No.

Checklist:

  • Followed the style guidelines of this project
  • Changelogs have been updated
  • Unit tests have been added
  • Documentation has been updated

@anton-ryzhov anton-ryzhov marked this pull request as ready for review January 11, 2021 13:59
@anton-ryzhov anton-ryzhov requested a review from a team as a code owner January 11, 2021 13:59
@anton-ryzhov anton-ryzhov requested review from owais and lzchen and removed request for a team January 11, 2021 13:59
@lzchen lzchen merged commit b32365b into open-telemetry:master Jan 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants