uptrace 1.1.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +7 -7
- data/RELEASE.md +7 -1
- data/lib/uptrace/id_generator.rb +46 -0
- data/lib/uptrace/version.rb +1 -1
- data/lib/uptrace.rb +2 -0
- metadata +7 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7fd9cbd69a42da344856df5d7fd7a7a1ae391e8a831ce045bd8008be07050de6
|
4
|
+
data.tar.gz: 45bfcec0d69d51ff61ec5c00a7d3a9b3b7764614eac0981ccdad34ffc9b6e7ef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c5884bb52fb260f9ef122115d5e399d64db3a5a0c0c37fffe7ec12cd3c521e0de8276cb8e04bc0c8ae1f5d868df5f90e8bd4849d2c733d30d558b0b4c3ddc82c
|
7
|
+
data.tar.gz: '0852731f85c1ac9d7fec78f9ab7dbbd8bf0365080532a54afbc6860d6facaff9dfd717ba202f456bdba56180ae732466ca267e2a6e25b0e9482b61165621081b'
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,17 +1,17 @@
|
|
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://
|
5
|
-
[![Chat](https://img.shields.io/
|
4
|
+
[![Documentation](https://img.shields.io/badge/uptrace-documentation-informational)](https://uptrace.dev/get/uptrace-ruby.html)
|
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://
|
8
|
-
<img src="https://
|
7
|
+
<a href="https://uptrace.dev/get/uptrace-ruby.html">
|
8
|
+
<img src="https://uptrace.dev/get/devicon/ruby-original.svg" height="200px" />
|
9
9
|
</a>
|
10
10
|
|
11
11
|
## Introduction
|
12
12
|
|
13
13
|
uptrace-ruby is an OpenTelemery distribution configured to export
|
14
|
-
[traces](https://
|
14
|
+
[traces](https://uptrace.dev/opentelemetry/distributed-tracing.html) to Uptrace.
|
15
15
|
|
16
16
|
## Quickstart
|
17
17
|
|
@@ -64,5 +64,5 @@ OpenTelemetry.tracer_provider.shutdown
|
|
64
64
|
## Links
|
65
65
|
|
66
66
|
- [Examples](example)
|
67
|
-
- [Documentation](https://
|
68
|
-
- [Instrumentations](https://
|
67
|
+
- [Documentation](https://uptrace.dev/get/uptrace-ruby.html)
|
68
|
+
- [Instrumentations](https://uptrace.dev/opentelemetry/instrumentations/?lang=ruby)
|
data/RELEASE.md
CHANGED
@@ -0,0 +1,46 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Uptrace
|
4
|
+
# Uptrace client that configures OpenTelemetry SDK to use Uptrace exporter.
|
5
|
+
module IdGenerator
|
6
|
+
extend self
|
7
|
+
|
8
|
+
# Random number generator for generating IDs. This is an object that can
|
9
|
+
# respond to `#bytes` and uses the system PRNG. The current logic is
|
10
|
+
# compatible with Ruby 2.5 (which does not implement the `Random.bytes`
|
11
|
+
# class method) and with Ruby 3.0+ (which deprecates `Random::DEFAULT`).
|
12
|
+
# When we drop support for Ruby 2.5, this can simply be replaced with
|
13
|
+
# the class `Random`.
|
14
|
+
#
|
15
|
+
# @return [#bytes]
|
16
|
+
RANDOM = Random.respond_to?(:bytes) ? Random : Random::DEFAULT
|
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
|
+
# Generates a valid trace identifier, a 16-byte string with at least one
|
25
|
+
# non-zero byte.
|
26
|
+
#
|
27
|
+
# @return [String] a valid trace ID.
|
28
|
+
def generate_trace_id
|
29
|
+
time = (Time.now.to_f * 1_000_000).to_i
|
30
|
+
high = RANDOM.bytes(8)
|
31
|
+
low = [time & 0xFFFFFFFF, time >> 32].pack('VV')
|
32
|
+
high << low
|
33
|
+
end
|
34
|
+
|
35
|
+
# Generates a valid span identifier, an 8-byte string with at least one
|
36
|
+
# non-zero byte.
|
37
|
+
#
|
38
|
+
# @return [String] a valid span ID.
|
39
|
+
def generate_span_id
|
40
|
+
time = (Time.now.to_f * 1000).to_i
|
41
|
+
high = RANDOM.bytes(4)
|
42
|
+
low = [time].pack('V')
|
43
|
+
high << low
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
data/lib/uptrace/version.rb
CHANGED
data/lib/uptrace.rb
CHANGED
@@ -34,6 +34,7 @@ module Uptrace
|
|
34
34
|
OpenTelemetry::SDK.configure do |c|
|
35
35
|
@client = Client.new(dsn: dsn) unless dsn.empty?
|
36
36
|
c.add_span_processor(span_processor(@client.dsn)) unless client.disabled?
|
37
|
+
c.id_generator = Uptrace::IdGenerator
|
37
38
|
|
38
39
|
yield c if block_given?
|
39
40
|
end
|
@@ -60,3 +61,4 @@ end
|
|
60
61
|
require 'uptrace/version'
|
61
62
|
require 'uptrace/dsn'
|
62
63
|
require 'uptrace/client'
|
64
|
+
require 'uptrace/id_generator'
|
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.1
|
4
|
+
version: 1.2.1
|
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
|
+
date: 2022-10-28 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.
|
19
|
+
version: 0.24.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.
|
26
|
+
version: 0.24.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.
|
33
|
+
version: 1.2.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.
|
40
|
+
version: 1.2.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -166,6 +166,7 @@ files:
|
|
166
166
|
- lib/uptrace.rb
|
167
167
|
- lib/uptrace/client.rb
|
168
168
|
- lib/uptrace/dsn.rb
|
169
|
+
- lib/uptrace/id_generator.rb
|
169
170
|
- lib/uptrace/version.rb
|
170
171
|
homepage: https://github.com/uptrace/uptrace-ruby
|
171
172
|
licenses:
|