Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 4 additions & 0 deletions exporter/opentelemetry-exporter-otlp/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

## Version 0.16b1

Released 2020-11-26

- Add meter reference to observers
([#1425](https://github.com/open-telemetry/opentelemetry-python/pull/1425))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,11 +208,12 @@ def __init__(
credentials is None
and Configuration().EXPORTER_OTLP_CERTIFICATE is None
):
raise ValueError("No credentials set in secure mode.")

credentials = credentials or _load_credential_from_file(
Configuration().EXPORTER_OTLP_CERTIFICATE
)
# use the default location chosen by gRPC runtime
credentials = ssl_channel_credentials()
else:
credentials = credentials or _load_credential_from_file(
Configuration().EXPORTER_OTLP_CERTIFICATE
)
self._client = self._stub(
secure_channel(
endpoint, credentials, compression=compression_algorithm
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,17 @@ def test_env_variables(self, mock_exporter_mixin):
self.assertIsNotNone(kwargs["credentials"])
self.assertIsInstance(kwargs["credentials"], ChannelCredentials)

def test_no_credentials_error(self):
with self.assertRaises(ValueError):
OTLPMetricsExporter()
@patch("opentelemetry.exporter.otlp.exporter.ssl_channel_credentials")
@patch("opentelemetry.exporter.otlp.exporter.secure_channel")
@patch(
"opentelemetry.exporter.otlp.metrics_exporter.OTLPMetricsExporter._stub"
)
# pylint: disable=unused-argument
def test_no_credentials_error(
self, mock_ssl_channel, mock_secure, mock_stub
):
OTLPMetricsExporter(insecure=False)
self.assertTrue(mock_ssl_channel.called)

@patch("opentelemetry.sdk.metrics.export.aggregate.time_ns")
def test_translate_counter_export_record(self, mock_time_ns):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,15 @@ def test_env_variables(self, mock_exporter_mixin):
self.assertIsNotNone(kwargs["credentials"])
self.assertIsInstance(kwargs["credentials"], ChannelCredentials)

def test_no_credentials_error(self):
with self.assertRaises(ValueError):
OTLPSpanExporter()
@patch("opentelemetry.exporter.otlp.exporter.ssl_channel_credentials")
@patch("opentelemetry.exporter.otlp.exporter.secure_channel")
@patch("opentelemetry.exporter.otlp.trace_exporter.OTLPSpanExporter._stub")
# pylint: disable=unused-argument
def test_no_credentials_error(
self, mock_ssl_channel, mock_secure, mock_stub
):
OTLPSpanExporter(insecure=False)
self.assertTrue(mock_ssl_channel.called)

@patch("opentelemetry.exporter.otlp.exporter.expo")
@patch("opentelemetry.exporter.otlp.exporter.sleep")
Expand Down