-
Notifications
You must be signed in to change notification settings - Fork 247
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Convert Time to the appropriate nanosecond format in LogRecordData. Remove Float option from argument declaration.
- Loading branch information
1 parent
0f0e3eb
commit d360759
Showing
8 changed files
with
79 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
logs_sdk/test/opentelemetry/sdk/logs/log_record_data_test.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# frozen_string_literal: true | ||
|
||
# Copyright The OpenTelemetry Authors | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
require 'test_helper' | ||
|
||
describe OpenTelemetry::SDK::Logs::LogRecordData do | ||
LOGS = OpenTelemetry::SDK::Logs | ||
|
||
describe 'unix_nano_timestamp' do | ||
it 'does not error if given a non-time object' do | ||
data = OpenTelemetry::SDK::Logs::LogRecordData.new(timestamp: 'fake') | ||
|
||
assert_nil data.unix_nano_timestamp | ||
end | ||
|
||
it 'converts the object to integer' do | ||
time = Time.now | ||
data = OpenTelemetry::SDK::Logs::LogRecordData.new(timestamp: time) | ||
|
||
assert_instance_of Integer, data.unix_nano_timestamp | ||
end | ||
end | ||
|
||
describe 'unix_nano_observed_timestamp' do | ||
it 'does not error if given a non-time object' do | ||
data = OpenTelemetry::SDK::Logs::LogRecordData.new(observed_timestamp: 'fake') | ||
|
||
assert_nil data.unix_nano_observed_timestamp | ||
end | ||
|
||
it 'converts the object to integer' do | ||
data = OpenTelemetry::SDK::Logs::LogRecordData.new(observed_timestamp: Time.now) | ||
|
||
assert_instance_of Integer, data.unix_nano_observed_timestamp | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters