GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat: add opentelemetry tracing by aravinsiva · Pull Request #215 · googleapis/python-bigquery

This repository was archived by the owner on Mar 6, 2026. It is now read-only.

Conversation

@aravinsiva

@aravinsiva aravinsiva commented Aug 9, 2020 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

PR is to add Opentelemetry instrumentations to all api call's made by client.py and job.py modules.
This implementation was based on the Go implementation and was designed very similarly to the pub/sub and spanner implementation. Which can be found here:
googleapis/python-spanner@4069c37
googleapis/python-pubsub#149
googleapis/python-pubsub#149

Please note this PR covers the addition of instrumentation and testing of the tracing module. Another PR will be made to address additional tests being added to the test_client.py and test_job.py modules.

Addresses:
#220 & #221

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
aravinsiva added 10 commits August 1, 2020 17:41
@aravinsiva
testing first trace export
b13ad47
@aravinsiva
instrumention client.py
cacea7c
@aravinsiva
instrumenting job.py and adding documentation
63e9581
@aravinsiva
reconfiguring imports
719ed83
@aravinsiva
quick cleanup of unused variable
72f22b6
@aravinsiva
adding more attributes in module and limiting complexity of instrumen…
ff8171f
…tation
@aravinsiva
adding tests, nox and correct attribute additions in client & job
456b445
@aravinsiva
adding tests, nox and correct attribute additions in client & job (le…
f4aba6d
…ft out of last commit)
@aravinsiva
linting
e223657
@aravinsiva
reformatting noxfile.[y
78b8298
@google-cla google-cla Bot added the cla: yes This human has signed the Contributor License Agreement. label Aug 9, 2020
@aravinsiva aravinsiva changed the title Opentelemetry tracing feat: add opentelemetry tracing Aug 9, 2020
@aravinsiva
Merge branch 'master' into opentelemetry-tracing
88b1a57
@aravinsiva
aravinsiva marked this pull request as ready for review August 10, 2020 13:28
@tswast tswast added the kokoro:run Add this label to force Kokoro to re-run the tests. label Aug 10, 2020
@yoshi-kokoro yoshi-kokoro removed the kokoro:run Add this label to force Kokoro to re-run the tests. label Aug 10, 2020
@aravinsiva
Merge branch 'master' into opentelemetry-tracing
e0895c9
tswast
tswast reviewed Aug 10, 2020
View reviewed changes
Comment thread README.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread README.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread README.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread README.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread README.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread google/cloud/bigquery/job.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread google/cloud/bigquery/job.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread google/cloud/bigquery/opentelemetry_tracing.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread google/cloud/bigquery/opentelemetry_tracing.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread noxfile.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@tswast

tswast commented Aug 10, 2020

Copy link
Copy Markdown
Contributor

Build is breaking:

https://source.cloud.google.com/results/invocations/6578f68f-1263-4029-ac27-22c033fe6d86/targets/cloud-devrel%2Fclient-libraries%2Fpython%2Fgoogleapis%2Fpython-bigquery%2Fdocs%2Fdocs-presubmit/log

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

sjbrunst
sjbrunst reviewed Aug 11, 2020
View reviewed changes
Comment thread README.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread google/cloud/bigquery/client.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread google/cloud/bigquery/client.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread google/cloud/bigquery/client.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@tswast tswast added the kokoro:run Add this label to force Kokoro to re-run the tests. label Aug 11, 2020
@yoshi-kokoro yoshi-kokoro removed the kokoro:run Add this label to force Kokoro to re-run the tests. label Aug 11, 2020
kintel
kintel suggested changes Aug 11, 2020
View reviewed changes

@kintel kintel left a comment

Copy link
Copy Markdown

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.

I've added a handful of comments/questions.

One open question: You have a unit test for the SpanCreator class, but the individual API calls aren't tested for instrumentation. I'm not sure what the testing strategy is for this repo, but such tests would be nice to have.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread README.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread README.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread README.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread google/cloud/bigquery/opentelemetry_tracing.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread google/cloud/bigquery/opentelemetry_tracing.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread google/cloud/bigquery/opentelemetry_tracing.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread google/cloud/bigquery/opentelemetry_tracing.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread google/cloud/bigquery/opentelemetry_tracing.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread google/cloud/bigquery/job.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread google/cloud/bigquery/opentelemetry_tracing.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

aravinsiva added 2 commits August 11, 2020 16:08
@aravinsiva
addressing suggested changes
95a35ad
@aravinsiva
Merge branch 'opentelemetry-tracing' of https://github.com/aravinsiva…
3bf4574
…/python-bigquery into opentelemetry-tracing
@aravinsiva

aravinsiva commented Aug 11, 2020

Copy link
Copy Markdown
Contributor Author

I've added a handful of comments/questions.

One open question: You have a unit test for the SpanCreator class, but the individual API calls aren't tested for instrumentation. I'm not sure what the testing strategy is for this repo, but such tests would be nice to have.

Will add these tests unless @tswast has any objections.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

kintel
kintel reviewed Aug 11, 2020
View reviewed changes
Comment thread google/cloud/bigquery/opentelemetry_tracing.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

tswast
tswast reviewed Aug 11, 2020
View reviewed changes
Comment thread google/cloud/bigquery/opentelemetry_tracing.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread noxfile.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread setup.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@tswast tswast added the kokoro:run Add this label to force Kokoro to re-run the tests. label Aug 11, 2020
@yoshi-kokoro yoshi-kokoro removed the kokoro:run Add this label to force Kokoro to re-run the tests. label Aug 11, 2020
@aravinsiva
addressing Shawn concerns
d997175
sjbrunst
sjbrunst approved these changes Aug 20, 2020
View reviewed changes
Comment thread README.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

@tswast tswast added the kokoro:run Add this label to force Kokoro to re-run the tests. label Aug 20, 2020
@yoshi-kokoro yoshi-kokoro removed the kokoro:run Add this label to force Kokoro to re-run the tests. label Aug 20, 2020
tswast
tswast reviewed Aug 20, 2020
View reviewed changes
Comment thread google/cloud/bigquery/client.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread google/cloud/bigquery/opentelemetry_tracing.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread google/cloud/bigquery/opentelemetry_tracing.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread google/cloud/bigquery/opentelemetry_tracing.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread tests/unit/test_client.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread tests/unit/test_client.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread tests/unit/test_client.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@aravinsiva
adding test and suggested changes
61b5b85
@tswast tswast added the kokoro:run Add this label to force Kokoro to re-run the tests. label Aug 20, 2020
@yoshi-kokoro yoshi-kokoro removed the kokoro:run Add this label to force Kokoro to re-run the tests. label Aug 20, 2020
tswast
tswast reviewed Aug 20, 2020
View reviewed changes
Comment thread tests/unit/test_opentelemetry_tracing.py Outdated
"db.name": "test_project",
"location": "test_location",
}
with unittest.TestCase().assertRaises(GoogleAPICallError):

