traces-backend-open_telemetry 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/traces/backend/open_telemetry/interface.rb +17 -44
- data/lib/traces/backend/open_telemetry/version.rb +3 -20
- data/lib/traces/backend/open_telemetry.rb +3 -21
- data/license.md +21 -0
- data/readme.md +35 -0
- data.tar.gz.sig +0 -0
- metadata +38 -48
- metadata.gz.sig +2 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0a6e7b852d0e639afb7711bb341ff286b03c6551f93c7bad739d925e970bdf0b
|
4
|
+
data.tar.gz: 66e01999506279ab1934878f9728c54d71f0fa1bb2b79b9ae14043c6eaac85f7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d6ff7a3fd2e174c1ed038dae1c1bbb7cc76cfd9e1c61d46b3a3ec9f4d6c3b43266b6249e95fecd27b71c46799ddaa84e880f0f862f74f0d0a0a794f5310cedc3
|
7
|
+
data.tar.gz: ea506e7dc7d917947c0fbfdeb9e287a5b8abaa6d1b8b69668dbbb21234604214aed7ad6772311fdde90e9e9a25fa68612c879002b0f86a51893fb1c59c549da0
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
@@ -1,29 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
#
|
4
|
-
#
|
5
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
# of this software and associated documentation files (the "Software"), to deal
|
7
|
-
# in the Software without restriction, including without limitation the rights
|
8
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
# copies of the Software, and to permit persons to whom the Software is
|
10
|
-
# furnished to do so, subject to the following conditions:
|
11
|
-
#
|
12
|
-
# The above copyright notice and this permission notice shall be included in
|
13
|
-
# all copies or substantial portions of the Software.
|
14
|
-
#
|
15
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
-
# THE SOFTWARE.
|
3
|
+
# Released under the MIT License.
|
4
|
+
# Copyright, 2021-2025, by Samuel Williams.
|
22
5
|
|
23
|
-
require
|
6
|
+
require "opentelemetry"
|
24
7
|
|
25
|
-
require
|
26
|
-
require_relative
|
8
|
+
require "traces/context"
|
9
|
+
require_relative "version"
|
27
10
|
|
28
11
|
module Traces
|
29
12
|
module Backend
|
@@ -34,45 +17,35 @@ module Traces
|
|
34
17
|
|
35
18
|
module Interface
|
36
19
|
def trace(name, attributes: nil, &block)
|
37
|
-
|
38
|
-
|
39
|
-
begin
|
40
|
-
if block.arity.zero?
|
41
|
-
yield
|
42
|
-
else
|
43
|
-
yield span
|
44
|
-
end
|
45
|
-
rescue Exception => error
|
46
|
-
span&.record_exception(error)
|
47
|
-
span&.status = ::OpenTelemetry::Traces::Status.error("Unhandled exception of type: #{error.class}")
|
48
|
-
raise
|
49
|
-
ensure
|
50
|
-
span&.finish
|
51
|
-
end
|
20
|
+
TRACER.in_span(name, attributes: attributes&.transform_keys(&:to_s), &block)
|
52
21
|
end
|
53
22
|
|
54
23
|
def trace_context=(context)
|
55
|
-
span_context = ::OpenTelemetry::
|
24
|
+
span_context = ::OpenTelemetry::Trace::SpanContext.new(
|
56
25
|
trace_id: context.trace_id,
|
57
26
|
span_id: context.parent_id,
|
58
|
-
trace_flags: ::OpenTelemetry::
|
27
|
+
trace_flags: ::OpenTelemetry::Trace::TraceFlags.from_byte(context.flags),
|
59
28
|
tracestate: context.state,
|
60
29
|
remote: context.remote?
|
61
30
|
)
|
62
31
|
|
63
32
|
span = ::OpenTelemetry::Trace.non_recording_span(span_context)
|
64
|
-
|
65
|
-
|
33
|
+
context = ::OpenTelemetry::Trace.context_with_span(span)
|
34
|
+
::OpenTelemetry::Context.attach(context)
|
66
35
|
end
|
67
36
|
|
68
37
|
def trace_context(span = ::OpenTelemetry::Trace.current_span)
|
69
38
|
if span_context = span.context
|
70
|
-
|
39
|
+
flags = 0
|
40
|
+
|
41
|
+
if span_context.trace_flags.sampled?
|
42
|
+
flags |= Context::SAMPLED
|
43
|
+
end
|
71
44
|
|
72
45
|
return Context.new(
|
73
46
|
span_context.trace_id,
|
74
47
|
span_context.span_id,
|
75
|
-
|
48
|
+
flags,
|
76
49
|
span_context.tracestate,
|
77
50
|
remote: span_context.remote?
|
78
51
|
)
|
@@ -83,4 +56,4 @@ module Traces
|
|
83
56
|
|
84
57
|
Interface = OpenTelemetry::Interface
|
85
58
|
end
|
86
|
-
end
|
59
|
+
end
|
@@ -1,29 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
#
|
4
|
-
#
|
5
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
# of this software and associated documentation files (the "Software"), to deal
|
7
|
-
# in the Software without restriction, including without limitation the rights
|
8
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
# copies of the Software, and to permit persons to whom the Software is
|
10
|
-
# furnished to do so, subject to the following conditions:
|
11
|
-
#
|
12
|
-
# The above copyright notice and this permission notice shall be included in
|
13
|
-
# all copies or substantial portions of the Software.
|
14
|
-
#
|
15
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
-
# THE SOFTWARE.
|
3
|
+
# Released under the MIT License.
|
4
|
+
# Copyright, 2021-2025, by Samuel Williams.
|
22
5
|
|
23
6
|
module Traces
|
24
7
|
module Backend
|
25
8
|
module OpenTelemetry
|
26
|
-
VERSION = "0.
|
9
|
+
VERSION = "0.2.0"
|
27
10
|
end
|
28
11
|
end
|
29
12
|
end
|
@@ -1,24 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
#
|
4
|
-
#
|
5
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
# of this software and associated documentation files (the "Software"), to deal
|
7
|
-
# in the Software without restriction, including without limitation the rights
|
8
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
# copies of the Software, and to permit persons to whom the Software is
|
10
|
-
# furnished to do so, subject to the following conditions:
|
11
|
-
#
|
12
|
-
# The above copyright notice and this permission notice shall be included in
|
13
|
-
# all copies or substantial portions of the Software.
|
14
|
-
#
|
15
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
-
# THE SOFTWARE.
|
3
|
+
# Released under the MIT License.
|
4
|
+
# Copyright, 2021-2025, by Samuel Williams.
|
22
5
|
|
23
|
-
|
24
|
-
require_relative 'open_telemetry/interface'
|
6
|
+
require_relative "open_telemetry/interface"
|
data/license.md
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# MIT License
|
2
|
+
|
3
|
+
Copyright, 2021-2025, by Samuel Williams.
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/readme.md
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# Traces::Backend::OpenTelemetry
|
2
|
+
|
3
|
+
A backend for sending traces to OpenTelemetry.
|
4
|
+
|
5
|
+
[![Development Status](https://github.com/socketry/traces-backend-open_telemetry/workflows/Test/badge.svg)](https://github.com/socketry/traces-backend-open_telemetry/actions?workflow=Test)
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
``` shell
|
10
|
+
$ bundle add traces-backend-open_telemetry
|
11
|
+
```
|
12
|
+
|
13
|
+
## Usage
|
14
|
+
|
15
|
+
``` shell
|
16
|
+
$ TRACES_BACKEND=traces/backend/open_telemetry ./my_script.rb
|
17
|
+
```
|
18
|
+
|
19
|
+
## Contributing
|
20
|
+
|
21
|
+
We welcome contributions to this project.
|
22
|
+
|
23
|
+
1. Fork it.
|
24
|
+
2. Create your feature branch (`git checkout -b my-new-feature`).
|
25
|
+
3. Commit your changes (`git commit -am 'Add some feature'`).
|
26
|
+
4. Push to the branch (`git push origin my-new-feature`).
|
27
|
+
5. Create new Pull Request.
|
28
|
+
|
29
|
+
### Developer Certificate of Origin
|
30
|
+
|
31
|
+
In order to protect users of this project, we require all contributors to comply with the [Developer Certificate of Origin](https://developercertificate.org/). This ensures that all contributions are properly licensed and attributed.
|
32
|
+
|
33
|
+
### Community Guidelines
|
34
|
+
|
35
|
+
This project is best served by a collaborative and respectful environment. Treat each other professionally, respect differing viewpoints, and engage constructively. Harassment, discrimination, or harmful behavior is not tolerated. Communicate clearly, listen actively, and support one another. If any issues arise, please inform the project maintainers.
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: traces-backend-open_telemetry
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
@@ -10,48 +10,35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eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
|
38
39
|
-----END CERTIFICATE-----
|
39
|
-
date:
|
40
|
+
date: 2025-01-11 00:00:00.000000000 Z
|
40
41
|
dependencies:
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: traces
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - "~>"
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: 0.4.0
|
48
|
-
type: :runtime
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - "~>"
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: 0.4.0
|
55
42
|
- !ruby/object:Gem::Dependency
|
56
43
|
name: opentelemetry-api
|
57
44
|
requirement: !ruby/object:Gem::Requirement
|
@@ -67,19 +54,19 @@ dependencies:
|
|
67
54
|
- !ruby/object:Gem::Version
|
68
55
|
version: '1.0'
|
69
56
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
57
|
+
name: traces
|
71
58
|
requirement: !ruby/object:Gem::Requirement
|
72
59
|
requirements:
|
73
60
|
- - "~>"
|
74
61
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
76
|
-
type: :
|
62
|
+
version: '0.10'
|
63
|
+
type: :runtime
|
77
64
|
prerelease: false
|
78
65
|
version_requirements: !ruby/object:Gem::Requirement
|
79
66
|
requirements:
|
80
67
|
- - "~>"
|
81
68
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
69
|
+
version: '0.10'
|
83
70
|
description:
|
84
71
|
email:
|
85
72
|
executables: []
|
@@ -89,10 +76,13 @@ files:
|
|
89
76
|
- lib/traces/backend/open_telemetry.rb
|
90
77
|
- lib/traces/backend/open_telemetry/interface.rb
|
91
78
|
- lib/traces/backend/open_telemetry/version.rb
|
79
|
+
- license.md
|
80
|
+
- readme.md
|
92
81
|
homepage: https://github.com/socketry/traces-backend-open_telemetry
|
93
82
|
licenses:
|
94
83
|
- MIT
|
95
|
-
metadata:
|
84
|
+
metadata:
|
85
|
+
source_code_uri: https://github.com/socketry/traces-backend-open_telemetry.git
|
96
86
|
post_install_message:
|
97
87
|
rdoc_options: []
|
98
88
|
require_paths:
|
@@ -101,14 +91,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
101
91
|
requirements:
|
102
92
|
- - ">="
|
103
93
|
- !ruby/object:Gem::Version
|
104
|
-
version: '
|
94
|
+
version: '3.1'
|
105
95
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
106
96
|
requirements:
|
107
97
|
- - ">="
|
108
98
|
- !ruby/object:Gem::Version
|
109
99
|
version: '0'
|
110
100
|
requirements: []
|
111
|
-
rubygems_version: 3.
|
101
|
+
rubygems_version: 3.5.22
|
112
102
|
signing_key:
|
113
103
|
specification_version: 4
|
114
104
|
summary: A traces backend for Open Telemetry.
|
metadata.gz.sig
CHANGED
@@ -1,3 +1,2 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
�r[��`�rV$�J����VJzB����
|
1
|
+
��Y�yM�����t=�ܹJ)���rS��������L�b2�z�����-�����;k�jJ�|\T�D�zM=�j��]��tX5m�x�Q����O[kɾ��~���ɕ�����syH��(�m��B.\O��8!�'�&4
|
2
|
+
��J�!�/��V�͆�(g'ħ��"S{�F��5������m��o[C��x� #qN�x��H���9y\��:��ZG��k���T���Y�1vzm7&&|f.D�V#�01h�����SC�Q������|���]z�J\�[�i�qM^�v5/��eβ�9��r���ˈy��xp�q2�|�8���Q+��l!6+�g��N�x8B1R����Wdâ��f�LSr��UJq��
|