traces 0.15.1 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/traces/backend/capture.rb +3 -3
- data/lib/traces/backend/console.rb +4 -4
- data/lib/traces/backend/test.rb +3 -3
- data/lib/traces/backend.rb +8 -2
- data/lib/traces/config.rb +4 -3
- data/lib/traces/context.rb +6 -6
- data/lib/traces/provider.rb +2 -2
- data/lib/traces/version.rb +2 -2
- data/lib/traces.rb +3 -3
- data/license.md +2 -1
- data/readme.md +4 -0
- data/releases.md +4 -0
- data.tar.gz.sig +0 -0
- metadata +5 -4
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ef17a12654c2088ad8f7d60b1b5e3a49c002f4d794257e664f098a8c14e2653a
|
4
|
+
data.tar.gz: 2ce6d1a5267e6414e46b77c8cf18d828f22bd66be8345f1c8dcb9076b653c267
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d8f437430544f04853475e10388bba3abf4a49d298d63b2bac4dad8383c9d150dd14f650ea8e12dbf7c9cadaa0b2084d51221af1656e764efab4b8a3c4d04f95
|
7
|
+
data.tar.gz: d1c683e8d6e6f431d3093f897847c3af35edb1f55b58f5bb9f0c8be04b337b269b5f912f7bf6b92119f5153f928676898f8fb2fae599389e3628e8e1161679bf
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
@@ -1,11 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Released under the MIT License.
|
4
|
-
# Copyright, 2023, by Samuel Williams.
|
4
|
+
# Copyright, 2023-2025, by Samuel Williams.
|
5
5
|
|
6
|
-
require_relative
|
6
|
+
require_relative "../context"
|
7
7
|
|
8
|
-
require
|
8
|
+
require "fiber"
|
9
9
|
|
10
10
|
Fiber.attr_accessor :traces_backend_context
|
11
11
|
|
@@ -1,12 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Released under the MIT License.
|
4
|
-
# Copyright, 2021-
|
4
|
+
# Copyright, 2021-2025, by Samuel Williams.
|
5
5
|
|
6
|
-
require_relative
|
6
|
+
require_relative "../context"
|
7
7
|
|
8
|
-
require
|
9
|
-
require
|
8
|
+
require "console"
|
9
|
+
require "fiber"
|
10
10
|
|
11
11
|
Fiber.attr_accessor :traces_backend_context
|
12
12
|
|
data/lib/traces/backend/test.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Released under the MIT License.
|
4
|
-
# Copyright, 2021-
|
4
|
+
# Copyright, 2021-2025, by Samuel Williams.
|
5
5
|
|
6
|
-
require_relative
|
6
|
+
require_relative "../context"
|
7
7
|
|
8
|
-
require
|
8
|
+
require "fiber"
|
9
9
|
|
10
10
|
Fiber.attr_accessor :traces_backend_context
|
11
11
|
|
data/lib/traces/backend.rb
CHANGED
@@ -1,15 +1,21 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Released under the MIT License.
|
4
|
-
# Copyright, 2021-
|
4
|
+
# Copyright, 2021-2025, by Samuel Williams.
|
5
5
|
|
6
|
-
require_relative
|
6
|
+
require_relative "config"
|
7
7
|
|
8
8
|
module Traces
|
9
9
|
# The backend implementation is responsible for recording and reporting traces.
|
10
10
|
module Backend
|
11
11
|
end
|
12
12
|
|
13
|
+
# This is a default implementation, which can be replaced by the backend.
|
14
|
+
# @returns [Object] The current trace context.
|
15
|
+
def self.trace_context
|
16
|
+
nil
|
17
|
+
end
|
18
|
+
|
13
19
|
# This is a default implementation, which can be replaced by the backend.
|
14
20
|
# @returns [Boolean] Whether there is an active trace.
|
15
21
|
def self.active?
|
data/lib/traces/config.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Released under the MIT License.
|
4
|
-
# Copyright, 2024, by Samuel Williams.
|
4
|
+
# Copyright, 2024-2025, by Samuel Williams.
|
5
5
|
|
6
6
|
module Traces
|
7
7
|
# Represents a configuration for the traces library.
|
@@ -33,10 +33,11 @@ module Traces
|
|
33
33
|
|
34
34
|
# Require a specific traces backend implementation.
|
35
35
|
def require_backend(env = ENV)
|
36
|
-
if backend = env[
|
36
|
+
if backend = env["TRACES_BACKEND"]
|
37
37
|
begin
|
38
38
|
if require(backend)
|
39
|
-
|
39
|
+
# We ensure that the interface methods replace any existing methods by prepending the module:
|
40
|
+
Traces.singleton_class.prepend(Backend::Interface)
|
40
41
|
|
41
42
|
return true
|
42
43
|
end
|
data/lib/traces/context.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Released under the MIT License.
|
4
|
-
# Copyright, 2021-
|
4
|
+
# Copyright, 2021-2025, by Samuel Williams.
|
5
5
|
|
6
|
-
require
|
6
|
+
require "securerandom"
|
7
7
|
|
8
8
|
module Traces
|
9
9
|
# A generic representation of the current tracing context.
|
@@ -12,17 +12,17 @@ module Traces
|
|
12
12
|
# @parameter parent [String] The parent trace context.
|
13
13
|
# @parameter state [Array(String)] Any attached trace state.
|
14
14
|
def self.parse(parent, state = nil, **options)
|
15
|
-
version, trace_id, parent_id, flags = parent.split(
|
15
|
+
version, trace_id, parent_id, flags = parent.split("-")
|
16
16
|
|
17
|
-
if version ==
|
17
|
+
if version == "00"
|
18
18
|
flags = Integer(flags, 16)
|
19
19
|
|
20
20
|
if state.is_a?(String)
|
21
|
-
state = state.split(
|
21
|
+
state = state.split(",")
|
22
22
|
end
|
23
23
|
|
24
24
|
if state
|
25
|
-
state = state.map{|item| item.split(
|
25
|
+
state = state.map{|item| item.split("=")}.to_h
|
26
26
|
end
|
27
27
|
|
28
28
|
self.new(trace_id, parent_id, flags, state, **options)
|
data/lib/traces/provider.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Released under the MIT License.
|
4
|
-
# Copyright, 2021-
|
4
|
+
# Copyright, 2021-2025, by Samuel Williams.
|
5
5
|
|
6
|
-
require_relative
|
6
|
+
require_relative "backend"
|
7
7
|
|
8
8
|
module Traces
|
9
9
|
# @returns [Boolean] Whether there is an active backend.
|
data/lib/traces/version.rb
CHANGED
data/lib/traces.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Released under the MIT License.
|
4
|
-
# Copyright, 2021-
|
4
|
+
# Copyright, 2021-2025, by Samuel Williams.
|
5
5
|
|
6
|
-
require_relative
|
7
|
-
require_relative
|
6
|
+
require_relative "traces/version"
|
7
|
+
require_relative "traces/provider"
|
8
8
|
|
9
9
|
# @namespace
|
10
10
|
module Traces
|
data/license.md
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
# MIT License
|
2
2
|
|
3
|
-
Copyright, 2021-
|
3
|
+
Copyright, 2021-2025, by Samuel Williams.
|
4
4
|
Copyright, 2022, by Felix Yan.
|
5
|
+
Copyright, 2024, by Zach Taylor.
|
5
6
|
|
6
7
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
8
|
of this software and associated documentation files (the "Software"), to deal
|
data/readme.md
CHANGED
@@ -23,6 +23,10 @@ Please see the [project documentation](https://socketry.github.io/traces/) for m
|
|
23
23
|
|
24
24
|
Please see the [project releases](https://socketry.github.io/traces/releases/index) for all releases.
|
25
25
|
|
26
|
+
### v0.16.0
|
27
|
+
|
28
|
+
- Introduce `traces:provider:list` command to list all available trace providers.
|
29
|
+
|
26
30
|
### v0.14.0
|
27
31
|
|
28
32
|
- [Introduce `Traces::Config` to Expose `prepare` Hook](https://socketry.github.io/traces/releases/index#introduce-traces::config-to-expose-prepare-hook)
|
data/releases.md
CHANGED
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: traces
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.16.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
8
8
|
- Felix Yan
|
9
|
+
- Zach Taylor
|
9
10
|
bindir: bin
|
10
11
|
cert_chain:
|
11
12
|
- |
|
@@ -37,7 +38,7 @@ cert_chain:
|
|
37
38
|
Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
|
38
39
|
voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
|
39
40
|
-----END CERTIFICATE-----
|
40
|
-
date:
|
41
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
41
42
|
dependencies: []
|
42
43
|
executables: []
|
43
44
|
extensions: []
|
@@ -68,14 +69,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
68
69
|
requirements:
|
69
70
|
- - ">="
|
70
71
|
- !ruby/object:Gem::Version
|
71
|
-
version: '3.
|
72
|
+
version: '3.2'
|
72
73
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
73
74
|
requirements:
|
74
75
|
- - ">="
|
75
76
|
- !ruby/object:Gem::Version
|
76
77
|
version: '0'
|
77
78
|
requirements: []
|
78
|
-
rubygems_version: 3.6.
|
79
|
+
rubygems_version: 3.6.7
|
79
80
|
specification_version: 4
|
80
81
|
summary: Application instrumentation and tracing.
|
81
82
|
test_files: []
|
metadata.gz.sig
CHANGED
Binary file
|