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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2e98c516863a2d2d3cf5befff7333a5347b9624ac4b4287177dffa93327fca89
4
- data.tar.gz: b1081b536729d1de1a50717b21053816faa4801d7f886db81c23f8a2ca98c2a5
3
+ metadata.gz: 3cc81f964b6c014c38abbdfcf4250fa467ba0c8ef2dfd8077967d851bdd9f567
4
+ data.tar.gz: 5fb6975a0916e18d1603aa03ec78d7639b4e6a37de079e2ed72326a7db8c6ee0
5
5
  SHA512:
6
- metadata.gz: 7eb40d3d6563d1eec0f822a758ac4cbbccbb73dbcbe13e0ddfc992e9b9a39ed8746035fec3e85ab6610278584c3db873a37d9cd87ffbfbb0dd9152f7126c1da4
7
- data.tar.gz: 6eef8ebe76bc77bae7efe13a78a43329ceeb8ae3e1aa44d5e444ebc7d09290f17fa9d31c0b9a6fe12599dda1f33230bea23e718b0ae919ebf955d5e0ff9aaac0
6
+ metadata.gz: ba5ef3bc321a50fd4203a033a023bbfc491071d29a05edb9c9a93cd6a2c53a8a59ec6af2e97cc919d57695193993ecedbf42914b53cbda72a6ab80d9085b763c
7
+ data.tar.gz: e5a44d04828a788321193d00a6c7196fa38c92ce7aaa274636448f50609c3759410d11444360cd42f7d1ee066af020660e706732b2209686dc224da707d6ec33
data/RELEASE.md CHANGED
@@ -1,4 +1,6 @@
1
- ```
1
+ Bump version and then run:
2
+
3
+ ```shell
2
4
  gem build uptrace.gemspec
3
5
  bundle install
4
6
  gem push uptrace-0.2.0.gem
@@ -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 shutdown(timeout: nil)
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
- private
44
-
45
- def setup_tracing
43
+ def span_processor
46
44
  exp = Uptrace::Trace::Exporter.new(@cfg)
47
-
48
- OpenTelemetry::SDK.configure do |c|
49
- bsp = OpenTelemetry::SDK::Trace::Export::BatchSpanProcessor.new(
50
- exp,
51
- max_queue_size: 1000,
52
- max_export_batch_size: 1000,
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, "uptrace: DSN can't be empty" if dsn.empty?
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, %(uptrace: can't parse DSN=#{dsn.inspect}: #{e})
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, %(uptrace: DSN does not have #{k} (DSN=#{dsn.inspect})) if v.nil? || v.empty?
28
+ raise ArgumentError, %(DSN does not have #{k} (DSN=#{dsn.inspect})) if v.nil? || v.empty?
29
29
  end
30
30
  end
31
31
 
@@ -18,10 +18,6 @@ module Uptrace
18
18
  # @return [boolean] disables the exporter.
19
19
  attr_accessor :disabled
20
20
 
21
- def initialize
22
- @dsn = ENV.fetch('UPTRACE_DSN', '')
23
- end
24
-
25
21
  def dsno
26
22
  @dsno ||= DSN.new(@dsn)
27
23
  end
@@ -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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Uptrace
4
- VERSION = '0.2.2'
4
+ VERSION = '0.2.3'
5
5
  end
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.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-02-20 00:00:00.000000000 Z
11
+ date: 2021-03-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: msgpack