sequel-honeycomb 0.3.3 → 0.4.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
- data/README.md +30 -0
- data/lib/sequel/extensions/honeycomb.rb +21 -11
- data/lib/sequel/honeycomb/version.rb +1 -2
- metadata +4 -4
- data/lib/honeycomb/version.rb +0 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f8f158b6fe32110c76ae6edf709a2024ca4a873e6a10093aaaf208fa1cc7c237
|
4
|
+
data.tar.gz: df8bbb68b69f9874ccec57a6584ace05db3f248088138e986da8e0365184f530
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 537aca7e0e18d62dfb3e308628f2225916cca2145c2b3bb24a7f68b4da42ef63445234cda9bbfac7263ff26570bbc5d8728b15b7a759adc9ea53f1e65451be18
|
7
|
+
data.tar.gz: 2e7993ddcd5546af557337395cc3625b0c9c73a3543a3160dbfffc7b1c9b6fad8a1eee7eca90c8af68808548d352d47e59b866d96a1d78ec1ef5988c3d2eab97
|
data/README.md
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# Honeycomb Tracing for Sequel
|
2
|
+
|
3
|
+
[](https://travis-ci.org/honeycombio/sequel-honeycomb)
|
4
|
+
[](https://badge.fury.io/rb/sequel-honeycomb)
|
5
|
+
|
6
|
+
This package makes it easy to instrument your Sequel database calls in your ruby application to send useful events to [Honeycomb](https://www.honeycomb.io), a service for debugging your software in production.
|
7
|
+
- [Usage and Examples](https://docs.honeycomb.io/getting-data-in/beelines/ruby-beeline/)
|
8
|
+
|
9
|
+
Sign up for a [Honeycomb
|
10
|
+
trial](https://ui.honeycomb.io/signup) to obtain an API key before starting.
|
11
|
+
|
12
|
+
## Compatible with
|
13
|
+
|
14
|
+
Requires Ruby version 2.2 or later
|
15
|
+
|
16
|
+
[Sequel](https://github.com/jeremyevans/sequel/)
|
17
|
+
|
18
|
+
## Get in touch
|
19
|
+
|
20
|
+
Please reach out to [support@honeycomb.io](mailto:support@honeycomb.io) or ping
|
21
|
+
us with the chat bubble on [our website](https://www.honeycomb.io) for any
|
22
|
+
assistance. We also welcome [bug reports](https://github.com/honeycombio/sequel-honeycomb/issues).
|
23
|
+
|
24
|
+
## Contributions
|
25
|
+
|
26
|
+
Features, bug fixes and other changes to `sequel-honeycomb` are gladly accepted. Please
|
27
|
+
open issues or a pull request with your change. Remember to add your name to the
|
28
|
+
CONTRIBUTORS file!
|
29
|
+
|
30
|
+
All contributions will be released under the Apache License 2.0.
|
@@ -42,7 +42,7 @@ module Sequel
|
|
42
42
|
event.add_field 'db.sql', sql
|
43
43
|
event.add_field 'name', query_name(sql)
|
44
44
|
start = Time.now
|
45
|
-
|
45
|
+
with_tracing_if_available(event) do
|
46
46
|
super
|
47
47
|
end
|
48
48
|
rescue Exception => e
|
@@ -65,17 +65,27 @@ module Sequel
|
|
65
65
|
sql.sub(/\s+.*/, '').upcase
|
66
66
|
end
|
67
67
|
|
68
|
-
def
|
69
|
-
return
|
68
|
+
def with_tracing_if_available(event)
|
69
|
+
# return if we are not using the ruby beeline
|
70
|
+
return yield unless defined?(::Honeycomb)
|
70
71
|
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
72
|
+
# beeline version <= 0.5.0
|
73
|
+
if ::Honeycomb.respond_to? :trace_id
|
74
|
+
trace_id = ::Honeycomb.trace_id
|
75
|
+
event.add_field 'trace.trace_id', trace_id if trace_id
|
76
|
+
span_id = SecureRandom.uuid
|
77
|
+
event.add_field 'trace.span_id', span_id
|
78
|
+
::Honeycomb.with_span_id(span_id) do |parent_span_id|
|
79
|
+
event.add_field 'trace.parent_id', parent_span_id
|
80
|
+
yield
|
81
|
+
end
|
82
|
+
# beeline version > 0.5.0
|
83
|
+
elsif ::Honeycomb.respond_to? :span_for_existing_event
|
84
|
+
::Honeycomb.span_for_existing_event(event, name: nil, type: 'db') do
|
85
|
+
yield
|
86
|
+
end
|
87
|
+
# fallback if we don't detect any known beeline tracing methods
|
88
|
+
else
|
79
89
|
yield
|
80
90
|
end
|
81
91
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sequel-honeycomb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sam Stokes
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-11-
|
11
|
+
date: 2018-11-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: libhoney
|
@@ -115,7 +115,7 @@ executables: []
|
|
115
115
|
extensions: []
|
116
116
|
extra_rdoc_files: []
|
117
117
|
files:
|
118
|
-
-
|
118
|
+
- README.md
|
119
119
|
- lib/sequel-honeycomb.rb
|
120
120
|
- lib/sequel-honeycomb/auto_install.rb
|
121
121
|
- lib/sequel/extensions/honeycomb.rb
|
@@ -123,7 +123,7 @@ files:
|
|
123
123
|
- lib/sequel/honeycomb/version.rb
|
124
124
|
homepage: https://github.com/honeycombio/sequel-honeycomb
|
125
125
|
licenses:
|
126
|
-
-
|
126
|
+
- Apache-2.0
|
127
127
|
metadata: {}
|
128
128
|
post_install_message:
|
129
129
|
rdoc_options: []
|
data/lib/honeycomb/version.rb
DELETED