uptrace 1.2.1 → 1.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/uptrace/id_generator.rb +5 -11
- data/lib/uptrace/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c94eb656b6d3d4a34ffd82f07b8241283ac0df131a1830dbaab1e267151efe26
|
4
|
+
data.tar.gz: c3992f5a354ee5377578526ffa523373d7623752ad6d61a700a8e8725e6486bc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 29fea8f23477b55985c87e813342e08899f7f1182f535b3d4f868c5eaaf5ae97cdee203b4f5f9fb89c1544bc24861d7dd91ac9fa2c9e53fc215ec234c2cb8d95
|
7
|
+
data.tar.gz: ab741518c70fb6f755c0b7e4ce5805bc8448f3ece174862b8305275cf2b04349555a6abcc0f0bc4acfc72c805c1fe1782e3d2a8e1f068b6eb5f8202dae5eaf01
|
data/lib/uptrace/id_generator.rb
CHANGED
@@ -15,20 +15,14 @@ module Uptrace
|
|
15
15
|
# @return [#bytes]
|
16
16
|
RANDOM = Random.respond_to?(:bytes) ? Random : Random::DEFAULT
|
17
17
|
|
18
|
-
# An invalid trace identifier, a 16-byte string with all zero bytes.
|
19
|
-
INVALID_TRACE_ID = ("\0" * 16).b
|
20
|
-
|
21
|
-
# An invalid span identifier, an 8-byte string with all zero bytes.
|
22
|
-
INVALID_SPAN_ID = ("\0" * 8).b
|
23
|
-
|
24
18
|
# Generates a valid trace identifier, a 16-byte string with at least one
|
25
19
|
# non-zero byte.
|
26
20
|
#
|
27
21
|
# @return [String] a valid trace ID.
|
28
22
|
def generate_trace_id
|
29
|
-
time = (Time.now.to_f *
|
30
|
-
high =
|
31
|
-
low =
|
23
|
+
time = (Time.now.to_f * 1_000_000_000).to_i
|
24
|
+
high = [time >> 32, time & 0xFFFFFFFF].pack('NN')
|
25
|
+
low = RANDOM.bytes(8)
|
32
26
|
high << low
|
33
27
|
end
|
34
28
|
|
@@ -38,8 +32,8 @@ module Uptrace
|
|
38
32
|
# @return [String] a valid span ID.
|
39
33
|
def generate_span_id
|
40
34
|
time = (Time.now.to_f * 1000).to_i
|
41
|
-
high =
|
42
|
-
low =
|
35
|
+
high = [time].pack('N')
|
36
|
+
low = RANDOM.bytes(4)
|
43
37
|
high << low
|
44
38
|
end
|
45
39
|
end
|
data/lib/uptrace/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: uptrace
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Uptrace Authors
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-10
|
11
|
+
date: 2022-11-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: opentelemetry-exporter-otlp
|