uptrace 1.2.3 → 1.3.0

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: c94eb656b6d3d4a34ffd82f07b8241283ac0df131a1830dbaab1e267151efe26
4
- data.tar.gz: c3992f5a354ee5377578526ffa523373d7623752ad6d61a700a8e8725e6486bc
3
+ metadata.gz: 5f18ccfecc949d79b9c0e06850f440ce7f137dcb4111e2646bd730e9c51107cb
4
+ data.tar.gz: e1456ae29aa3fc8581e142ef858562033a6fc27e154718af9aeb49c2045385df
5
5
  SHA512:
6
- metadata.gz: 29fea8f23477b55985c87e813342e08899f7f1182f535b3d4f868c5eaaf5ae97cdee203b4f5f9fb89c1544bc24861d7dd91ac9fa2c9e53fc215ec234c2cb8d95
7
- data.tar.gz: ab741518c70fb6f755c0b7e4ce5805bc8448f3ece174862b8305275cf2b04349555a6abcc0f0bc4acfc72c805c1fe1782e3d2a8e1f068b6eb5f8202dae5eaf01
6
+ metadata.gz: 90942bebaa75ea64f57609c70f4be2c50a4dd8e0809f9b059e7c9d8d25ba0aeb6c31c29ad731e878fbe9df208dcce2998d2fe2e6ad6abfb1731dedcbca2cfb69
7
+ data.tar.gz: fd117c9046126740d7181b378752e2f1cfc169599a4df073c5c0c6f0e9ff842fb32b70ed89fa1c1a7dc726ed7cd6a7d863e6894d2075d108bfaa66aae4af16fc
data/README.md CHANGED
@@ -1,10 +1,10 @@
1
1
  # Uptrace Ruby exporter for OpenTelemetry
2
2
 
