Skip to content

Commit

Permalink
Config module doc fixes (#487)
Browse files Browse the repository at this point in the history
Add the new configuration module from #466 to the generated docs.

Co-authored-by: Diego Hurtado <[email protected]>
Co-authored-by: Mauricio Vásquez <[email protected]>
  • Loading branch information
3 people authored Mar 14, 2020
1 parent 4f1aa28 commit 71c0c83
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 20 deletions.
1 change: 1 addition & 0 deletions docs/api/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ OpenTelemetry Python API
.. toctree::
:maxdepth: 1

configuration
context
metrics
trace
10 changes: 10 additions & 0 deletions docs/api/configuration.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
opentelemetry.configuration module
==================================

Module contents
---------------

.. automodule:: opentelemetry.configuration
:members:
:undoc-members:
:show-inheritance:
42 changes: 22 additions & 20 deletions opentelemetry-api/src/opentelemetry/configuration/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,30 +19,31 @@
Simple configuration manager
This is a configuration manager for the Tracer and Meter providers. It reads
configuration from environment variables prefixed with OPENTELEMETRY_PYTHON_:
configuration from environment variables prefixed with
``OPENTELEMETRY_PYTHON_``:
1. OPENTELEMETRY_PYTHON_TRACER_PROVIDER
2. OPENTELEMETRY_PYTHON_METER_PROVIDER
1. ``OPENTELEMETRY_PYTHON_TRACER_PROVIDER``
2. ``OPENTELEMETRY_PYTHON_METER_PROVIDER``
The value of these environment variables should be the name of the entry point
that points to the class that implements either provider. This OpenTelemetry
API package provides one entry point for each, which can be found in the
setup.py file:
entry_points={
...
"opentelemetry_meter_provider": [
"default_meter_provider = "
"opentelemetry.metrics:DefaultMeterProvider"
],
"opentelemetry_tracer_provider": [
"default_tracer_provider = "
"opentelemetry.trace:DefaultTracerProvider"
],
}
setup.py file::
entry_points={
...
"opentelemetry_meter_provider": [
"default_meter_provider = "
"opentelemetry.metrics:DefaultMeterProvider"
],
"opentelemetry_tracer_provider": [
"default_tracer_provider = "
"opentelemetry.trace:DefaultTracerProvider"
],
}
To use the meter provider above, then the
OPENTELEMETRY_PYTHON_METER_PROVIDER should be set to
``OPENTELEMETRY_PYTHON_METER_PROVIDER`` should be set to
"default_meter_provider" (this is not actually necessary since the
OpenTelemetry API provided providers are the default ones used if no
configuration is found in the environment variables).
Expand All @@ -52,11 +53,12 @@
be instantiated as many times as needed without concern because it will
always produce the same instance. Its attributes are lazy loaded and they
hold an instance of their corresponding provider. So, for example, to get
the configured meter provider:
the configured meter provider::
from opentelemetry.configuration import Configuration
from opentelemetry.configuration import Configuration
tracer_provider = Configuration().tracer_provider
tracer_provider = Configuration().tracer_provider
"""

from logging import getLogger
Expand Down

0 comments on commit 71c0c83

Please sign in to comment.