Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix otlp exporter to export log_record.observed_timestamp #3785

Merged
merged 8 commits into from
Apr 4, 2024
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
([#3751](https://github.com/open-telemetry/opentelemetry-python/pull/3751))
- bump mypy to 0.982
([#3776](https://github.com/open-telemetry/opentelemetry-python/pull/3776))
- Fix otlp exporter to export log_record.observed_timestamp
([#3785](https://github.com/open-telemetry/opentelemetry-python/pull/3785))
- Add support for OTEL_SDK_DISABLED environment variable
([#3648](https://github.com/open-telemetry/opentelemetry-python/pull/3648))
- Fix ValueError message for PeriodicExportingMetricsReader
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ def encode_logs(batch: Sequence[LogData]) -> ExportLogsServiceRequest:
def _encode_log(log_data: LogData) -> PB2LogRecord:
return PB2LogRecord(
time_unix_nano=log_data.log_record.timestamp,
observed_time_unix_nano=log_data.log_record.observed_timestamp,
span_id=_encode_span_id(log_data.log_record.span_id),
trace_id=_encode_trace_id(log_data.log_record.trace_id),
flags=int(log_data.log_record.trace_flags),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ def _get_sdk_log_data() -> List[LogData]:
log1 = LogData(
log_record=SDKLogRecord(
timestamp=1644650195189786880,
observed_timestamp=1644650195189786881,
trace_id=89564621134313219400156819398935297684,
span_id=1312458408527513268,
trace_flags=TraceFlags(0x01),
Expand All @@ -89,6 +90,7 @@ def _get_sdk_log_data() -> List[LogData]:
log2 = LogData(
log_record=SDKLogRecord(
timestamp=1644650249738562048,
observed_timestamp=1644650249738562049,
trace_id=0,
span_id=0,
trace_flags=TraceFlags.DEFAULT,
Expand All @@ -106,6 +108,7 @@ def _get_sdk_log_data() -> List[LogData]:
log3 = LogData(
log_record=SDKLogRecord(
timestamp=1644650427658989056,
observed_timestamp=1644650427658989057,
trace_id=271615924622795969659406376515024083555,
span_id=4242561578944770265,
trace_flags=TraceFlags(0x01),
Expand All @@ -121,6 +124,7 @@ def _get_sdk_log_data() -> List[LogData]:
log4 = LogData(
log_record=SDKLogRecord(
timestamp=1644650584292683008,
observed_timestamp=1644650584292683009,
trace_id=212592107417388365804938480559624925555,
span_id=6077757853989569223,
trace_flags=TraceFlags(0x01),
Expand Down Expand Up @@ -164,6 +168,7 @@ def get_test_logs(
log_records=[
PB2LogRecord(
time_unix_nano=1644650195189786880,
observed_time_unix_nano=1644650195189786881,
trace_id=_encode_trace_id(
89564621134313219400156819398935297684
),
Expand All @@ -190,6 +195,7 @@ def get_test_logs(
log_records=[
PB2LogRecord(
time_unix_nano=1644650584292683008,
observed_time_unix_nano=1644650584292683009,
trace_id=_encode_trace_id(
212592107417388365804938480559624925555
),
Expand Down Expand Up @@ -232,6 +238,7 @@ def get_test_logs(
log_records=[
PB2LogRecord(
time_unix_nano=1644650249738562048,
observed_time_unix_nano=1644650249738562049,
trace_id=_encode_trace_id(0),
span_id=_encode_span_id(0),
flags=int(TraceFlags.DEFAULT),
Expand All @@ -249,6 +256,7 @@ def get_test_logs(
log_records=[
PB2LogRecord(
time_unix_nano=1644650427658989056,
observed_time_unix_nano=1644650427658989057,
trace_id=_encode_trace_id(
271615924622795969659406376515024083555
),
Expand Down
Loading