Skip to content

Commit

Permalink
Drop the usage of name field (open-telemetry#2565)
Browse files Browse the repository at this point in the history
* Drop the usage of name field

* Add CHANGELOG entry

* Update CHANGELOG.md

Co-authored-by: Leighton Chen <[email protected]>

Co-authored-by: Leighton Chen <[email protected]>
  • Loading branch information
srikanthccv and lzchen authored Mar 25, 2022
1 parent 0bfc923 commit 64a25a0
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 16 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
([#2533](https://github.com/open-telemetry/opentelemetry-python/pull/2533))
- Add InMemoryMetricReader to metrics SDK
([#2540](https://github.com/open-telemetry/opentelemetry-python/pull/2540))
- Drop the usage of name field from log model in OTLP
([#2565](https://github.com/open-telemetry/opentelemetry-python/pull/2565))

## [1.10.0-0.29b0](https://github.com/open-telemetry/opentelemetry-python/releases/tag/v1.10.0-0.29b0) - 2022-03-10

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
Expand All @@ -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]},
Expand All @@ -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"}),
),
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
3 changes: 0 additions & 3 deletions opentelemetry-sdk/src/opentelemetry/sdk/_logs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
Expand All @@ -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,
Expand Down
1 change: 0 additions & 1 deletion opentelemetry-sdk/tests/logs/test_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
Expand Down
1 change: 0 additions & 1 deletion opentelemetry-sdk/tests/logs/test_log_record.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 64a25a0

Please sign in to comment.