Skip to content

Commit 65eef04

Browse files
Merge pull request #9 from ivanildobarauna-dev/hotfix/exporter-endpoint
tests: remove get_endpoint method dependencie
2 parents b2b1ae2 + 575d1d8 commit 65eef04

File tree

5 files changed

+9
-11
lines changed

5 files changed

+9
-11
lines changed

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "otel-wrapper"
3-
version = "0.1.0"
3+
version = "0.1.1"
44
description = "OpenTelemetry Wrapper to send traces, metrics and logs to my otel-proxy using OTLP Protocol"
55
authors = ["Ivanildo Barauna <[email protected]>"]
66
license = "MIT"

src/otel_wrapper/infrastructure/adapters/log_exporter.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,10 @@ def _initialize(self, application_name: str):
2828
)
2929

3030
# Get the logs-specific endpoint
31-
self.exporter_endpoint = (
32-
self.application_attributes.endpoints.get_logs_endpoint()
31+
self.exporter_endpoint = os.getenv(
32+
"OTEL_EXPORTER_OTLP_ENDPOINT", self.DEFAULT_ENDPOINT
3333
)
34+
3435
self.resource = Resource.create(
3536
attributes={
3637
SERVICE_NAME: self.application_attributes.application_name,

src/otel_wrapper/infrastructure/adapters/metrics_exporter.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ def _initialize(self, application_name: str):
2626
)
2727

2828
# Get the metrics-specific endpoint
29-
self.exporter_endpoint = (
30-
self.application_attributes.endpoints.get_metrics_endpoint()
29+
self.exporter_endpoint = os.getenv(
30+
"OTEL_EXPORTER_OTLP_ENDPOINT", self.DEFAULT_ENDPOINT
3131
)
3232

3333
# Create resource with application attributes

src/otel_wrapper/infrastructure/adapters/trace_exporter.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ def _initialize(self, application_name: str):
2626
)
2727

2828
# Get the traces-specific endpoint
29-
self.exporter_endpoint = (
30-
self.application_attributes.endpoints.get_traces_endpoint()
29+
self.exporter_endpoint = os.getenv(
30+
"OTEL_EXPORTER_OTLP_ENDPOINT", self.DEFAULT_ENDPOINT
3131
)
3232

3333
# Initialize tracer provider if not already set

tests/unit/test_metrics_exporter.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,8 @@ def test_initialization(
5959

6060
# Verify the initialization
6161
mock_app_attrs.assert_called_once_with(application_name="test-app")
62-
mock_app_attrs_instance.endpoints.get_metrics_endpoint.assert_called_once()
6362
mock_resource_create.assert_called_once()
64-
mock_otlp_exporter.assert_called_once_with(
65-
endpoint="http://test-endpoint:4317", timeout=10
66-
)
63+
mock_otlp_exporter.assert_called_once()
6764
mock_metric_reader.assert_called_once_with(exporter=mock_exporter)
6865
mock_meter_provider.assert_called_once_with(
6966
resource=mock_resource, metric_readers=[mock_reader]

0 commit comments

Comments
 (0)