Skip to content

Commit 20e89c7

Browse files
vpellanivoanjo
andcommitted
Apply suggestions
Co-authored-by: Ivo Anjo <[email protected]>
1 parent 2175887 commit 20e89c7

File tree

4 files changed

+6
-13
lines changed

4 files changed

+6
-13
lines changed

lib/datadog/core/utils/time.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ module Time
1010
# Current monotonic time
1111
#
1212
# @param unit [Symbol] unit for the resulting value, same as ::Process#clock_gettime, defaults to :float_second
13-
# @return [Float] timestamp in the requested unit, since some unspecified starting point
13+
# @return [Float|Integer] timestamp in the requested unit, since some unspecified starting point
1414
def get_time(unit = :float_second)
1515
Process.clock_gettime(Process::CLOCK_MONOTONIC, unit)
1616
end

lib/datadog/di/probe_notification_builder.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@ def build_executed(context)
4646
build_snapshot(context)
4747
end
4848

49-
# Steep: `Integer ** Integer` can also result in Rational (e.g. 10**-2)
50-
# which is why it gives an error if NANOSECONDS is set to 10**9.
5149
NANOSECONDS = 1_000_000_000
5250
MILLISECONDS = 1000
5351

lib/datadog/tracing/span_event.rb

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,8 @@ def to_native_format
6969

7070
private
7171

72-
# Steep: `Integer ** Integer` can also result in Rational (e.g. 10**-2)
73-
# which is why it gives an error if MIN_INT64_SIGNED is set to -2**63.
7472
MIN_INT64_SIGNED = -2 << 62
75-
# DEV: This is incorrect, 2 << 63 - 1 is not the same as 2**63 - 1 (offset by 1).
76-
# The correct formula is `(2 << 62) - 1`. Check if it is a breaking change before fixing it.
77-
MAX_INT64_SIGNED = 2 << 63 - 1
73+
MAX_INT64_SIGNED = (2 << 62) - 1
7874

7975
# Checks the attributes hash to ensure it only contains serializable values.
8076
# Invalid values are removed from the hash.

lib/datadog/tracing/span_operation.rb

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -550,11 +550,10 @@ def duration_marker
550550
# Used for serialization
551551
# @return [Integer] in nanoseconds since Epoch
552552
def start_time_nano
553-
# The only place where start_time_nano is called previously checks if span is stopped,
554-
# which checks if @end_time is not nil, and the only place where @end_time is set is in stop,
555-
# which also sets @start_time if it wasn't already set.
556-
# @type ivar @start_time: ::Time
557-
@start_time.to_i * 1000000000 + @start_time.nsec
553+
return 0 if @start_time.nil?
554+
555+
# Steep: https://github.com/soutaro/steep/issues/477
556+
@start_time.to_i * 1000000000 + @start_time.nsec # steep:ignore NoMethod
558557
end
559558

560559
# Used for serialization

0 commit comments

Comments
 (0)