@tswast tswast Aug 20, 2020

Copy link
Copy Markdown
Contributor

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.

Could you also check that the status code is set on the span?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@aravinsiva aravinsiva Aug 20, 2020 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

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.

This test just asserts the exception was thrown there is another test that I wrote that verify's span status. Seen here:
@unittest.skipIf(opentelemetry is None, "Requiresopentelemetry")
def test_span_status_is_set(self):
from google.cloud.bigquery.routine import Routine

(line 1255 of test_client.py)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread README.rst Outdated

.. code-block:: console

pip install opentelemetry-api opentelemetry-sdk opentelemetry-instrumentation opentelemetry-exporter-google-cloud

@tswast tswast Aug 20, 2020

Copy link
Copy Markdown
Contributor

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.

I'd still prefer if these dependencies were defined in extras. You can add a line to exclude from all since it's not supported on Python 2.7.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread noxfile.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread tests/unit/test_client.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread tests/unit/test_client.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread tests/unit/test_client.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread tests/unit/test_client.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread tests/unit/test_client.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@aravinsiva
adding opentelemetry to setup.py and other suggested changes
4d1dec1
kintel
kintel approved these changes Aug 20, 2020
View reviewed changes

@kintel kintel left a comment

Copy link
Copy Markdown

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.

Looks good from my perspective!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@tswast tswast added the kokoro:run Add this label to force Kokoro to re-run the tests. label Aug 20, 2020
@yoshi-kokoro yoshi-kokoro removed the kokoro:run Add this label to force Kokoro to re-run the tests. label Aug 20, 2020
tswast
tswast approved these changes Aug 20, 2020
View reviewed changes

@tswast tswast left a comment

Copy link
Copy Markdown
Contributor

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.

