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

Adding optional session parameter to Trace Exporters constructors #2783

Merged
merged 13 commits into from
Jul 1, 2022

Conversation

ronnathaniel
Copy link
Contributor

@ronnathaniel ronnathaniel commented Jun 27, 2022

Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

Currently, Trace Exporters are forced to instantiate their own Session object, taken from the requests module, on initalization.

This change will allow Users to specify Session objects for the Trace Exporters to use.

These specified Sessions will be passed in as optional paramaters to the Exporter's constructor.

requests is the only dependency, and is optional.

Fixes #2489

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Test A

Updated all Unit Tests for session-utilizing exporters. These exporters include:

  • opentelemetry-exporter-otlp-proto-http
  • Span Exporter
  • Log Exporter
  • opentelemetry-exporter-zipkin-proto-http
  • Span Exporter
  • opentelemetry-exporter-zipkin-json
  • Span Exporter

All Unit Tests have passed, as expected.

  • Test B

Running Locally. As an optional parameter, I passed in an already-Instantiated
Session object, taken from the already-leveraged requests module.

Very Simply:

zipkin_exporter = ZipkinExporter(session=requests.Session())

And proceeded to export Spans and Traces to a local backend.

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 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
  • No.

Checklist:

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

@ronnathaniel ronnathaniel requested a review from a team June 27, 2022 14:45
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Jun 27, 2022

CLA Signed

The committers listed above are authorized under a signed CLA.

@ronnathaniel ronnathaniel changed the title Adding optional session parameter to Adding optional session parameter to Trace Exporters constructors Jun 27, 2022
@ronnathaniel ronnathaniel marked this pull request as draft June 27, 2022 14:46
@ronnathaniel ronnathaniel marked this pull request as ready for review June 28, 2022 18:16
Copy link
Member

@srikanthccv srikanthccv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ronnathaniel
Copy link
Contributor Author

Unsure why all Jobs are stuck on Expected - Waiting for Status, re-requested approvals

@lzchen
Copy link
Contributor

lzchen commented Jun 30, 2022

@ronnathaniel
Looks like the build is failing on actual tests?

@lzchen lzchen closed this Jun 30, 2022
@lzchen lzchen reopened this Jun 30, 2022
@ronnathaniel
Copy link
Contributor Author

@ronnathaniel Looks like the build is failing on actual tests?

Thanks for noticing. Should be fixed now. Waiting for tests to run to confirm

@lzchen
Copy link
Contributor

lzchen commented Jun 30, 2022

@ronnathaniel
There's some lint errors failing the build. Please make sure to run and pass your tests locally by running tox.

@lzchen lzchen enabled auto-merge (squash) June 30, 2022 22:38
@lzchen lzchen merged commit 0590617 into open-telemetry:main Jul 1, 2022
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.

Trace Exporters constructor should have an optional parameter session
3 participants