Repository: open-telemetry/opentelemetry-python

Issue:
[Logs] drop Log.name usage
As per the change in specification: https://github.com/open-telemetry/opentelemetry-specification/pull/2271

The log name field is being deprecated in OTLP: https://github.com/open-telemetry/opentelemetry-proto/pull/357


Discussion:
Good Issue
But why You Not issue In **_Drop log Name field #2271_** In which many more people review the code
> Good Issue
> But why You Not issue In **_Drop log Name field #2271_** In which many more people review the code

@UjjwalSaini07 , sorry, what are you trying to suggest here?

Resolving patch:
diff --git a/exporter/opentelemetry-exporter-otlp-proto-grpc/src/opentelemetry/exporter/otlp/proto/grpc/_log_exporter/__init__.py b/exporter/opentelemetry-exporter-otlp-proto-grpc/src/opentelemetry/exporter/otlp/proto/grpc/_log_exporter/__init__.py
--- a/exporter/opentelemetry-exporter-otlp-proto-grpc/src/opentelemetry/exporter/otlp/proto/grpc/_log_exporter/__init__.py
+++ b/exporter/opentelemetry-exporter-otlp-proto-grpc/src/opentelemetry/exporter/otlp/proto/grpc/_log_exporter/__init__.py
@@ -63,9 +63,6 @@ def __init__(
             }
         )
 
-    def _translate_name(self, log_data: LogData) -> None:
-        self._collector_kwargs["name"] = log_data.log_record.name
-
     def _translate_time(self, log_data: LogData) -> None:
         self._collector_kwargs[
             "time_unix_nano"
@@ -140,7 +137,6 @@ def _translate_data(
 
             self._collector_kwargs = {}
 
-            self._translate_name(log_data)
             self._translate_time(log_data)
             self._translate_span_id(log_data)
             self._translate_trace_id(log_data)
diff --git a/opentelemetry-sdk/src/opentelemetry/sdk/_logs/__init__.py b/opentelemetry-sdk/src/opentelemetry/sdk/_logs/__init__.py
--- a/opentelemetry-sdk/src/opentelemetry/sdk/_logs/__init__.py
+++ b/opentelemetry-sdk/src/opentelemetry/sdk/_logs/__init__.py
@@ -59,7 +59,6 @@ def __init__(
         trace_flags: Optional[TraceFlags] = None,
         severity_text: Optional[str] = None,
         severity_number: Optional[SeverityNumber] = None,
-        name: Optional[str] = None,
         body: Optional[Any] = None,
         resource: Optional[Resource] = None,
         attributes: Optional[Attributes] = None,
@@ -70,7 +69,6 @@ def __init__(
         self.trace_flags = trace_flags
         self.severity_text = severity_text
         self.severity_number = severity_number
-        self.name = name
         self.body = body
         self.resource = resource
         self.attributes = attributes
@@ -84,7 +82,6 @@ def to_json(self) -> str:
         return json.dumps(
             {
                 "body": self.body,
-                "name": self.name,
                 "severity_number": repr(self.severity_number),
                 "severity_text": self.severity_text,
                 "attributes": self.attributes,


Test patch:
diff --git a/exporter/opentelemetry-exporter-otlp-proto-grpc/tests/logs/test_otlp_logs_exporter.py b/exporter/opentelemetry-exporter-otlp-proto-grpc/tests/logs/test_otlp_logs_exporter.py
--- a/exporter/opentelemetry-exporter-otlp-proto-grpc/tests/logs/test_otlp_logs_exporter.py
+++ b/exporter/opentelemetry-exporter-otlp-proto-grpc/tests/logs/test_otlp_logs_exporter.py
@@ -119,7 +119,6 @@ def setUp(self):
                 trace_flags=TraceFlags(0x01),
                 severity_text="WARNING",
                 severity_number=SDKSeverityNumber.WARN,
-                name="name",
                 body="Zhengzhou, We have a heaviest rains in 1000 years",
                 resource=SDKResource({"key": "value"}),
                 attributes={"a": 1, "b": "c"},
@@ -136,7 +135,6 @@ def setUp(self):
                 trace_flags=TraceFlags(0x01),
                 severity_text="INFO",
                 severity_number=SDKSeverityNumber.INFO2,
-                name="info name",
                 body="Sydney, Opera House is closed",
                 resource=SDKResource({"key": "value"}),
                 attributes={"custom_attr": [1, 2, 3]},
@@ -153,7 +151,6 @@ def setUp(self):
                 trace_flags=TraceFlags(0x01),
                 severity_text="ERROR",
                 severity_number=SDKSeverityNumber.WARN,
-                name="error name",
                 body="Mumbai, Boil water before drinking",
                 resource=SDKResource({"service": "myapp"}),
             ),
@@ -315,7 +312,6 @@ def test_translate_log_data(self):
                             log_records=[
                                 PB2LogRecord(
                                     # pylint: disable=no-member
-                                    name="name",
                                     time_unix_nano=self.log_data_1.log_record.timestamp,
                                     severity_number=self.log_data_1.log_record.severity_number.value,
                                     severity_text="WARNING",
@@ -375,7 +371,6 @@ def test_translate_multiple_logs(self):
                             log_records=[
                                 PB2LogRecord(
                                     # pylint: disable=no-member
-                                    name="name",
                                     time_unix_nano=self.log_data_1.log_record.timestamp,
                                     severity_number=self.log_data_1.log_record.severity_number.value,
                                     severity_text="WARNING",
@@ -413,7 +408,6 @@ def test_translate_multiple_logs(self):
                             log_records=[
                                 PB2LogRecord(
                                     # pylint: disable=no-member
-                                    name="info name",
                                     time_unix_nano=self.log_data_2.log_record.timestamp,
                                     severity_number=self.log_data_2.log_record.severity_number.value,
                                     severity_text="INFO",
@@ -459,7 +453,6 @@ def test_translate_multiple_logs(self):
                             log_records=[
                                 PB2LogRecord(
                                     # pylint: disable=no-member
-                                    name="error name",
                                     time_unix_nano=self.log_data_3.log_record.timestamp,
                                     severity_number=self.log_data_3.log_record.severity_number.value,
                                     severity_text="ERROR",
diff --git a/opentelemetry-sdk/tests/logs/test_export.py b/opentelemetry-sdk/tests/logs/test_export.py
--- a/opentelemetry-sdk/tests/logs/test_export.py
+++ b/opentelemetry-sdk/tests/logs/test_export.py
@@ -334,7 +334,6 @@ def test_export(self):  # pylint: disable=no-self-use
                 trace_flags=TraceFlags(0x01),
                 severity_text="WARN",
                 severity_number=SeverityNumber.WARN,
-                name="name",
                 body="Zhengzhou, We have a heaviest rains in 1000 years",
                 resource=SDKResource({"key": "value"}),
                 attributes={"a": 1, "b": "c"},
diff --git a/opentelemetry-sdk/tests/logs/test_log_record.py b/opentelemetry-sdk/tests/logs/test_log_record.py
--- a/opentelemetry-sdk/tests/logs/test_log_record.py
+++ b/opentelemetry-sdk/tests/logs/test_log_record.py
@@ -23,7 +23,6 @@ def test_log_record_to_json(self):
         expected = json.dumps(
             {
                 "body": "a log line",
-                "name": None,
                 "severity_number": "None",
                 "severity_text": None,
                 "attributes": None,