Make prettier in python folder (#2331)
This commit is contained in:
parent
fd935b63dc
commit
0d5ca6d872
|
@ -67,7 +67,9 @@ print(baggage.get_baggage("context", child_ctx))
|
||||||
|
|
||||||
## Manually setting span context
|
## Manually setting span context
|
||||||
|
|
||||||
Usually your application or serving framework will take care of propagating your trace context for you. But in some cases, you may need to save your trace context (with `.inject`) and restore it elsewhere (with `.extract`) yourself.
|
Usually your application or serving framework will take care of propagating your
|
||||||
|
trace context for you. But in some cases, you may need to save your trace context
|
||||||
|
(with `.inject`) and restore it elsewhere (with `.extract`) yourself.
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from opentelemetry import trace, context
|
from opentelemetry import trace, context
|
||||||
|
|
|
@ -157,7 +157,10 @@ current_span.set_attribute("operation.other-stuff", [1, 2, 3])
|
||||||
|
|
||||||
### Add semantic attributes
|
### Add semantic attributes
|
||||||
|
|
||||||
[Semantic Attributes](/docs/reference/specification/trace/semantic_conventions/) are pre-defined [Attributes](/docs/concepts/signals/traces/#attributes) that are well-known naming conventions for common kinds of data. Using Semantic Attributes lets you normalize this kind of information across your systems.
|
[Semantic Attributes](/docs/reference/specification/trace/semantic_conventions/)
|
||||||
|
are pre-defined [Attributes](/docs/concepts/signals/traces/#attributes) that are
|
||||||
|
well-known naming conventions for common kinds of data. Using Semantic Attributes
|
||||||
|
lets you normalize this kind of information across your systems.
|
||||||
|
|
||||||
To use Semantic Attributes in Python, ensure you have the semantic conventions package:
|
To use Semantic Attributes in Python, ensure you have the semantic conventions package:
|
||||||
|
|
||||||
|
@ -312,8 +315,8 @@ Note that environment variables will override what's configured in code.
|
||||||
|
|
||||||
### Creating and using synchronous instruments
|
### Creating and using synchronous instruments
|
||||||
|
|
||||||
Instruments are used to make measurements of your application. [Synchronous
|
Instruments are used to make measurements of your application.
|
||||||
instruments](/docs/reference/specification/metrics/api/#synchronous-and-asynchronous-instruments)
|
[Synchronous instruments](/docs/reference/specification/metrics/api/#synchronous-and-asynchronous-instruments)
|
||||||
are used inline with application/business processing logic, like when handling a
|
are used inline with application/business processing logic, like when handling a
|
||||||
request or calling another service.
|
request or calling another service.
|
||||||
|
|
||||||
|
@ -328,9 +331,8 @@ work_counter = meter.create_counter(
|
||||||
)
|
)
|
||||||
```
|
```
|
||||||
|
|
||||||
Using the Counter's [add
|
Using the Counter's [add operation](/docs/reference/specification/metrics/api/#add),
|
||||||
operation](/docs/reference/specification/metrics/api/#add), the code below
|
the code below increments the count by one, using the work item's type as an attribute.
|
||||||
increments the count by one, using the work item's type as an attribute.
|
|
||||||
|
|
||||||
```python
|
```python
|
||||||
def do_work(work_item):
|
def do_work(work_item):
|
||||||
|
@ -341,17 +343,15 @@ def do_work(work_item):
|
||||||
|
|
||||||
### Creating and using asynchronous instruments
|
### Creating and using asynchronous instruments
|
||||||
|
|
||||||
[Asynchronous
|
[Asynchronous instruments](/docs/reference/specification/metrics/api/#synchronous-and-asynchronous-instruments)
|
||||||
instruments](/docs/reference/specification/metrics/api/#synchronous-and-asynchronous-instruments)
|
|
||||||
give the user a way to register callback functions, which are invoked on demand
|
give the user a way to register callback functions, which are invoked on demand
|
||||||
to make measurements. This is useful to periodically measure a value that cannot
|
to make measurements. This is useful to periodically measure a value that cannot
|
||||||
be instrumented directly. Async instruments are created with zero or more
|
be instrumented directly. Async instruments are created with zero or more
|
||||||
callbacks which will be invoked during metric collection. Each callback accepts
|
callbacks which will be invoked during metric collection. Each callback accepts
|
||||||
options from the SDK and returns its observations.
|
options from the SDK and returns its observations.
|
||||||
|
|
||||||
This example uses an [Asynchronous
|
This example uses an [Asynchronous Gauge](/docs/reference/specification/metrics/api/#asynchronous-gauge)
|
||||||
Gauge](/docs/reference/specification/metrics/api/#asynchronous-gauge) instrument
|
instrument to report the current config version provided by a configuration server by
|
||||||
to report the current config version provided by a configuration server by
|
|
||||||
scraping an HTTP endpoint. First, write a callback to make observations:
|
scraping an HTTP endpoint. First, write a callback to make observations:
|
||||||
|
|
||||||
```python
|
```python
|
||||||
|
@ -385,16 +385,11 @@ meter.create_observable_gauge(
|
||||||
|
|
||||||
- Trace
|
- Trace
|
||||||
- [Trace Concepts](/docs/concepts/signals/traces/)
|
- [Trace Concepts](/docs/concepts/signals/traces/)
|
||||||
- [Trace
|
- [Trace Specification](/docs/reference/specification/overview/#tracing-signal)
|
||||||
Specification](/docs/reference/specification/overview/#tracing-signal)
|
- [Python Trace API Documentation](https://opentelemetry-python.readthedocs.io/en/latest/api/trace.html)
|
||||||
- [Python Trace API
|
- [Python Trace SDK Documentation](https://opentelemetry-python.readthedocs.io/en/latest/sdk/trace.html)
|
||||||
Documentation](https://opentelemetry-python.readthedocs.io/en/latest/api/trace.html)
|
|
||||||
- [Python Trace SDK
|
|
||||||
Documentation](https://opentelemetry-python.readthedocs.io/en/latest/sdk/trace.html)
|
|
||||||
- Metrics
|
- Metrics
|
||||||
- [Metrics Concepts](/docs/concepts/signals/metrics/)
|
- [Metrics Concepts](/docs/concepts/signals/metrics/)
|
||||||
- [Metrics Specification](/docs/reference/specification/metrics/)
|
- [Metrics Specification](/docs/reference/specification/metrics/)
|
||||||
- [Python Metrics API
|
- [Python Metrics API Documentation](https://opentelemetry-python.readthedocs.io/en/latest/api/metrics.html)
|
||||||
Documentation](https://opentelemetry-python.readthedocs.io/en/latest/api/metrics.html)
|
- [Python Metrics SDK Documentation](https://opentelemetry-python.readthedocs.io/en/latest/sdk/metrics.html)
|
||||||
- [Python Metrics SDK
|
|
||||||
Documentation](https://opentelemetry-python.readthedocs.io/en/latest/sdk/metrics.html)
|
|
||||||
|
|
Loading…
Reference in New Issue