Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita04996c

Browse files
aravinsivatswast
andauthored
feat: add opentelemetry tracing (#215)
* testing first trace export* instrumention client.py* instrumenting job.py and adding documentation* reconfiguring imports* quick cleanup of unused variable* adding more attributes in module and limiting complexity of instrumentation* adding tests, nox and correct attribute additions in client & job* adding tests, nox and correct attribute additions in client & job (left out of last commit)* linting* reformatting noxfile.[y* addressing suggested changes* adding suggested changes* removing print statements* setting same version across all OT [ackages and other reccommended changes* suggested changes* fixing packages issue in nox and updating documentation* fixing module install issue* restructuring design for testing adding first layer of tests (some still failing)* adding reamining client tests and all job tests* fixing linting issues* fixing trace not defined issue* fixing lint issues* fixing documentation issues and python2 testing issue* linting and fixing coverage issues* adding suggested changes* linting* adding Shawn's suggested changes* fixing _default_span_attribute_bug* reverting uneccesxsary changes* adding more tests for all job_ref parameters* removing dependecny, ordering imports and other changes* addressing Shawn concerns* adding test and suggested changes* adding opentelemetry to setup.py and other suggested changes* adding reasoning for not adding to [all]* linting* adding Tim suggested changesCo-authored-by: Tim Swast <swast@google.com>
1 parent1c601aa commita04996c

File tree

9 files changed

+1506
-319
lines changed

9 files changed

+1506
-319
lines changed

‎README.rst‎

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,3 +102,41 @@ Perform a query
102102
103103
for rowin rows:
104104
print(row.name)
105+
106+
Instrumenting With OpenTelemetry
107+
--------------------------------
108+
109+
This application uses `OpenTelemetry`_ to output tracing data from
110+
API calls to BigQuery. To enable OpenTelemetry tracing in
111+
the BigQuery client the following PyPI packages need to be installed:
112+
113+
.. _OpenTelemetry:https://opentelemetry.io
114+
115+
..code-block::console
116+
117+
pip install google-cloud-bigquery[opentelemetry] opentelemetry-exporter-google-cloud
118+
119+
After installation, OpenTelemetry can be used in the BigQuery
120+
client and in BigQuery jobs. First, however, an exporter must be
121+
specified for where the trace data will be outputted to. An
122+
example of this can be found here:
123+
124+
..code-block::python
125+
126+
from opentelemetryimport trace
127+
from opentelemetry.sdk.traceimport TracerProvider
128+
from opentelemetry.sdk.trace.exportimport BatchExportSpanProcessor
129+
from opentelemetry.exporter.cloud_traceimport CloudTraceSpanExporter
130+
trace.set_tracer_provider(TracerProvider())
131+
trace.get_tracer_provider().add_span_processor(
132+
BatchExportSpanProcessor(CloudTraceSpanExporter())
133+
)
134+
135+
In this example all tracing data will be published to the Google
136+
`Cloud Trace`_ console. For more information on OpenTelemetry, please consult the `OpenTelemetry documentation`_.
137+
138+
.. _OpenTelemetry documentation:https://opentelemetry-python.readthedocs.io
139+
.. _Cloud Trace:https://cloud.google.com/trace
140+
141+
142+

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp