Skip to content

Commit

Permalink
Update timestamp methods to use correct format, add total_recorded_attrs
Browse files Browse the repository at this point in the history
  • Loading branch information
kaylareopelle committed Oct 9, 2023
1 parent c74c92b commit 5cf254d
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions logs_sdk/lib/opentelemetry/sdk/logs/log_record_data.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,22 @@ module Logs
# Array<String, Numeric, Boolean>}
:resource, # optional OpenTelemetry::SDK::Resources::Resource
:instrumentation_scope, # OpenTelemetry::SDK::InstrumentationScope
:attributes) do # optional Hash{String => String, Numeric, Boolean, Array<String, Numeric, Boolean>}
:attributes, # optional Hash{String => String, Numeric, Boolean, Array<String, Numeric, Boolean>}
:total_recorded_attributes) do # Integer
def unix_nano_timestamp
timestamp.is_a?(Time) ? timestamp.nsec : timestamp
if timestamp.is_a?(Time)
(timestamp.to_r * 1_000_000_000).to_i
else
timestamp
end
end

def unix_nano_observed_timestamp
timestamp.is_a?(Time) ? timestamp.nsec : timestamp
if timestamp.is_a?(Time)
(timestamp.to_r * 1_000_000_000).to_i
else
timestamp
end
end
end
end
Expand Down

0 comments on commit 5cf254d

Please sign in to comment.