Skip to content

Commit

Permalink
add OTEL_LOGS_EXPORTER env variable
Browse files Browse the repository at this point in the history
As per the change in the specification, adding the variable. There will be a follow up PR to use the variable.
  • Loading branch information
Alex Boten committed Dec 13, 2021
1 parent af862eb commit 83d1e2e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
([#2253](https://github.com/open-telemetry/opentelemetry-python/pull/2253))
- Rename ConsoleExporter to ConsoleLogExporter
([#2307](https://github.com/open-telemetry/opentelemetry-python/pull/2307))
- Adding OTEL_LOGS_EXPORTER environment variable
([#2320](https://github.com/open-telemetry/opentelemetry-python/pull/2320))

## [1.7.1-0.26b1](https://github.com/open-telemetry/opentelemetry-python/releases/tag/v1.7.0-0.26b0) - 2021-11-11

Expand Down
6 changes: 6 additions & 0 deletions opentelemetry-api/src/opentelemetry/environment_variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.

OTEL_LOGS_EXPORTER = "OTEL_LOGS_EXPORTER"
"""
.. envvar:: OTEL_LOGS_EXPORTER
"""

OTEL_METRICS_EXPORTER = "OTEL_METRICS_EXPORTER"
"""
.. envvar:: OTEL_METRICS_EXPORTER
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

from opentelemetry import trace
from opentelemetry.environment_variables import (
OTEL_LOGS_EXPORTER,
OTEL_PYTHON_ID_GENERATOR,
OTEL_TRACES_EXPORTER,
)
Expand All @@ -45,9 +46,6 @@
_RANDOM_ID_GENERATOR = "random"
_DEFAULT_ID_GENERATOR = _RANDOM_ID_GENERATOR

# TODO: add log exporter env variable
_OTEL_LOGS_EXPORTER = "OTEL_LOGS_EXPORTER"


def _get_id_generator() -> str:
return environ.get(OTEL_PYTHON_ID_GENERATOR, _DEFAULT_ID_GENERATOR)
Expand Down Expand Up @@ -175,7 +173,7 @@ def _import_id_generator(id_generator_name: str) -> IdGenerator:
def _initialize_components(auto_instrumentation_version):
trace_exporters, log_exporters = _import_exporters(
_get_exporter_names(environ.get(OTEL_TRACES_EXPORTER)),
_get_exporter_names(environ.get(_OTEL_LOGS_EXPORTER)),
_get_exporter_names(environ.get(OTEL_LOGS_EXPORTER)),
)
id_generator_name = _get_id_generator()
id_generator = _import_id_generator(id_generator_name)
Expand Down

0 comments on commit 83d1e2e

Please sign in to comment.