3
3
  ![build workflow](https://github.com/uptrace/uptrace-ruby/actions/workflows/build.yml/badge.svg)
4
- [![Documentation](https://img.shields.io/badge/uptrace-documentation-informational)](https://uptrace.dev/get/uptrace-ruby.html)
4
+ [![Documentation](https://img.shields.io/badge/uptrace-documentation-informational)](https://uptrace.dev/get/opentelemetry-ruby.html)
5
5
  [![Chat](https://img.shields.io/badge/-telegram-red?color=white&logo=telegram&logoColor=black)](https://t.me/uptrace)
6
6
 
7
- <a href="https://uptrace.dev/get/uptrace-ruby.html">
7
+ <a href="https://uptrace.dev/get/opentelemetry-ruby.html">
8
8
  <img src="https://uptrace.dev/get/devicon/ruby-original.svg" height="200px" />
9
9
  </a>
10
10
 
@@ -37,21 +37,28 @@ Uptrace.configure_opentelemetry(dsn: '') do |c|
37
37
  # c is OpenTelemetry::SDK::Configurator
38
38
  c.service_name = 'myservice'
39
39
  c.service_version = '1.0.0'
40
+
41
+ c.resource = OpenTelemetry::SDK::Resources::Resource.create(
42
+ 'deployment.environment' => 'production'
43
+ )
40
44
  end
41
45
 
42
46
  # Create a tracer. Usually, tracer is a global variable.
43
47
  tracer = OpenTelemetry.tracer_provider.tracer('my_app_or_gem', '0.1.0')
44
48
 
45
49
  # Create a root span (a trace) to measure some operation.
46
- tracer.in_span('main-operation') do |main|
47
- tracer.in_span('child1-of-main') do |child1|
48
- child1.set_attribute('key1', 'value1')
50
+ tracer.in_span('main-operation', kind: :client) do |main|
51
+ tracer.in_span('GET /posts/:id') do |child1|
52
+ child1.set_attribute('http.method', 'GET')
53
+ child1.set_attribute('http.route', '/posts/:id')
54
+ child1.set_attribute('http.url', 'http://localhost:8080/posts/123')
55
+ child1.set_attribute('http.status_code', 200)
49
56
  child1.record_exception(ArgumentError.new('error1'))
50
57
  end
51
58
 
52
- tracer.in_span('child2-of-main') do |child2|
53
- child2.set_attribute('key2', '24')
54
- child2.set_attribute('key3', 123.456)
59
+ tracer.in_span('SELECT') do |child2|
60
+ child2.set_attribute('db.system', 'mysql')
61
+ child2.set_attribute('db.statement', 'SELECT * FROM posts LIMIT 100')
55
62
  end
56
63
 
57
64
  puts("trace URL: #{Uptrace.trace_url(main)}")
@@ -64,5 +71,7 @@ OpenTelemetry.tracer_provider.shutdown
64
71
  ## Links
65
72
 
66
73
  - [Examples](example)
67
- - [Documentation](https://uptrace.dev/get/uptrace-ruby.html)
68
- - [Instrumentations](https://uptrace.dev/opentelemetry/instrumentations/?lang=ruby)
74
+ - [Documentation](https://uptrace.dev/get/opentelemetry-ruby.html)
75
+ - [OpenTelemetry Instrumentations](https://uptrace.dev/opentelemetry/instrumentations/?lang=ruby)
76
+ - [OpenTelemetry Rails](https://uptrace.dev/opentelemetry/instrumentations/ruby-rails.html)
77
+ - [OpenTelemetry Sinatra](https://uptrace.dev/opentelemetry/instrumentations/ruby-sinatra.html)
data/lib/uptrace/dsn.rb CHANGED
@@ -28,11 +28,6 @@ module Uptrace
28
28
 
29
29
  @host = 'uptrace.dev' if @host == 'api.uptrace.dev'
30
30
  return if @host != 'uptrace.dev'
31
-
32
- %w[project_id token].each do |k|
33
- v = public_send(k)
34
- raise ArgumentError, %(DSN=#{dsn.inspect} does not have a #{k}) if v.nil? || v.empty?
35
- end
36
31
  end
37
32
 
38
33
  def to_s
@@ -5,6 +5,9 @@ module Uptrace
5
5
  module IdGenerator
6
6
  extend self
7
7
 
8
+ # An invalid span identifier, an 8-byte string with all zero bytes.
9
+ INVALID_SPAN_ID = ("\0" * 8).b
10
+
8
11
  # Random number generator for generating IDs. This is an object that can
9
12
  # respond to `#bytes` and uses the system PRNG. The current logic is
10
13
  # compatible with Ruby 2.5 (which does not implement the `Random.bytes`
@@ -31,10 +34,10 @@ module Uptrace
31
34
  #
32
35
  # @return [String] a valid span ID.
33
36
  def generate_span_id
34
- time = (Time.now.to_f * 1000).to_i
35
- high = [time].pack('N')
36
- low = RANDOM.bytes(4)
37
- high << low
37
+ loop do
38
+ id = Random.bytes(8)
39
+ return id unless id == INVALID_SPAN_ID
40
+ end
38
41
  end
39
42
  end
40
43
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Uptrace
4
- VERSION = '1.2.3'
4
+ VERSION = '1.3.0'
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: 1.2.3
4
+ version: 1.3.0
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-11-10 00:00:00.000000000 Z
11
+ date: 2023-06-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: opentelemetry-exporter-otlp
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.24.0
19
+ version: 0.26.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 0.24.0
26
+ version: 0.26.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: opentelemetry-sdk
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 1.2.0
33
+ version: 1.3.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 1.2.0
40
+ version: 1.3.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -181,14 +181,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
181
181
  requirements:
182
182
  - - ">="
183
183
  - !ruby/object:Gem::Version
184
- version: 2.5.0
184
+ version: '3.0'
185
185
  required_rubygems_version: !ruby/object:Gem::Requirement
186
186
  requirements:
187
187
  - - ">="
188
188
  - !ruby/object:Gem::Version
189
189
  version: '0'
190
190
  requirements: []
191
- rubygems_version: 3.1.4
191
+ rubygems_version: 3.4.10
192
192
  signing_key:
193
193
  specification_version: 4
194
194
  summary: Uptrace Ruby exporter for OpenTelemetry