Skip to content

Commit 8d4a804

Browse files
author
Alex Boten
authored
add OTEL_LOGS_EXPORTER env variable (#2320)
As per the change in the specification, adding the variable. There will be a follow up PR to use the variable.
1 parent af862eb commit 8d4a804

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1414
([#2253](https://github.com/open-telemetry/opentelemetry-python/pull/2253))
1515
- Rename ConsoleExporter to ConsoleLogExporter
1616
([#2307](https://github.com/open-telemetry/opentelemetry-python/pull/2307))
17+
- Adding OTEL_LOGS_EXPORTER environment variable
18+
([#2320](https://github.com/open-telemetry/opentelemetry-python/pull/2320))
1719

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

opentelemetry-api/src/opentelemetry/environment_variables.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
OTEL_LOGS_EXPORTER = "OTEL_LOGS_EXPORTER"
16+
"""
17+
.. envvar:: OTEL_LOGS_EXPORTER
18+
19+
"""
20+
1521
OTEL_METRICS_EXPORTER = "OTEL_METRICS_EXPORTER"
1622
"""
1723
.. envvar:: OTEL_METRICS_EXPORTER

opentelemetry-sdk/src/opentelemetry/sdk/_configuration/__init__.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
from opentelemetry import trace
2727
from opentelemetry.environment_variables import (
28+
OTEL_LOGS_EXPORTER,
2829
OTEL_PYTHON_ID_GENERATOR,
2930
OTEL_TRACES_EXPORTER,
3031
)
@@ -45,9 +46,6 @@
4546
_RANDOM_ID_GENERATOR = "random"
4647
_DEFAULT_ID_GENERATOR = _RANDOM_ID_GENERATOR
4748

48-
# TODO: add log exporter env variable
49-
_OTEL_LOGS_EXPORTER = "OTEL_LOGS_EXPORTER"
50-
5149

5250
def _get_id_generator() -> str:
5351
return environ.get(OTEL_PYTHON_ID_GENERATOR, _DEFAULT_ID_GENERATOR)
@@ -175,7 +173,7 @@ def _import_id_generator(id_generator_name: str) -> IdGenerator:
175173
def _initialize_components(auto_instrumentation_version):
176174
trace_exporters, log_exporters = _import_exporters(
177175
_get_exporter_names(environ.get(OTEL_TRACES_EXPORTER)),
178-
_get_exporter_names(environ.get(_OTEL_LOGS_EXPORTER)),
176+
_get_exporter_names(environ.get(OTEL_LOGS_EXPORTER)),
179177
)
180178
id_generator_name = _get_id_generator()
181179
id_generator = _import_id_generator(id_generator_name)

0 commit comments

Comments
 (0)