Skip to content

Config module doc fixes #487

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 30 commits into from
Mar 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
3a0a966
Add configuration manager
ocelotl Mar 10, 2020
fd6f4e5
Revert to logger
ocelotl Mar 10, 2020
7009e68
Add missing conftest.py
ocelotl Mar 11, 2020
10f04fb
Work around mypy issues
ocelotl Mar 11, 2020
32bb9d2
Add workaround for tracecontext
ocelotl Mar 11, 2020
7dd05bd
Fix lint
ocelotl Mar 11, 2020
b05eaa6
Remove configuration file writing
ocelotl Mar 11, 2020
41c21eb
Use expanduser
ocelotl Mar 11, 2020
e685cb7
Fix lint
ocelotl Mar 11, 2020
00cfd7e
Update otcollector
ocelotl Mar 11, 2020
a684297
Fix lint
ocelotl Mar 11, 2020
e2e0bcc
Update opentelemetry-api/src/opentelemetry/configuration/__init__.py
ocelotl Mar 11, 2020
f54234b
Update opentelemetry-api/src/opentelemetry/configuration/__init__.py
ocelotl Mar 11, 2020
342278a
Fix lint
ocelotl Mar 11, 2020
f5df21a
Revert changes that should not be in this PR
ocelotl Mar 12, 2020
cbc1a03
Fix lint
ocelotl Mar 12, 2020
cfcc34c
Move iter_entry_points into the configuration manager
ocelotl Mar 13, 2020
5adb183
Fix test cases for exts
ocelotl Mar 13, 2020
cfc1a09
Remove remaining conftest.py files
ocelotl Mar 13, 2020
aed3398
Fixing lint WIP
ocelotl Mar 13, 2020
7703cdd
Fix lint
ocelotl Mar 13, 2020
33c7e1f
More and more fixing
ocelotl Mar 13, 2020
0ea8bd5
Update opentelemetry-api/setup.py
ocelotl Mar 13, 2020
05944d8
Remove configuration file from manager
ocelotl Mar 13, 2020
e376833
More fixing
ocelotl Mar 13, 2020
76bb125
Fix last test case
ocelotl Mar 13, 2020
d7ed20e
Documenting the configuration manager
ocelotl Mar 13, 2020
726c819
Add config module docs, fix docstring
c24t Mar 14, 2020
86738dc
Merge branch 'master' into config-module-doc-fixes
c24t Mar 14, 2020
016e5a0
Merge branch 'master' into config-module-doc-fixes
c24t Mar 14, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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