Skip to content

Commit 71c0c83

Browse files
c24tocelotlmauriciovasquezbernal
authored
Config module doc fixes (open-telemetry#487)
Add the new configuration module from open-telemetry#466 to the generated docs. Co-authored-by: Diego Hurtado <ocelotl@users.noreply.github.com> Co-authored-by: Mauricio Vásquez <mauricio@kinvolk.io>
1 parent 4f1aa28 commit 71c0c83

File tree

3 files changed

+33
-20
lines changed

3 files changed

+33
-20
lines changed

docs/api/api.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ OpenTelemetry Python API
66
.. toctree::
77
:maxdepth: 1
88

9+
configuration
910
context
1011
metrics
1112
trace

docs/api/configuration.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
opentelemetry.configuration module
2+
==================================
3+
4+
Module contents
5+
---------------
6+
7+
.. automodule:: opentelemetry.configuration
8+
:members:
9+
:undoc-members:
10+
:show-inheritance:

opentelemetry-api/src/opentelemetry/configuration/__init__.py

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -19,30 +19,31 @@
1919
Simple configuration manager
2020
2121
This is a configuration manager for the Tracer and Meter providers. It reads
22-
configuration from environment variables prefixed with OPENTELEMETRY_PYTHON_:
22+
configuration from environment variables prefixed with
23+
``OPENTELEMETRY_PYTHON_``:
2324
24-
1. OPENTELEMETRY_PYTHON_TRACER_PROVIDER
25-
2. OPENTELEMETRY_PYTHON_METER_PROVIDER
25+
1. ``OPENTELEMETRY_PYTHON_TRACER_PROVIDER``
26+
2. ``OPENTELEMETRY_PYTHON_METER_PROVIDER``
2627
2728
The value of these environment variables should be the name of the entry point
2829
that points to the class that implements either provider. This OpenTelemetry
2930
API package provides one entry point for each, which can be found in the
30-
setup.py file:
31-
32-
entry_points={
33-
...
34-
"opentelemetry_meter_provider": [
35-
"default_meter_provider = "
36-
"opentelemetry.metrics:DefaultMeterProvider"
37-
],
38-
"opentelemetry_tracer_provider": [
39-
"default_tracer_provider = "
40-
"opentelemetry.trace:DefaultTracerProvider"
41-
],
42-
}
31+
setup.py file::
32+
33+
entry_points={
34+
...
35+
"opentelemetry_meter_provider": [
36+
"default_meter_provider = "
37+
"opentelemetry.metrics:DefaultMeterProvider"
38+
],
39+
"opentelemetry_tracer_provider": [
40+
"default_tracer_provider = "
41+
"opentelemetry.trace:DefaultTracerProvider"
42+
],
43+
}
4344
4445
To use the meter provider above, then the
45-
OPENTELEMETRY_PYTHON_METER_PROVIDER should be set to
46+
``OPENTELEMETRY_PYTHON_METER_PROVIDER`` should be set to
4647
"default_meter_provider" (this is not actually necessary since the
4748
OpenTelemetry API provided providers are the default ones used if no
4849
configuration is found in the environment variables).
@@ -52,11 +53,12 @@
5253
be instantiated as many times as needed without concern because it will
5354
always produce the same instance. Its attributes are lazy loaded and they
5455
hold an instance of their corresponding provider. So, for example, to get
55-
the configured meter provider:
56+
the configured meter provider::
5657
57-
from opentelemetry.configuration import Configuration
58+
from opentelemetry.configuration import Configuration
59+
60+
tracer_provider = Configuration().tracer_provider
5861
59-
tracer_provider = Configuration().tracer_provider
6062
"""
6163

6264
from logging import getLogger

0 commit comments

Comments
 (0)