Module: Sentry::Metrics::Timing

Defined in:
lib/sentry/metrics/timing.rb

Class Method Summary collapse

Class Method Details

.day ⇒ Object



33
34
35
# File 'lib/sentry/metrics/timing.rb', line 33

def day
  Sentry.utc_now.to_i / (3600.0 * 24.0)
end

.duration_end(start) ⇒ Object



45
46
47
# File 'lib/sentry/metrics/timing.rb', line 45

def duration_end(start)
  Process.clock_gettime(Process::CLOCK_MONOTONIC) - start
end

.duration_start ⇒ Object



41
42
43
# File 'lib/sentry/metrics/timing.rb', line 41

def duration_start
  Process.clock_gettime(Process::CLOCK_MONOTONIC)
end

.hour ⇒ Object



29
30
31
# File 'lib/sentry/metrics/timing.rb', line 29

def hour
  Sentry.utc_now.to_i / 3600.0
end

.microsecond ⇒ Object



12
13
14
15
# File 'lib/sentry/metrics/timing.rb', line 12

def microsecond
  time = Sentry.utc_now
  time.to_i * (10 ** 6) + time.usec
end

.millisecond ⇒ Object



17
18
19
# File 'lib/sentry/metrics/timing.rb', line 17

def millisecond
  Sentry.utc_now.to_i * (10 ** 3)
end

.minute ⇒ Object



25
26
27
# File 'lib/sentry/metrics/timing.rb', line 25

def minute
  Sentry.utc_now.to_i / 60.0
end

.nanosecond ⇒ Object



7
8
9
10
# File 'lib/sentry/metrics/timing.rb', line 7

def nanosecond
  time = Sentry.utc_now
  time.to_i * (10 ** 9) + time.nsec
end

.second ⇒ Object



21
22
23
# File 'lib/sentry/metrics/timing.rb', line 21

def second
  Sentry.utc_now.to_i
end

.week ⇒ Object



37
38
39
# File 'lib/sentry/metrics/timing.rb', line 37

def week
  Sentry.utc_now.to_i / (3600.0 * 24.0 * 7.0)
end