sentry-opentelemetry 5.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/.rspec +3 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +24 -0
- data/LICENSE.txt +21 -0
- data/Makefile +3 -0
- data/README.md +65 -0
- data/Rakefile +8 -0
- data/bin/console +15 -0
- data/bin/setup +8 -0
- data/lib/sentry/opentelemetry/propagator.rb +75 -0
- data/lib/sentry/opentelemetry/span_processor.rb +157 -0
- data/lib/sentry/opentelemetry/version.rb +7 -0
- data/lib/sentry-opentelemetry.rb +8 -0
- data/sentry-opentelemetry.gemspec +29 -0
- metadata +90 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 9aaffd9cda5f20379323be1ae47da2e64bc2ec9c1b27d514982925391c9b38c8
|
4
|
+
data.tar.gz: 7e4c3b121b94781318c914ee60f107bd371084edf77e438c14eab736278d02b3
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: eda20f66ce75fd0e1457338d6bde1790f473b201801f93e4a81f998c9391c2f3d1a1e55f5702cc079914c05bd0ef613a95f917deea0bf5c8257c2bdbd5707edc
|
7
|
+
data.tar.gz: e8c7c44bcf9efac91692055bd9376cbe5f6ec36e8000f97f96bc32b08fe0a233caa5665e4ea0fd19d357ca9ece6ab177abc763a87284cf03d31de277dc154296
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at stan001212@gmail.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [https://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: https://contributor-covenant.org
|
74
|
+
[version]: https://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
source "https://rubygems.org"
|
2
|
+
git_source(:github) { |name| "https://github.com/#{name}.git" }
|
3
|
+
|
4
|
+
# Specify your gem's dependencies in sentry-ruby.gemspec
|
5
|
+
gemspec
|
6
|
+
|
7
|
+
gem "rake", "~> 12.0"
|
8
|
+
gem "rspec", "~> 3.0"
|
9
|
+
gem 'simplecov'
|
10
|
+
gem "simplecov-cobertura", "~> 1.4"
|
11
|
+
gem "rexml"
|
12
|
+
|
13
|
+
# opentelemetry_version = ENV["OPENTELEMETRY_VERSION"]
|
14
|
+
# opentelemetry_version = "1.2.0" if opentelemetry_version.nil?
|
15
|
+
# gem "opentelemetry-sdk", "~> #{opentelemetry_version}"
|
16
|
+
|
17
|
+
gem "opentelemetry-sdk"
|
18
|
+
gem "opentelemetry-instrumentation-rails"
|
19
|
+
|
20
|
+
gem "sentry-ruby", path: "../sentry-ruby"
|
21
|
+
|
22
|
+
gem "object_tracer"
|
23
|
+
gem "debug", github: "ruby/debug", platform: :ruby if RUBY_VERSION.to_f >= 2.6
|
24
|
+
gem "pry"
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2020 Sentry
|
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.
|
data/Makefile
ADDED
data/README.md
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
<p align="center">
|
2
|
+
<a href="https://sentry.io" target="_blank" align="center">
|
3
|
+
<img src="https://sentry-brand.storage.googleapis.com/sentry-logo-black.png" width="280">
|
4
|
+
</a>
|
5
|
+
<br>
|
6
|
+
</p>
|
7
|
+
|
8
|
+
# sentry-opentelemetry, the OpenTelemetry integration for Sentry's Ruby client
|
9
|
+
|
10
|
+
---
|
11
|
+
|
12
|
+
|
13
|
+
[![Gem Version](https://img.shields.io/gem/v/sentry-opentelemetry.svg)](https://rubygems.org/gems/sentry-opentelemetry)
|
14
|
+
![Build Status](https://github.com/getsentry/sentry-ruby/workflows/sentry-opentelemetry%20Test/badge.svg)
|
15
|
+
[![Coverage Status](https://img.shields.io/codecov/c/github/getsentry/sentry-ruby/master?logo=codecov)](https://codecov.io/gh/getsentry/sentry-ruby/branch/master)
|
16
|
+
[![Gem](https://img.shields.io/gem/dt/sentry-opentelemetry.svg)](https://rubygems.org/gems/sentry-opentelemetry/)
|
17
|
+
[![SemVer](https://api.dependabot.com/badges/compatibility_score?dependency-name=sentry-opentelemetry&package-manager=bundler&version-scheme=semver)](https://dependabot.com/compatibility-score.html?dependency-name=sentry-opentelemetry&package-manager=bundler&version-scheme=semver)
|
18
|
+
|
19
|
+
|
20
|
+
[Documentation](https://docs.sentry.io/platforms/ruby/guides/opentelemetry/) | [Bug Tracker](https://github.com/getsentry/sentry-ruby/issues) | [Forum](https://forum.sentry.io/) | IRC: irc.freenode.net, #sentry
|
21
|
+
|
22
|
+
The official Ruby-language client and integration layer for the [Sentry](https://github.com/getsentry/sentry) error reporting API.
|
23
|
+
|
24
|
+
|
25
|
+
## Getting Started
|
26
|
+
|
27
|
+
### Install
|
28
|
+
|
29
|
+
```ruby
|
30
|
+
gem "sentry-ruby"
|
31
|
+
gem "sentry-rails"
|
32
|
+
gem "sentry-opentelemetry"
|
33
|
+
|
34
|
+
gem "opentelemetry-sdk"
|
35
|
+
gem "opentelemetry-instrumentation-all"
|
36
|
+
```
|
37
|
+
|
38
|
+
### Configuration
|
39
|
+
|
40
|
+
Initialize Sentry for tracing and set the `instrumenter` to `:otel`.
|
41
|
+
```ruby
|
42
|
+
# config/initializers/sentry.rb
|
43
|
+
|
44
|
+
Sentry.init do |config|
|
45
|
+
config.dsn = "MY_DSN"
|
46
|
+
config.traces_sample_rate = 1.0
|
47
|
+
config.instrumenter = :otel
|
48
|
+
end
|
49
|
+
```
|
50
|
+
|
51
|
+
This will disable all Sentry instrumentation and rely on the chosen OpenTelemetry tracers for creating spans.
|
52
|
+
|
53
|
+
Next, configure OpenTelemetry as per your needs and hook in the Sentry span processor and propagator.
|
54
|
+
|
55
|
+
```ruby
|
56
|
+
# config/initializers/otel.rb
|
57
|
+
|
58
|
+
OpenTelemetry::SDK.configure do |c|
|
59
|
+
c.use_all
|
60
|
+
c.add_span_processor(Sentry::OpenTelemetry::SpanProcessor.instance)
|
61
|
+
end
|
62
|
+
|
63
|
+
OpenTelemetry.propagation = Sentry::OpenTelemetry::Propagator.new
|
64
|
+
```
|
65
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require "bundler/setup"
|
5
|
+
require "sentry/opentelemetry"
|
6
|
+
|
7
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
8
|
+
# with your gem easier. You can also use a different console, if you like.
|
9
|
+
|
10
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
11
|
+
# require "pry"
|
12
|
+
# Pry.start
|
13
|
+
|
14
|
+
require "irb"
|
15
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Sentry
|
4
|
+
module OpenTelemetry
|
5
|
+
class Propagator
|
6
|
+
|
7
|
+
FIELDS = [SENTRY_TRACE_HEADER_NAME, BAGGAGE_HEADER_NAME].freeze
|
8
|
+
|
9
|
+
SENTRY_TRACE_KEY = ::OpenTelemetry::Context.create_key('sentry-trace')
|
10
|
+
SENTRY_BAGGAGE_KEY = ::OpenTelemetry::Context.create_key('sentry-baggage')
|
11
|
+
|
12
|
+
def inject(
|
13
|
+
carrier,
|
14
|
+
context: ::OpenTelemetry::Context.current,
|
15
|
+
setter: ::OpenTelemetry::Context::Propagation.text_map_setter
|
16
|
+
)
|
17
|
+
span_context = ::OpenTelemetry::Trace.current_span(context).context
|
18
|
+
return unless span_context.valid?
|
19
|
+
|
20
|
+
span_map = SpanProcessor.instance.span_map
|
21
|
+
sentry_span = span_map[span_context.hex_span_id]
|
22
|
+
return unless sentry_span
|
23
|
+
|
24
|
+
setter.set(carrier, SENTRY_TRACE_HEADER_NAME, sentry_span.to_sentry_trace)
|
25
|
+
|
26
|
+
baggage = sentry_span.to_baggage
|
27
|
+
setter.set(carrier, BAGGAGE_HEADER_NAME, baggage) if baggage && !baggage.empty?
|
28
|
+
end
|
29
|
+
|
30
|
+
def extract(
|
31
|
+
carrier,
|
32
|
+
context: ::OpenTelemetry::Context.current,
|
33
|
+
getter: ::OpenTelemetry::Context::Propagation.text_map_getter
|
34
|
+
)
|
35
|
+
sentry_trace = getter.get(carrier, SENTRY_TRACE_HEADER_NAME)
|
36
|
+
return context unless sentry_trace
|
37
|
+
|
38
|
+
sentry_trace_data = Transaction.extract_sentry_trace(sentry_trace)
|
39
|
+
return context unless sentry_trace_data
|
40
|
+
|
41
|
+
context = context.set_value(SENTRY_TRACE_KEY, sentry_trace_data)
|
42
|
+
trace_id, span_id, _parent_sampled = sentry_trace_data
|
43
|
+
|
44
|
+
span_context = ::OpenTelemetry::Trace::SpanContext.new(
|
45
|
+
trace_id: [trace_id].pack('H*'),
|
46
|
+
span_id: [span_id].pack('H*'),
|
47
|
+
# we simulate a sampled trace on the otel side and leave the sampling to sentry
|
48
|
+
trace_flags: ::OpenTelemetry::Trace::TraceFlags::SAMPLED,
|
49
|
+
remote: true
|
50
|
+
)
|
51
|
+
|
52
|
+
baggage_header = getter.get(carrier, BAGGAGE_HEADER_NAME)
|
53
|
+
|
54
|
+
baggage = if baggage_header && !baggage_header.empty?
|
55
|
+
Baggage.from_incoming_header(baggage_header)
|
56
|
+
else
|
57
|
+
# If there's an incoming sentry-trace but no incoming baggage header,
|
58
|
+
# for instance in traces coming from older SDKs,
|
59
|
+
# baggage will be empty and frozen and won't be populated as head SDK.
|
60
|
+
Baggage.new({})
|
61
|
+
end
|
62
|
+
|
63
|
+
baggage.freeze!
|
64
|
+
context = context.set_value(SENTRY_BAGGAGE_KEY, baggage)
|
65
|
+
|
66
|
+
span = ::OpenTelemetry::Trace.non_recording_span(span_context)
|
67
|
+
::OpenTelemetry::Trace.context_with_span(span, parent_context: context)
|
68
|
+
end
|
69
|
+
|
70
|
+
def fields
|
71
|
+
FIELDS
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
@@ -0,0 +1,157 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'singleton'
|
4
|
+
|
5
|
+
module Sentry
|
6
|
+
module OpenTelemetry
|
7
|
+
TraceData = Struct.new(:trace_id, :span_id, :parent_span_id, :parent_sampled, :baggage)
|
8
|
+
|
9
|
+
class SpanProcessor < ::OpenTelemetry::SDK::Trace::SpanProcessor
|
10
|
+
include Singleton
|
11
|
+
|
12
|
+
SEMANTIC_CONVENTIONS = ::OpenTelemetry::SemanticConventions::Trace
|
13
|
+
INTERNAL_SPAN_KINDS = %i(client internal)
|
14
|
+
|
15
|
+
# The mapping from otel span ids to sentry spans
|
16
|
+
# @return [Hash]
|
17
|
+
attr_reader :span_map
|
18
|
+
|
19
|
+
def initialize
|
20
|
+
@span_map = {}
|
21
|
+
end
|
22
|
+
|
23
|
+
def on_start(otel_span, parent_context)
|
24
|
+
return unless Sentry.initialized? && Sentry.configuration.instrumenter == :otel
|
25
|
+
return unless otel_span.context.valid?
|
26
|
+
return if from_sentry_sdk?(otel_span)
|
27
|
+
|
28
|
+
trace_data = get_trace_data(otel_span, parent_context)
|
29
|
+
|
30
|
+
sentry_parent_span = @span_map[trace_data.parent_span_id] if trace_data.parent_span_id
|
31
|
+
|
32
|
+
sentry_span = if sentry_parent_span
|
33
|
+
sentry_parent_span.start_child(
|
34
|
+
span_id: trace_data.span_id,
|
35
|
+
description: otel_span.name,
|
36
|
+
start_timestamp: otel_span.start_timestamp / 1e9
|
37
|
+
)
|
38
|
+
else
|
39
|
+
options = {
|
40
|
+
instrumenter: :otel,
|
41
|
+
name: otel_span.name,
|
42
|
+
span_id: trace_data.span_id,
|
43
|
+
trace_id: trace_data.trace_id,
|
44
|
+
parent_span_id: trace_data.parent_span_id,
|
45
|
+
parent_sampled: trace_data.parent_sampled,
|
46
|
+
baggage: trace_data.baggage,
|
47
|
+
start_timestamp: otel_span.start_timestamp / 1e9
|
48
|
+
}
|
49
|
+
|
50
|
+
Sentry.start_transaction(**options)
|
51
|
+
end
|
52
|
+
|
53
|
+
@span_map[trace_data.span_id] = sentry_span
|
54
|
+
end
|
55
|
+
|
56
|
+
def on_finish(otel_span)
|
57
|
+
return unless Sentry.initialized? && Sentry.configuration.instrumenter == :otel
|
58
|
+
return unless otel_span.context.valid?
|
59
|
+
|
60
|
+
sentry_span = @span_map.delete(otel_span.context.hex_span_id)
|
61
|
+
return unless sentry_span
|
62
|
+
|
63
|
+
sentry_span.set_op(otel_span.name)
|
64
|
+
|
65
|
+
if sentry_span.is_a?(Sentry::Transaction)
|
66
|
+
sentry_span.set_name(otel_span.name)
|
67
|
+
sentry_span.set_context(:otel, otel_context_hash(otel_span))
|
68
|
+
else
|
69
|
+
update_span_with_otel_data(sentry_span, otel_span)
|
70
|
+
end
|
71
|
+
|
72
|
+
sentry_span.finish(end_timestamp: otel_span.end_timestamp / 1e9)
|
73
|
+
end
|
74
|
+
|
75
|
+
def clear
|
76
|
+
@span_map = {}
|
77
|
+
end
|
78
|
+
|
79
|
+
private
|
80
|
+
|
81
|
+
def from_sentry_sdk?(otel_span)
|
82
|
+
dsn = Sentry.configuration.dsn
|
83
|
+
return false unless dsn
|
84
|
+
|
85
|
+
if otel_span.name.start_with?("HTTP")
|
86
|
+
# only check client requests, connects are sometimes internal
|
87
|
+
return false unless INTERNAL_SPAN_KINDS.include?(otel_span.kind)
|
88
|
+
|
89
|
+
address = otel_span.attributes[SEMANTIC_CONVENTIONS::NET_PEER_NAME]
|
90
|
+
|
91
|
+
# if no address drop it, just noise
|
92
|
+
return true unless address
|
93
|
+
return true if dsn.host == address
|
94
|
+
end
|
95
|
+
|
96
|
+
false
|
97
|
+
end
|
98
|
+
|
99
|
+
def get_trace_data(otel_span, parent_context)
|
100
|
+
trace_data = TraceData.new
|
101
|
+
trace_data.span_id = otel_span.context.hex_span_id
|
102
|
+
trace_data.trace_id = otel_span.context.hex_trace_id
|
103
|
+
|
104
|
+
unless otel_span.parent_span_id == ::OpenTelemetry::Trace::INVALID_SPAN_ID
|
105
|
+
trace_data.parent_span_id = otel_span.parent_span_id.unpack1("H*")
|
106
|
+
end
|
107
|
+
|
108
|
+
sentry_trace_data = parent_context[Propagator::SENTRY_TRACE_KEY]
|
109
|
+
trace_data.parent_sampled = sentry_trace_data[2] if sentry_trace_data
|
110
|
+
|
111
|
+
trace_data.baggage = parent_context[Propagator::SENTRY_BAGGAGE_KEY]
|
112
|
+
|
113
|
+
trace_data
|
114
|
+
end
|
115
|
+
|
116
|
+
def otel_context_hash(otel_span)
|
117
|
+
otel_context = {}
|
118
|
+
otel_context[:attributes] = otel_span.attributes unless otel_span.attributes.empty?
|
119
|
+
|
120
|
+
resource_attributes = otel_span.resource.attribute_enumerator.to_h
|
121
|
+
otel_context[:resource] = resource_attributes unless resource_attributes.empty?
|
122
|
+
|
123
|
+
otel_context
|
124
|
+
end
|
125
|
+
|
126
|
+
def update_span_with_otel_data(sentry_span, otel_span)
|
127
|
+
sentry_span.set_data('otel.kind', otel_span.kind)
|
128
|
+
otel_span.attributes&.each { |k, v| sentry_span.set_data(k, v) }
|
129
|
+
|
130
|
+
op = otel_span.name
|
131
|
+
description = otel_span.name
|
132
|
+
|
133
|
+
if (http_method = otel_span.attributes[SEMANTIC_CONVENTIONS::HTTP_METHOD])
|
134
|
+
op = "http.#{otel_span.kind}"
|
135
|
+
description = http_method
|
136
|
+
|
137
|
+
peer_name = otel_span.attributes[SEMANTIC_CONVENTIONS::NET_PEER_NAME]
|
138
|
+
description += " #{peer_name}" if peer_name
|
139
|
+
|
140
|
+
target = otel_span.attributes[SEMANTIC_CONVENTIONS::HTTP_TARGET]
|
141
|
+
description += target if target
|
142
|
+
|
143
|
+
status_code = otel_span.attributes[SEMANTIC_CONVENTIONS::HTTP_STATUS_CODE]
|
144
|
+
sentry_span.set_http_status(status_code) if status_code
|
145
|
+
elsif otel_span.attributes[SEMANTIC_CONVENTIONS::DB_SYSTEM]
|
146
|
+
op = "db"
|
147
|
+
|
148
|
+
statement = otel_span.attributes[SEMANTIC_CONVENTIONS::DB_STATEMENT]
|
149
|
+
description = statement if statement
|
150
|
+
end
|
151
|
+
|
152
|
+
sentry_span.set_op(op)
|
153
|
+
sentry_span.set_description(description)
|
154
|
+
end
|
155
|
+
end
|
156
|
+
end
|
157
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "lib/sentry/opentelemetry/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "sentry-opentelemetry"
|
7
|
+
spec.version = Sentry::OpenTelemetry::VERSION
|
8
|
+
spec.authors = ["Sentry Team"]
|
9
|
+
spec.description = spec.summary = "A gem that provides OpenTelemetry integration for the Sentry error logger"
|
10
|
+
spec.email = "accounts@sentry.io"
|
11
|
+
spec.license = 'MIT'
|
12
|
+
spec.homepage = "https://github.com/getsentry/sentry-ruby"
|
13
|
+
|
14
|
+
spec.platform = Gem::Platform::RUBY
|
15
|
+
spec.required_ruby_version = '>= 2.4'
|
16
|
+
spec.extra_rdoc_files = ["README.md", "LICENSE.txt"]
|
17
|
+
spec.files = `git ls-files | grep -Ev '^(spec|benchmarks|examples)'`.split("\n")
|
18
|
+
|
19
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
20
|
+
spec.metadata["source_code_uri"] = spec.homepage
|
21
|
+
spec.metadata["changelog_uri"] = "#{spec.homepage}/blob/master/CHANGELOG.md"
|
22
|
+
|
23
|
+
spec.bindir = "exe"
|
24
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
25
|
+
spec.require_paths = ["lib"]
|
26
|
+
|
27
|
+
spec.add_dependency "sentry-ruby", "~> 5.7.0"
|
28
|
+
spec.add_dependency "opentelemetry-sdk", "~> 1.0"
|
29
|
+
end
|
metadata
ADDED
@@ -0,0 +1,90 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: sentry-opentelemetry
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 5.7.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Sentry Team
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2022-12-01 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: sentry-ruby
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 5.7.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 5.7.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: opentelemetry-sdk
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.0'
|
41
|
+
description: A gem that provides OpenTelemetry integration for the Sentry error logger
|
42
|
+
email: accounts@sentry.io
|
43
|
+
executables: []
|
44
|
+
extensions: []
|
45
|
+
extra_rdoc_files:
|
46
|
+
- README.md
|
47
|
+
- LICENSE.txt
|
48
|
+
files:
|
49
|
+
- ".gitignore"
|
50
|
+
- ".rspec"
|
51
|
+
- CODE_OF_CONDUCT.md
|
52
|
+
- Gemfile
|
53
|
+
- LICENSE.txt
|
54
|
+
- Makefile
|
55
|
+
- README.md
|
56
|
+
- Rakefile
|
57
|
+
- bin/console
|
58
|
+
- bin/setup
|
59
|
+
- lib/sentry-opentelemetry.rb
|
60
|
+
- lib/sentry/opentelemetry/propagator.rb
|
61
|
+
- lib/sentry/opentelemetry/span_processor.rb
|
62
|
+
- lib/sentry/opentelemetry/version.rb
|
63
|
+
- sentry-opentelemetry.gemspec
|
64
|
+
homepage: https://github.com/getsentry/sentry-ruby
|
65
|
+
licenses:
|
66
|
+
- MIT
|
67
|
+
metadata:
|
68
|
+
homepage_uri: https://github.com/getsentry/sentry-ruby
|
69
|
+
source_code_uri: https://github.com/getsentry/sentry-ruby
|
70
|
+
changelog_uri: https://github.com/getsentry/sentry-ruby/blob/master/CHANGELOG.md
|
71
|
+
post_install_message:
|
72
|
+
rdoc_options: []
|
73
|
+
require_paths:
|
74
|
+
- lib
|
75
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
76
|
+
requirements:
|
77
|
+
- - ">="
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: '2.4'
|
80
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
81
|
+
requirements:
|
82
|
+
- - ">="
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: '0'
|
85
|
+
requirements: []
|
86
|
+
rubygems_version: 3.1.6
|
87
|
+
signing_key:
|
88
|
+
specification_version: 4
|
89
|
+
summary: A gem that provides OpenTelemetry integration for the Sentry error logger
|
90
|
+
test_files: []
|