sequel-honeycomb 0.3.3 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b4042e85e0c6237a77ab7d6407083dcac6a2fd6b41d78f2a44280166bd05b4f4
4
- data.tar.gz: f21f29c964a3eb2ab394fbe3fdb1c800a12b2776c02f7636053f85fdb3b704a4
3
+ metadata.gz: f8f158b6fe32110c76ae6edf709a2024ca4a873e6a10093aaaf208fa1cc7c237
4
+ data.tar.gz: df8bbb68b69f9874ccec57a6584ace05db3f248088138e986da8e0365184f530
5
5
  SHA512:
6
- metadata.gz: bd8e40d43187e4a8f5ba35a747d27a2ae268336a3145b90d64815a1cf8a4bb8042c1e7b0c802b078438c9f35a8ca205560850b0d1c65da642130025d6c9f54ef
7
- data.tar.gz: fc01b130330120ac34dba9ed3de11358590682e9eb2f771f3530a16e2b0cb1b974f07d54e844c8ea00a4027951b820b6848831f15b3d556a7e1f0268a19ed727
6
+ metadata.gz: 537aca7e0e18d62dfb3e308628f2225916cca2145c2b3bb24a7f68b4da42ef63445234cda9bbfac7263ff26570bbc5d8728b15b7a759adc9ea53f1e65451be18
7
+ data.tar.gz: 2e7993ddcd5546af557337395cc3625b0c9c73a3543a3160dbfffc7b1c9b6fad8a1eee7eca90c8af68808548d352d47e59b866d96a1d78ec1ef5988c3d2eab97
data/README.md ADDED
@@ -0,0 +1,30 @@
1
+ # Honeycomb Tracing for Sequel
2
+
3
+ [![Build Status](https://travis-ci.org/honeycombio/sequel-honeycomb.svg?branch=master)](https://travis-ci.org/honeycombio/sequel-honeycomb)
4
+ [![Gem Version](https://badge.fury.io/rb/sequel-honeycomb.svg)](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
- adding_span_metadata_if_available(event) do
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 adding_span_metadata_if_available(event)
69
- return yield unless defined?(::Honeycomb.trace_id)
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
- trace_id = ::Honeycomb.trace_id
72
-
73
- event.add_field 'trace.trace_id', trace_id if trace_id
74
- span_id = SecureRandom.uuid
75
- event.add_field 'trace.span_id', span_id
76
-
77
- ::Honeycomb.with_span_id(span_id) do |parent_span_id|
78
- event.add_field 'trace.parent_id', parent_span_id
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
@@ -1,6 +1,5 @@
1
1
  module Sequel
2
2
  module Honeycomb
3
- GEM_NAME = 'sequel-honeycomb'
4
- VERSION = '0.3.3'
3
+ VERSION = File.read(File.join(File.dirname(__FILE__), "../../VERSION")).strip
5
4
  end
6
5
  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.3.3
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-21 00:00:00.000000000 Z
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
- - lib/honeycomb/version.rb
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
- - MIT
126
+ - Apache-2.0
127
127
  metadata: {}
128
128
  post_install_message:
129
129
  rdoc_options: []
@@ -1,4 +0,0 @@
1
- module Honeycomb
2
- GEM_NAME = 'honeycomb'
3
- VERSION = '0.0.1'
4
- end