Skip to content

Commit 3f4f7bd

Browse files
committed
Remove default metadata as user-agent there is overriden by grpc itself
1 parent d3ca202 commit 3f4f7bd

File tree

5 files changed

+2
-12
lines changed

5 files changed

+2
-12
lines changed

exporter/opentelemetry-exporter-otlp-proto-grpc/src/opentelemetry/exporter/otlp/proto/grpc/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,6 @@
7373
from .version import __version__
7474

7575
_USER_AGENT_HEADER_VALUE = "OTel-OTLP-Exporter-Python/" + __version__
76-
# these will be sent as grpc metadata
77-
_OTLP_GRPC_HEADERS = [("user-agent", _USER_AGENT_HEADER_VALUE)]
7876
_OTLP_GRPC_CHANNEL_OPTIONS = [
7977
# this will appear in the http User-Agent header
8078
("grpc.primary_user_agent", _USER_AGENT_HEADER_VALUE)

exporter/opentelemetry-exporter-otlp-proto-grpc/src/opentelemetry/exporter/otlp/proto/grpc/exporter.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@
5252
)
5353
from opentelemetry.exporter.otlp.proto.grpc import (
5454
_OTLP_GRPC_CHANNEL_OPTIONS,
55-
_OTLP_GRPC_HEADERS,
5655
)
5756
from opentelemetry.proto.common.v1.common_pb2 import ( # noqa: F401
5857
AnyValue,
@@ -242,9 +241,7 @@ def __init__(
242241
elif isinstance(self._headers, dict):
243242
self._headers = tuple(self._headers.items())
244243
if self._headers is None:
245-
self._headers = tuple(_OTLP_GRPC_HEADERS)
246-
else:
247-
self._headers = tuple(self._headers) + tuple(_OTLP_GRPC_HEADERS)
244+
self._headers = tuple()
248245

249246
self._channel_options = channel_options or tuple(
250247
_OTLP_GRPC_CHANNEL_OPTIONS

exporter/opentelemetry-exporter-otlp-proto-grpc/tests/test_otlp_exporter_mixin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ def test_otlp_headers_from_env(self):
470470
# This ensures that there is no other header than standard user-agent.
471471
self.assertEqual(
472472
self.exporter._headers,
473-
(("user-agent", "OTel-OTLP-Exporter-Python/" + __version__),),
473+
(),
474474
)
475475

476476
def test_permanent_failure(self):

exporter/opentelemetry-exporter-otlp-proto-grpc/tests/test_otlp_metrics_exporter.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,6 @@ def test_otlp_headers_from_env(self, mock_ssl_channel, mock_secure):
256256
(
257257
("key1", "value1"),
258258
("key2", "VALUE=2"),
259-
("user-agent", "OTel-OTLP-Exporter-Python/" + __version__),
260259
),
261260
)
262261
exporter = OTLPMetricExporter(
@@ -268,7 +267,6 @@ def test_otlp_headers_from_env(self, mock_ssl_channel, mock_secure):
268267
(
269268
("key3", "value3"),
270269
("key4", "value4"),
271-
("user-agent", "OTel-OTLP-Exporter-Python/" + __version__),
272270
),
273271
)
274272

exporter/opentelemetry-exporter-otlp-proto-grpc/tests/test_otlp_trace_exporter.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,6 @@ def test_otlp_headers_from_env(self, mock_ssl_channel, mock_secure):
282282
(
283283
("key1", "value1"),
284284
("key2", "VALUE=2"),
285-
("user-agent", "OTel-OTLP-Exporter-Python/" + __version__),
286285
),
287286
)
288287
exporter = OTLPSpanExporter(
@@ -294,7 +293,6 @@ def test_otlp_headers_from_env(self, mock_ssl_channel, mock_secure):
294293
(
295294
("key3", "value3"),
296295
("key4", "value4"),
297-
("user-agent", "OTel-OTLP-Exporter-Python/" + __version__),
298296
),
299297
)
300298
exporter = OTLPSpanExporter(
@@ -306,7 +304,6 @@ def test_otlp_headers_from_env(self, mock_ssl_channel, mock_secure):
306304
(
307305
("key5", "value5"),
308306
("key6", "value6"),
309-
("user-agent", "OTel-OTLP-Exporter-Python/" + __version__),
310307
),
311308
)
312309

0 commit comments

Comments
 (0)