Just one nit, but otherwise looks good!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread setup.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@aravinsiva
adding reasoning for not adding to [all]
7704975
@tswast tswast added the kokoro:run Add this label to force Kokoro to re-run the tests. label Aug 20, 2020
@yoshi-kokoro yoshi-kokoro removed the kokoro:run Add this label to force Kokoro to re-run the tests. label Aug 20, 2020
tswast
tswast approved these changes Aug 20, 2020
View reviewed changes
@aravinsiva
linting
839cd92
@tswast tswast added the kokoro:run Add this label to force Kokoro to re-run the tests. label Aug 20, 2020
@yoshi-kokoro yoshi-kokoro removed the kokoro:run Add this label to force Kokoro to re-run the tests. label Aug 20, 2020
@product-auto-label product-auto-label Bot added the api: bigquery Issues related to the googleapis/python-bigquery API. label Aug 21, 2020
tswast
tswast reviewed Aug 21, 2020
View reviewed changes
Comment thread tests/unit/test_opentelemetry_tracing.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread tests/unit/test_opentelemetry_tracing.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread tests/unit/test_opentelemetry_tracing.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@aravinsiva
adding Tim suggested changes
dd1e246
@tswast tswast added the kokoro:run Add this label to force Kokoro to re-run the tests. label Aug 21, 2020
@yoshi-kokoro yoshi-kokoro removed the kokoro:run Add this label to force Kokoro to re-run the tests. label Aug 21, 2020
tswast
tswast approved these changes Aug 21, 2020
View reviewed changes
@tswast
tswast merged commit a04996c into googleapis:master Aug 21, 2020
gcf-merge-on-green Bot pushed a commit that referenced this pull request Sep 22, 2020
@release-please
chore: release 1.28.0 (#238)
c75e9cd
🤖 I have created a release \*beep\* \*boop\* 
---
## [1.28.0](https://www.github.com/googleapis/python-bigquery/compare/v1.27.2...v1.28.0) (2020-09-22)


### Features

* add custom cell magic parser to handle complex `--params` values ([#213](https://www.github.com/googleapis/python-bigquery/issues/213)) ([dcfbac2](https://www.github.com/googleapis/python-bigquery/commit/dcfbac267fbf66d189b0cc7e76f4712122a74b7b))
* add instrumentation to list methods ([#239](https://www.github.com/googleapis/python-bigquery/issues/239)) ([fa9f9ca](https://www.github.com/googleapis/python-bigquery/commit/fa9f9ca491c3f9954287102c567ec483aa6151d4))
* add opentelemetry tracing ([#215](https://www.github.com/googleapis/python-bigquery/issues/215)) ([a04996c](https://www.github.com/googleapis/python-bigquery/commit/a04996c537e9d8847411fcbb1b05da5f175b339e))
* expose require_partition_filter for hive_partition ([#257](https://www.github.com/googleapis/python-bigquery/issues/257)) ([aa1613c](https://www.github.com/googleapis/python-bigquery/commit/aa1613c1bf48c7efb999cb8b8c422c80baf1950b))


### Bug Fixes

* fix dependency issue in fastavro ([#241](https://www.github.com/googleapis/python-bigquery/issues/241)) ([2874abf](https://www.github.com/googleapis/python-bigquery/commit/2874abf4827f1ea529519d4b138511d31f732a50))
* update minimum dependency versions ([#263](https://www.github.com/googleapis/python-bigquery/issues/263)) ([1be66ce](https://www.github.com/googleapis/python-bigquery/commit/1be66ce94a32b1f924bdda05d068c2977631af9e))
* validate job_config.source_format in load_table_from_dataframe ([#262](https://www.github.com/googleapis/python-bigquery/issues/262)) ([6160fee](https://www.github.com/googleapis/python-bigquery/commit/6160fee4b1a79b0ea9031cc18caf6322fe4c4084))


### Documentation

* recommend insert_rows_json to avoid call to tables.get ([#258](https://www.github.com/googleapis/python-bigquery/issues/258)) ([ae647eb](https://www.github.com/googleapis/python-bigquery/commit/ae647ebd68deff6e30ca2cffb5b7422c6de4940b))
---


This PR was generated with [Release Please](https://github.com/googleapis/release-please).
@release-please release-please Bot mentioned this pull request Jan 4, 2022
chore(main): release python-bigquery 1.27.1 #1097
Closed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

4 more reviewers
@AndrewAXue AndrewAXue AndrewAXue left review comments
@kintel kintel kintel approved these changes
@tswast tswast tswast approved these changes
@sjbrunst sjbrunst sjbrunst approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

api: bigquery Issues related to the googleapis/python-bigquery API. cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

6 participants

@aravinsiva @tswast @kintel @sjbrunst @AndrewAXue @yoshi-kokoro
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.