|
37 | 37 | @contextmanager |
38 | 38 | def create_span(name, attributes=None, client=None, job_ref=None): |
39 | 39 | """Creates a ContextManager for a Span to be exported to the configured exporter. |
40 | | - If no configuration exists yields None. |
41 | | -
|
42 | | - Args: |
43 | | - name (str): Name that will be set for the span being created |
44 | | - attributes (Optional[dict]): |
45 | | - Additional attributes that pertain to |
46 | | - the specific API call (i.e. not a default attribute) |
47 | | - client (Optional[google.cloud.bigquery.client.Client]): |
48 | | - Pass in a Client object to extract any attributes that may be |
49 | | - relevant to it and add them to the created spans. |
50 | | - job_ref (Optional[google.cloud.bigquery.job._AsyncJob]) |
51 | | - Pass in a _AsyncJob object to extract any attributes that may be |
52 | | - relevant to it and add them to the created spans. |
53 | | -
|
54 | | - Yields: |
55 | | - opentelemetry.trace.Span: Yields the newly created Span. |
56 | | -
|
57 | | - Raises: |
58 | | - google.api_core.exceptions.GoogleAPICallError: |
59 | | - Raised if a span could not be yielded or issue with call to |
60 | | - OpenTelemetry. |
61 | | - """ |
| 40 | + If no configuration exists yields None. |
| 41 | +
|
| 42 | + Args: |
| 43 | + name (str): Name that will be set for the span being created |
| 44 | + attributes (Optional[dict]): |
| 45 | + Additional attributes that pertain to |
| 46 | + the specific API call (i.e. not a default attribute) |
| 47 | + client (Optional[google.cloud.bigquery.client.Client]): |
| 48 | + Pass in a Client object to extract any attributes that may be |
| 49 | + relevant to it and add them to the created spans. |
| 50 | + job_ref (Optional[google.cloud.bigquery.job._AsyncJob]) |
| 51 | + Pass in a _AsyncJob object to extract any attributes that may be |
| 52 | + relevant to it and add them to the created spans. |
| 53 | +
|
| 54 | + Yields: |
| 55 | + opentelemetry.trace.Span: Yields the newly created Span. |
| 56 | +
|
| 57 | + Raises: |
| 58 | + google.api_core.exceptions.GoogleAPICallError: |
| 59 | + Raised if a span could not be yielded or issue with call to |
| 60 | + OpenTelemetry. |
| 61 | + """ |
62 | 62 | global _warned_telemetry |
63 | 63 | final_attributes = _get_final_span_attributes(attributes, client, job_ref) |
64 | 64 | if not HAS_OPENTELEMETRY: |
|
0 commit comments