From 8d7e24ff154a0fb1dcc07151d97cab78d8bfe7c8 Mon Sep 17 00:00:00 2001 From: tonycody Date: Tue, 17 May 2022 18:40:40 +0800 Subject: [PATCH 01/15] feat:: Added `--insecure` of CLI argument --- .../opentelemetry/exporter/jaeger/proto/grpc/__init__.py | 4 ++++ .../src/opentelemetry/sdk/environment_variables.py | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/exporter/opentelemetry-exporter-jaeger-proto-grpc/src/opentelemetry/exporter/jaeger/proto/grpc/__init__.py b/exporter/opentelemetry-exporter-jaeger-proto-grpc/src/opentelemetry/exporter/jaeger/proto/grpc/__init__.py index ab751b0fb93..71010704521 100644 --- a/exporter/opentelemetry-exporter-jaeger-proto-grpc/src/opentelemetry/exporter/jaeger/proto/grpc/__init__.py +++ b/exporter/opentelemetry-exporter-jaeger-proto-grpc/src/opentelemetry/exporter/jaeger/proto/grpc/__init__.py @@ -87,6 +87,7 @@ from opentelemetry.sdk.environment_variables import ( OTEL_EXPORTER_JAEGER_ENDPOINT, OTEL_EXPORTER_JAEGER_TIMEOUT, + OTEL_PYTHON_INSECURE, ) from opentelemetry.sdk.resources import SERVICE_NAME, Resource from opentelemetry.sdk.trace.export import SpanExporter, SpanExportResult @@ -122,6 +123,9 @@ def __init__( self.collector_endpoint = collector_endpoint or environ.get( OTEL_EXPORTER_JAEGER_ENDPOINT, DEFAULT_GRPC_COLLECTOR_ENDPOINT ) + self.insecure = insecure or bool( + OTEL_PYTHON_INSECURE, None + ) self._timeout = timeout or int( environ.get(OTEL_EXPORTER_JAEGER_TIMEOUT, DEFAULT_EXPORT_TIMEOUT) ) diff --git a/opentelemetry-sdk/src/opentelemetry/sdk/environment_variables.py b/opentelemetry-sdk/src/opentelemetry/sdk/environment_variables.py index 145489a683e..d335467e459 100644 --- a/opentelemetry-sdk/src/opentelemetry/sdk/environment_variables.py +++ b/opentelemetry-sdk/src/opentelemetry/sdk/environment_variables.py @@ -421,3 +421,10 @@ ``DELTA``: Choose ``DELTA`` aggregation temporality for ``Counter``, ``Asynchronous Counter`` and ``Histogram``. Choose ``CUMULATIVE`` aggregation temporality for ``UpDownCounter`` and ``Asynchronous UpDownCounter``. """ + +OTEL_PYTHON_INSECURE = "OTEL_PYTHON_INSECURE" +""" +.. envvar:: OTEL_PYTHON_INSECURE + +The :envvar:`OTEL_PYTHON_INSECURE` is a boolean flag to True if collector has no encryption or authentication. +""" \ No newline at end of file From 339a59b654a88ec5f09fbb39e4fd9d4db0801dac Mon Sep 17 00:00:00 2001 From: tonycody Date: Wed, 18 May 2022 08:49:01 +0800 Subject: [PATCH 02/15] feat:: Added `--insecure` of CLI argument --- .../opentelemetry/exporter/jaeger/proto/grpc/__init__.py | 4 ++-- .../src/opentelemetry/sdk/environment_variables.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/exporter/opentelemetry-exporter-jaeger-proto-grpc/src/opentelemetry/exporter/jaeger/proto/grpc/__init__.py b/exporter/opentelemetry-exporter-jaeger-proto-grpc/src/opentelemetry/exporter/jaeger/proto/grpc/__init__.py index 71010704521..3595ef269cd 100644 --- a/exporter/opentelemetry-exporter-jaeger-proto-grpc/src/opentelemetry/exporter/jaeger/proto/grpc/__init__.py +++ b/exporter/opentelemetry-exporter-jaeger-proto-grpc/src/opentelemetry/exporter/jaeger/proto/grpc/__init__.py @@ -87,7 +87,7 @@ from opentelemetry.sdk.environment_variables import ( OTEL_EXPORTER_JAEGER_ENDPOINT, OTEL_EXPORTER_JAEGER_TIMEOUT, - OTEL_PYTHON_INSECURE, + OTEL_EXPORTER_JAEGER_GRPC_INSECURE, ) from opentelemetry.sdk.resources import SERVICE_NAME, Resource from opentelemetry.sdk.trace.export import SpanExporter, SpanExportResult @@ -124,7 +124,7 @@ def __init__( OTEL_EXPORTER_JAEGER_ENDPOINT, DEFAULT_GRPC_COLLECTOR_ENDPOINT ) self.insecure = insecure or bool( - OTEL_PYTHON_INSECURE, None + environ.get(OTEL_EXPORTER_JAEGER_GRPC_INSECURE, None) ) self._timeout = timeout or int( environ.get(OTEL_EXPORTER_JAEGER_TIMEOUT, DEFAULT_EXPORT_TIMEOUT) diff --git a/opentelemetry-sdk/src/opentelemetry/sdk/environment_variables.py b/opentelemetry-sdk/src/opentelemetry/sdk/environment_variables.py index d335467e459..51fc2a0efd9 100644 --- a/opentelemetry-sdk/src/opentelemetry/sdk/environment_variables.py +++ b/opentelemetry-sdk/src/opentelemetry/sdk/environment_variables.py @@ -422,9 +422,9 @@ Choose ``CUMULATIVE`` aggregation temporality for ``UpDownCounter`` and ``Asynchronous UpDownCounter``. """ -OTEL_PYTHON_INSECURE = "OTEL_PYTHON_INSECURE" +OTEL_EXPORTER_JAEGER_GRPC_INSECURE = "OTEL_EXPORTER_JAEGER_GRPC_INSECURE" """ -.. envvar:: OTEL_PYTHON_INSECURE +.. envvar:: OTEL_EXPORTER_JAEGER_GRPC_INSECURE -The :envvar:`OTEL_PYTHON_INSECURE` is a boolean flag to True if collector has no encryption or authentication. +The :envvar:`OTEL_EXPORTER_JAEGER_GRPC_INSECURE` is a boolean flag to True if collector has no encryption or authentication. """ \ No newline at end of file From adc914f783694233a5bdc3003ec3731fbcd49983 Mon Sep 17 00:00:00 2001 From: tonycody Date: Wed, 18 May 2022 10:08:16 +0800 Subject: [PATCH 03/15] Adding test code --- .../tests/test_jaeger_exporter_protobuf.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/exporter/opentelemetry-exporter-jaeger-proto-grpc/tests/test_jaeger_exporter_protobuf.py b/exporter/opentelemetry-exporter-jaeger-proto-grpc/tests/test_jaeger_exporter_protobuf.py index 6cc44195265..f72b3fd404d 100644 --- a/exporter/opentelemetry-exporter-jaeger-proto-grpc/tests/test_jaeger_exporter_protobuf.py +++ b/exporter/opentelemetry-exporter-jaeger-proto-grpc/tests/test_jaeger_exporter_protobuf.py @@ -37,6 +37,7 @@ OTEL_EXPORTER_JAEGER_ENDPOINT, OTEL_EXPORTER_JAEGER_TIMEOUT, OTEL_RESOURCE_ATTRIBUTES, + OTEL_EXPORTER_JAEGER_GRPC_INSECURE, ) from opentelemetry.sdk.resources import SERVICE_NAME, Resource from opentelemetry.sdk.trace import TracerProvider @@ -87,6 +88,7 @@ def test_constructor_by_environment_variables(self): + "/certs/cred.cert", OTEL_RESOURCE_ATTRIBUTES: "service.name=my-opentelemetry-jaeger", OTEL_EXPORTER_JAEGER_TIMEOUT: "5", + OTEL_EXPORTER_JAEGER_GRPC_INSECURE: "False", }, ) @@ -99,6 +101,7 @@ def test_constructor_by_environment_variables(self): self.assertEqual(exporter.collector_endpoint, collector_endpoint) self.assertEqual(exporter._timeout, 5) self.assertIsNotNone(exporter.credentials) + self.assertEqual(exporter.insecure, False) env_patch.stop() # pylint: disable=too-many-locals,too-many-statements From f170a98e94459135712eff036963cdbc46b0f588 Mon Sep 17 00:00:00 2001 From: tonycody Date: Thu, 19 May 2022 07:56:27 +0800 Subject: [PATCH 04/15] fix::values may be overwritten --- .../src/opentelemetry/exporter/jaeger/proto/grpc/__init__.py | 1 - 1 file changed, 1 deletion(-) diff --git a/exporter/opentelemetry-exporter-jaeger-proto-grpc/src/opentelemetry/exporter/jaeger/proto/grpc/__init__.py b/exporter/opentelemetry-exporter-jaeger-proto-grpc/src/opentelemetry/exporter/jaeger/proto/grpc/__init__.py index 3595ef269cd..cfc20cddec1 100644 --- a/exporter/opentelemetry-exporter-jaeger-proto-grpc/src/opentelemetry/exporter/jaeger/proto/grpc/__init__.py +++ b/exporter/opentelemetry-exporter-jaeger-proto-grpc/src/opentelemetry/exporter/jaeger/proto/grpc/__init__.py @@ -130,7 +130,6 @@ def __init__( environ.get(OTEL_EXPORTER_JAEGER_TIMEOUT, DEFAULT_EXPORT_TIMEOUT) ) self._grpc_client = None - self.insecure = insecure self.credentials = util._get_credentials(credentials) tracer_provider = trace.get_tracer_provider() self.service_name = ( From 8b95eb0f57befd37fd42ca24f80fd6ba4e7027ca Mon Sep 17 00:00:00 2001 From: tonycody Date: Thu, 19 May 2022 10:42:05 +0800 Subject: [PATCH 05/15] fix::Bool conversion --- .../src/opentelemetry/exporter/jaeger/proto/grpc/__init__.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/exporter/opentelemetry-exporter-jaeger-proto-grpc/src/opentelemetry/exporter/jaeger/proto/grpc/__init__.py b/exporter/opentelemetry-exporter-jaeger-proto-grpc/src/opentelemetry/exporter/jaeger/proto/grpc/__init__.py index cfc20cddec1..51b099fa572 100644 --- a/exporter/opentelemetry-exporter-jaeger-proto-grpc/src/opentelemetry/exporter/jaeger/proto/grpc/__init__.py +++ b/exporter/opentelemetry-exporter-jaeger-proto-grpc/src/opentelemetry/exporter/jaeger/proto/grpc/__init__.py @@ -123,9 +123,7 @@ def __init__( self.collector_endpoint = collector_endpoint or environ.get( OTEL_EXPORTER_JAEGER_ENDPOINT, DEFAULT_GRPC_COLLECTOR_ENDPOINT ) - self.insecure = insecure or bool( - environ.get(OTEL_EXPORTER_JAEGER_GRPC_INSECURE, None) - ) + self.insecure = insecure or environ.get(OTEL_EXPORTER_JAEGER_GRPC_INSECURE) self._timeout = timeout or int( environ.get(OTEL_EXPORTER_JAEGER_TIMEOUT, DEFAULT_EXPORT_TIMEOUT) ) From 27c81f7c2b6f2c720f990b5f731f5a4770c98a6e Mon Sep 17 00:00:00 2001 From: XS Date: Thu, 14 Jul 2022 08:09:37 +0800 Subject: [PATCH 06/15] Make the result to be just boolean. --- .../exporter/jaeger/proto/grpc/__init__.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/exporter/opentelemetry-exporter-jaeger-proto-grpc/src/opentelemetry/exporter/jaeger/proto/grpc/__init__.py b/exporter/opentelemetry-exporter-jaeger-proto-grpc/src/opentelemetry/exporter/jaeger/proto/grpc/__init__.py index 51b099fa572..621e9d3db22 100644 --- a/exporter/opentelemetry-exporter-jaeger-proto-grpc/src/opentelemetry/exporter/jaeger/proto/grpc/__init__.py +++ b/exporter/opentelemetry-exporter-jaeger-proto-grpc/src/opentelemetry/exporter/jaeger/proto/grpc/__init__.py @@ -111,19 +111,20 @@ class JaegerExporter(SpanExporter): """ def __init__( - self, - collector_endpoint: Optional[str] = None, - insecure: Optional[bool] = None, - credentials: Optional[ChannelCredentials] = None, - max_tag_value_length: Optional[int] = None, - timeout: Optional[int] = None, + self, + collector_endpoint: Optional[str] = None, + insecure: Optional[bool] = None, + credentials: Optional[ChannelCredentials] = None, + max_tag_value_length: Optional[int] = None, + timeout: Optional[int] = None, ): self._max_tag_value_length = max_tag_value_length self.collector_endpoint = collector_endpoint or environ.get( OTEL_EXPORTER_JAEGER_ENDPOINT, DEFAULT_GRPC_COLLECTOR_ENDPOINT ) - self.insecure = insecure or environ.get(OTEL_EXPORTER_JAEGER_GRPC_INSECURE) + self.insecure = insecure or environ.get(OTEL_EXPORTER_JAEGER_GRPC_INSECURE, + "").strip().lower() == "true" self._timeout = timeout or int( environ.get(OTEL_EXPORTER_JAEGER_TIMEOUT, DEFAULT_EXPORT_TIMEOUT) ) From d8ecdb5c755a8527efc76bdab57d12b84f193696 Mon Sep 17 00:00:00 2001 From: XS Date: Thu, 14 Jul 2022 08:52:33 +0800 Subject: [PATCH 07/15] code format --- .../src/opentelemetry/exporter/jaeger/proto/grpc/__init__.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/exporter/opentelemetry-exporter-jaeger-proto-grpc/src/opentelemetry/exporter/jaeger/proto/grpc/__init__.py b/exporter/opentelemetry-exporter-jaeger-proto-grpc/src/opentelemetry/exporter/jaeger/proto/grpc/__init__.py index 621e9d3db22..0a70622647d 100644 --- a/exporter/opentelemetry-exporter-jaeger-proto-grpc/src/opentelemetry/exporter/jaeger/proto/grpc/__init__.py +++ b/exporter/opentelemetry-exporter-jaeger-proto-grpc/src/opentelemetry/exporter/jaeger/proto/grpc/__init__.py @@ -123,8 +123,7 @@ def __init__( self.collector_endpoint = collector_endpoint or environ.get( OTEL_EXPORTER_JAEGER_ENDPOINT, DEFAULT_GRPC_COLLECTOR_ENDPOINT ) - self.insecure = insecure or environ.get(OTEL_EXPORTER_JAEGER_GRPC_INSECURE, - "").strip().lower() == "true" + self.insecure = insecure or environ.get(OTEL_EXPORTER_JAEGER_GRPC_INSECURE, "").strip().lower() == "true" self._timeout = timeout or int( environ.get(OTEL_EXPORTER_JAEGER_TIMEOUT, DEFAULT_EXPORT_TIMEOUT) ) From cce764965f83e6ee1ab201309450eee8bc766652 Mon Sep 17 00:00:00 2001 From: XS Date: Fri, 15 Jul 2022 19:33:09 +0800 Subject: [PATCH 08/15] append CHANGELOG.md --- CHANGELOG.md | 2 ++ .../src/opentelemetry/sdk/environment_variables.py | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 50261843496..cf666415b4e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ([#2781](https://github.com/open-telemetry/opentelemetry-python/pull/2781)) - Fix tracing decorator with late configuration ([#2754](https://github.com/open-telemetry/opentelemetry-python/pull/2754)) +- Fix --insecure of CLI argument + ([#2696](https://github.com/open-telemetry/opentelemetry-python/pull/2696)) ## [1.12.0rc2-0.32b0](https://github.com/open-telemetry/opentelemetry-python/releases/tag/v1.12.0rc2-0.32b0) - 2022-07-04 diff --git a/opentelemetry-sdk/src/opentelemetry/sdk/environment_variables.py b/opentelemetry-sdk/src/opentelemetry/sdk/environment_variables.py index 7bffb25ad5b..49cbb35125d 100644 --- a/opentelemetry-sdk/src/opentelemetry/sdk/environment_variables.py +++ b/opentelemetry-sdk/src/opentelemetry/sdk/environment_variables.py @@ -436,7 +436,9 @@ Choose ``CUMULATIVE`` aggregation temporality for ``UpDownCounter`` and ``Asynchronous UpDownCounter``. """ -OTEL_EXPORTER_JAEGER_GRPC_INSECURE = "OTEL_EXPORTER_JAEGER_GRPC_INSECURE" +OTEL_EXPORTER_JAEGER_GRPC_INSECURE = ( + "OTEL_EXPORTER_JAEGER_GRPC_INSECURE" +) """ .. envvar:: OTEL_EXPORTER_JAEGER_GRPC_INSECURE From ae43bfba337dd8395adb69a1179a5be10f6e9ae6 Mon Sep 17 00:00:00 2001 From: XS Date: Fri, 15 Jul 2022 19:33:38 +0800 Subject: [PATCH 09/15] fix --- .../src/opentelemetry/sdk/environment_variables.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opentelemetry-sdk/src/opentelemetry/sdk/environment_variables.py b/opentelemetry-sdk/src/opentelemetry/sdk/environment_variables.py index 49cbb35125d..b5288a2a5b2 100644 --- a/opentelemetry-sdk/src/opentelemetry/sdk/environment_variables.py +++ b/opentelemetry-sdk/src/opentelemetry/sdk/environment_variables.py @@ -443,4 +443,4 @@ .. envvar:: OTEL_EXPORTER_JAEGER_GRPC_INSECURE The :envvar:`OTEL_EXPORTER_JAEGER_GRPC_INSECURE` is a boolean flag to True if collector has no encryption or authentication. -""" \ No newline at end of file +""" From c1bdeb793e5f29d745ea717717293ed2a24fc81f Mon Sep 17 00:00:00 2001 From: XS Date: Tue, 19 Jul 2022 15:11:00 +0800 Subject: [PATCH 10/15] Revert "fix" This reverts commit ae43bfba337dd8395adb69a1179a5be10f6e9ae6. --- .../src/opentelemetry/sdk/environment_variables.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opentelemetry-sdk/src/opentelemetry/sdk/environment_variables.py b/opentelemetry-sdk/src/opentelemetry/sdk/environment_variables.py index b5288a2a5b2..49cbb35125d 100644 --- a/opentelemetry-sdk/src/opentelemetry/sdk/environment_variables.py +++ b/opentelemetry-sdk/src/opentelemetry/sdk/environment_variables.py @@ -443,4 +443,4 @@ .. envvar:: OTEL_EXPORTER_JAEGER_GRPC_INSECURE The :envvar:`OTEL_EXPORTER_JAEGER_GRPC_INSECURE` is a boolean flag to True if collector has no encryption or authentication. -""" +""" \ No newline at end of file From fbdb845e5e3ee5f997748e8f4faf635a86e1476c Mon Sep 17 00:00:00 2001 From: XS Date: Tue, 19 Jul 2022 15:11:32 +0800 Subject: [PATCH 11/15] Revert "append CHANGELOG.md" This reverts commit cce764965f83e6ee1ab201309450eee8bc766652. --- CHANGELOG.md | 2 -- .../src/opentelemetry/sdk/environment_variables.py | 4 +--- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 97869c80d5b..5af80680b26 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,8 +15,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ([#2781](https://github.com/open-telemetry/opentelemetry-python/pull/2781)) - Fix tracing decorator with late configuration ([#2754](https://github.com/open-telemetry/opentelemetry-python/pull/2754)) -- Fix --insecure of CLI argument - ([#2696](https://github.com/open-telemetry/opentelemetry-python/pull/2696)) ## [1.12.0rc2-0.32b0](https://github.com/open-telemetry/opentelemetry-python/releases/tag/v1.12.0rc2) - 2022-07-04 diff --git a/opentelemetry-sdk/src/opentelemetry/sdk/environment_variables.py b/opentelemetry-sdk/src/opentelemetry/sdk/environment_variables.py index 49cbb35125d..7bffb25ad5b 100644 --- a/opentelemetry-sdk/src/opentelemetry/sdk/environment_variables.py +++ b/opentelemetry-sdk/src/opentelemetry/sdk/environment_variables.py @@ -436,9 +436,7 @@ Choose ``CUMULATIVE`` aggregation temporality for ``UpDownCounter`` and ``Asynchronous UpDownCounter``. """ -OTEL_EXPORTER_JAEGER_GRPC_INSECURE = ( - "OTEL_EXPORTER_JAEGER_GRPC_INSECURE" -) +OTEL_EXPORTER_JAEGER_GRPC_INSECURE = "OTEL_EXPORTER_JAEGER_GRPC_INSECURE" """ .. envvar:: OTEL_EXPORTER_JAEGER_GRPC_INSECURE From d61b3d77ffec399aa2150c2b75e3e5fac2aeb329 Mon Sep 17 00:00:00 2001 From: XS Date: Tue, 19 Jul 2022 15:11:45 +0800 Subject: [PATCH 12/15] Revert "code format" This reverts commit d8ecdb5c755a8527efc76bdab57d12b84f193696. --- .../src/opentelemetry/exporter/jaeger/proto/grpc/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/exporter/opentelemetry-exporter-jaeger-proto-grpc/src/opentelemetry/exporter/jaeger/proto/grpc/__init__.py b/exporter/opentelemetry-exporter-jaeger-proto-grpc/src/opentelemetry/exporter/jaeger/proto/grpc/__init__.py index 0a70622647d..621e9d3db22 100644 --- a/exporter/opentelemetry-exporter-jaeger-proto-grpc/src/opentelemetry/exporter/jaeger/proto/grpc/__init__.py +++ b/exporter/opentelemetry-exporter-jaeger-proto-grpc/src/opentelemetry/exporter/jaeger/proto/grpc/__init__.py @@ -123,7 +123,8 @@ def __init__( self.collector_endpoint = collector_endpoint or environ.get( OTEL_EXPORTER_JAEGER_ENDPOINT, DEFAULT_GRPC_COLLECTOR_ENDPOINT ) - self.insecure = insecure or environ.get(OTEL_EXPORTER_JAEGER_GRPC_INSECURE, "").strip().lower() == "true" + self.insecure = insecure or environ.get(OTEL_EXPORTER_JAEGER_GRPC_INSECURE, + "").strip().lower() == "true" self._timeout = timeout or int( environ.get(OTEL_EXPORTER_JAEGER_TIMEOUT, DEFAULT_EXPORT_TIMEOUT) ) From fff306adc996adc7562ef816621bb8fe117aee54 Mon Sep 17 00:00:00 2001 From: XS Date: Tue, 19 Jul 2022 15:27:47 +0800 Subject: [PATCH 13/15] fix --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5af80680b26..97869c80d5b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ([#2781](https://github.com/open-telemetry/opentelemetry-python/pull/2781)) - Fix tracing decorator with late configuration ([#2754](https://github.com/open-telemetry/opentelemetry-python/pull/2754)) +- Fix --insecure of CLI argument + ([#2696](https://github.com/open-telemetry/opentelemetry-python/pull/2696)) ## [1.12.0rc2-0.32b0](https://github.com/open-telemetry/opentelemetry-python/releases/tag/v1.12.0rc2) - 2022-07-04 From 218837f1089a787f8fc0f25c23e22a07cb9d004c Mon Sep 17 00:00:00 2001 From: XS Date: Tue, 19 Jul 2022 15:30:29 +0800 Subject: [PATCH 14/15] fix --- .../src/opentelemetry/exporter/jaeger/proto/grpc/__init__.py | 3 +-- .../src/opentelemetry/sdk/environment_variables.py | 4 +++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/exporter/opentelemetry-exporter-jaeger-proto-grpc/src/opentelemetry/exporter/jaeger/proto/grpc/__init__.py b/exporter/opentelemetry-exporter-jaeger-proto-grpc/src/opentelemetry/exporter/jaeger/proto/grpc/__init__.py index 621e9d3db22..0a70622647d 100644 --- a/exporter/opentelemetry-exporter-jaeger-proto-grpc/src/opentelemetry/exporter/jaeger/proto/grpc/__init__.py +++ b/exporter/opentelemetry-exporter-jaeger-proto-grpc/src/opentelemetry/exporter/jaeger/proto/grpc/__init__.py @@ -123,8 +123,7 @@ def __init__( self.collector_endpoint = collector_endpoint or environ.get( OTEL_EXPORTER_JAEGER_ENDPOINT, DEFAULT_GRPC_COLLECTOR_ENDPOINT ) - self.insecure = insecure or environ.get(OTEL_EXPORTER_JAEGER_GRPC_INSECURE, - "").strip().lower() == "true" + self.insecure = insecure or environ.get(OTEL_EXPORTER_JAEGER_GRPC_INSECURE, "").strip().lower() == "true" self._timeout = timeout or int( environ.get(OTEL_EXPORTER_JAEGER_TIMEOUT, DEFAULT_EXPORT_TIMEOUT) ) diff --git a/opentelemetry-sdk/src/opentelemetry/sdk/environment_variables.py b/opentelemetry-sdk/src/opentelemetry/sdk/environment_variables.py index 7bffb25ad5b..49cbb35125d 100644 --- a/opentelemetry-sdk/src/opentelemetry/sdk/environment_variables.py +++ b/opentelemetry-sdk/src/opentelemetry/sdk/environment_variables.py @@ -436,7 +436,9 @@ Choose ``CUMULATIVE`` aggregation temporality for ``UpDownCounter`` and ``Asynchronous UpDownCounter``. """ -OTEL_EXPORTER_JAEGER_GRPC_INSECURE = "OTEL_EXPORTER_JAEGER_GRPC_INSECURE" +OTEL_EXPORTER_JAEGER_GRPC_INSECURE = ( + "OTEL_EXPORTER_JAEGER_GRPC_INSECURE" +) """ .. envvar:: OTEL_EXPORTER_JAEGER_GRPC_INSECURE From 508809a8a91db51a7f8df46bcefec7ddccfbc0d4 Mon Sep 17 00:00:00 2001 From: XS Date: Tue, 26 Jul 2022 14:50:47 +0800 Subject: [PATCH 15/15] lint fix --- .../exporter/jaeger/proto/grpc/__init__.py | 20 ++++++++++++------- .../tests/test_jaeger_exporter_protobuf.py | 2 +- .../sdk/environment_variables.py | 6 ++---- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/exporter/opentelemetry-exporter-jaeger-proto-grpc/src/opentelemetry/exporter/jaeger/proto/grpc/__init__.py b/exporter/opentelemetry-exporter-jaeger-proto-grpc/src/opentelemetry/exporter/jaeger/proto/grpc/__init__.py index 0a70622647d..f738ae336ce 100644 --- a/exporter/opentelemetry-exporter-jaeger-proto-grpc/src/opentelemetry/exporter/jaeger/proto/grpc/__init__.py +++ b/exporter/opentelemetry-exporter-jaeger-proto-grpc/src/opentelemetry/exporter/jaeger/proto/grpc/__init__.py @@ -111,19 +111,25 @@ class JaegerExporter(SpanExporter): """ def __init__( - self, - collector_endpoint: Optional[str] = None, - insecure: Optional[bool] = None, - credentials: Optional[ChannelCredentials] = None, - max_tag_value_length: Optional[int] = None, - timeout: Optional[int] = None, + self, + collector_endpoint: Optional[str] = None, + insecure: Optional[bool] = None, + credentials: Optional[ChannelCredentials] = None, + max_tag_value_length: Optional[int] = None, + timeout: Optional[int] = None, ): self._max_tag_value_length = max_tag_value_length self.collector_endpoint = collector_endpoint or environ.get( OTEL_EXPORTER_JAEGER_ENDPOINT, DEFAULT_GRPC_COLLECTOR_ENDPOINT ) - self.insecure = insecure or environ.get(OTEL_EXPORTER_JAEGER_GRPC_INSECURE, "").strip().lower() == "true" + self.insecure = ( + insecure + or environ.get(OTEL_EXPORTER_JAEGER_GRPC_INSECURE, "") + .strip() + .lower() + == "true" + ) self._timeout = timeout or int( environ.get(OTEL_EXPORTER_JAEGER_TIMEOUT, DEFAULT_EXPORT_TIMEOUT) ) diff --git a/exporter/opentelemetry-exporter-jaeger-proto-grpc/tests/test_jaeger_exporter_protobuf.py b/exporter/opentelemetry-exporter-jaeger-proto-grpc/tests/test_jaeger_exporter_protobuf.py index f72b3fd404d..a886a43c527 100644 --- a/exporter/opentelemetry-exporter-jaeger-proto-grpc/tests/test_jaeger_exporter_protobuf.py +++ b/exporter/opentelemetry-exporter-jaeger-proto-grpc/tests/test_jaeger_exporter_protobuf.py @@ -35,9 +35,9 @@ from opentelemetry.sdk.environment_variables import ( OTEL_EXPORTER_JAEGER_CERTIFICATE, OTEL_EXPORTER_JAEGER_ENDPOINT, + OTEL_EXPORTER_JAEGER_GRPC_INSECURE, OTEL_EXPORTER_JAEGER_TIMEOUT, OTEL_RESOURCE_ATTRIBUTES, - OTEL_EXPORTER_JAEGER_GRPC_INSECURE, ) from opentelemetry.sdk.resources import SERVICE_NAME, Resource from opentelemetry.sdk.trace import TracerProvider diff --git a/opentelemetry-sdk/src/opentelemetry/sdk/environment_variables.py b/opentelemetry-sdk/src/opentelemetry/sdk/environment_variables.py index 49cbb35125d..4a62fe41c2b 100644 --- a/opentelemetry-sdk/src/opentelemetry/sdk/environment_variables.py +++ b/opentelemetry-sdk/src/opentelemetry/sdk/environment_variables.py @@ -436,11 +436,9 @@ Choose ``CUMULATIVE`` aggregation temporality for ``UpDownCounter`` and ``Asynchronous UpDownCounter``. """ -OTEL_EXPORTER_JAEGER_GRPC_INSECURE = ( - "OTEL_EXPORTER_JAEGER_GRPC_INSECURE" -) +OTEL_EXPORTER_JAEGER_GRPC_INSECURE = "OTEL_EXPORTER_JAEGER_GRPC_INSECURE" """ .. envvar:: OTEL_EXPORTER_JAEGER_GRPC_INSECURE The :envvar:`OTEL_EXPORTER_JAEGER_GRPC_INSECURE` is a boolean flag to True if collector has no encryption or authentication. -""" \ No newline at end of file +"""