uptrace 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/RELEASE.md +3 -1
- data/lib/uptrace/client.rb +11 -20
- data/lib/uptrace/dsn.rb +3 -3
- data/lib/uptrace/trace/config.rb +0 -4
- data/lib/uptrace/trace/exporter.rb +7 -7
- 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: 3cc81f964b6c014c38abbdfcf4250fa467ba0c8ef2dfd8077967d851bdd9f567
|
4
|
+
data.tar.gz: 5fb6975a0916e18d1603aa03ec78d7639b4e6a37de079e2ed72326a7db8c6ee0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ba5ef3bc321a50fd4203a033a023bbfc491071d29a05edb9c9a93cd6a2c53a8a59ec6af2e97cc919d57695193993ecedbf42914b53cbda72a6ab80d9085b763c
|
7
|
+
data.tar.gz: e5a44d04828a788321193d00a6c7196fa38c92ce7aaa274636448f50609c3759410d11444360cd42f7d1ee066af020660e706732b2209686dc224da707d6ec33
|
data/RELEASE.md
CHANGED
data/lib/uptrace/client.rb
CHANGED
@@ -13,20 +13,20 @@ module Uptrace
|
|
13
13
|
@cfg = Uptrace::Trace::Config.new
|
14
14
|
yield @cfg if block_given?
|
15
15
|
|
16
|
+
@cfg.dsn = ENV.fetch('UPTRACE_DSN', '') if @cfg.dsn.nil? || @cfg.dsn.empty?
|
17
|
+
|
16
18
|
begin
|
17
19
|
@cfg.dsno
|
18
20
|
rescue ArgumentError => e
|
19
|
-
Uptrace.logger.error(e.message)
|
21
|
+
Uptrace.logger.error("Uptrace is disabled: #{e.message}")
|
20
22
|
@cfg.disabled = true
|
21
23
|
|
22
24
|
@cfg.dsn = 'https://TOKEN@api.uptrace.dev/PROJECT_ID'
|
23
25
|
end
|
24
|
-
|
25
|
-
setup_tracing unless @cfg.disabled
|
26
26
|
end
|
27
27
|
|
28
28
|
# @param [optional Numeric] timeout An optional timeout in seconds.
|
29
|
-
def
|
29
|
+
def close(timeout: nil)
|
30
30
|
return if @cfg.disabled
|
31
31
|
|
32
32
|
OpenTelemetry.tracer_provider.shutdown(timeout: timeout)
|
@@ -40,23 +40,14 @@ module Uptrace
|
|
40
40
|
"#{dsn.scheme}://#{host}/search/#{dsn.project_id}?q=#{trace_id}"
|
41
41
|
end
|
42
42
|
|
43
|
-
|
44
|
-
|
45
|
-
def setup_tracing
|
43
|
+
def span_processor
|
46
44
|
exp = Uptrace::Trace::Exporter.new(@cfg)
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
schedule_delay: 5_000
|
54
|
-
)
|
55
|
-
c.add_span_processor(bsp)
|
56
|
-
|
57
|
-
c.service_name = @cfg.service_name
|
58
|
-
c.service_version = @cfg.service_version
|
59
|
-
end
|
45
|
+
OpenTelemetry::SDK::Trace::Export::BatchSpanProcessor.new(
|
46
|
+
exp,
|
47
|
+
max_queue_size: 1000,
|
48
|
+
max_export_batch_size: 1000,
|
49
|
+
schedule_delay: 5_000
|
50
|
+
)
|
60
51
|
end
|
61
52
|
end
|
62
53
|
end
|
data/lib/uptrace/dsn.rb
CHANGED
@@ -8,12 +8,12 @@ module Uptrace
|
|
8
8
|
attr_reader :dsn, :port, *KEYS
|
9
9
|
|
10
10
|
def initialize(dsn)
|
11
|
-
raise ArgumentError, "
|
11
|
+
raise ArgumentError, "DSN can't be empty" if dsn.empty?
|
12
12
|
|
13
13
|
begin
|
14
14
|
uri = URI.parse(dsn)
|
15
15
|
rescue URI::InvalidURIError => e
|
16
|
-
raise ArgumentError, %(
|
16
|
+
raise ArgumentError, %(can't parse DSN=#{dsn.inspect}: #{e})
|
17
17
|
end
|
18
18
|
|
19
19
|
@dsn = dsn
|
@@ -25,7 +25,7 @@ module Uptrace
|
|
25
25
|
|
26
26
|
KEYS.each do |k|
|
27
27
|
v = public_send(k)
|
28
|
-
raise ArgumentError, %(
|
28
|
+
raise ArgumentError, %(DSN does not have #{k} (DSN=#{dsn.inspect})) if v.nil? || v.empty?
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
data/lib/uptrace/trace/config.rb
CHANGED
@@ -82,18 +82,18 @@ module Uptrace
|
|
82
82
|
attrs: span.attributes
|
83
83
|
}
|
84
84
|
|
85
|
-
out[parentId] = span.parent_span_id.unpack1('Q') if span.parent_span_id
|
85
|
+
out[:parentId] = span.parent_span_id.unpack1('Q') if span.parent_span_id
|
86
86
|
|
87
|
-
out[events] = uptrace_events(span.events) unless span.events.nil?
|
88
|
-
out[links] = uptrace_links(span.links) unless span.links.nil?
|
87
|
+
out[:events] = uptrace_events(span.events) unless span.events.nil?
|
88
|
+
out[:links] = uptrace_links(span.links) unless span.links.nil?
|
89
89
|
|
90
90
|
status = span.status
|
91
|
-
out[statusCode] = status_code_as_str(status.code)
|
92
|
-
out[statusMessage] = status.description unless status.description.empty?
|
91
|
+
out[:statusCode] = status_code_as_str(status.code)
|
92
|
+
out[:statusMessage] = status.description unless status.description.empty?
|
93
93
|
|
94
94
|
il = span.instrumentation_library
|
95
|
-
out[tracerName] = il.name
|
96
|
-
out[tracerVersion] = il.name unless il.version.empty?
|
95
|
+
out[:tracerName] = il.name
|
96
|
+
out[:tracerVersion] = il.name unless il.version.empty?
|
97
97
|
|
98
98
|
out
|
99
99
|
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: 0.2.
|
4
|
+
version: 0.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: 2021-
|
11
|
+
date: 2021-03-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: msgpack
|