xhummingbird 0.1.4 → 0.1.5

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: e1463723d2e64607a48a047410df3d25e11569e4cea7c6c14cd8504b5135d66c
4
- data.tar.gz: 9980153c35d16f64a66f1ac50a69aa4db25620aa302309c1249152f1a9fd733a
3
+ metadata.gz: 15a88a5d49e5f283250cb3ea1a3c65cdbd6f856c4d4f8e51833f4395a930fce0
4
+ data.tar.gz: 6d433c7920f91d794aea403c0f0f6cfd3196b0c166574f250c6e4f6783cb4679
5
5
  SHA512:
6
- metadata.gz: 82300da2511d65007098424aee75f591d3315a8c7f75f6bbe3ae5d46a9d03e8f623032a8c436521f9a9f8b4d5edabe80030f3021763552082f3dac0939e6a3e3
7
- data.tar.gz: 7139f96f18df9aa0d970b4119f388bc3bf1a9a59b445d311b6aefb6cfd4415c8264084724fcae0d2ce7bfd772817474adbfc147c128939fb47e34980a14d28fc
6
+ metadata.gz: 746d060320800872e1e0393039d16f12adc5ab79a390f4ee1424cc29a66feae1ac3b2a0fcfb94abecacaaae3c03ce7e70ddaec713ef7600e6514e44fdc556f41
7
+ data.tar.gz: d19646279e7fc71681753f2980a1cdfe84c6ee3f5bb0b2b1c2381657d814d1fc81da9f62c142ba1d904a16f735edf4c126494481f88fc83f7921fe7bd5e6692f
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- xhummingbird (0.1.4)
4
+ xhummingbird (0.1.5)
5
5
  ffi-rzmq
6
6
  google-protobuf
7
7
 
data/lib/xhummingbird.rb CHANGED
@@ -13,6 +13,8 @@ require_relative "xhummingbird/protos/event_pb"
13
13
  module Xhummingbird
14
14
  class Error < StandardError; end
15
15
 
16
+ XH_SERVICE = 'XH_SERVICE'
17
+
16
18
  LOGGER = Logger.new(STDERR)
17
19
 
18
20
  def self.debug(*args)
@@ -27,7 +29,7 @@ module Xhummingbird
27
29
  send_trace(title: "Started", message: "Xhummingbird Ruby SDK started.", level: 0)
28
30
  end
29
31
 
30
- def self.send_trace(title:, message: "", level: 1, tags: {})
32
+ def self.send_trace(title:, message: "", level: 1, tags: {}, service: nil)
31
33
  debug(__method__)
32
34
 
33
35
  return unless enabled?
@@ -38,13 +40,14 @@ module Xhummingbird
38
40
  message: message.to_s,
39
41
  trace: caller,
40
42
  tags: default_tags.merge(format_hash(tags)),
41
- timestamp: Time.now
43
+ timestamp: Time.now,
44
+ service: service || default_service
42
45
  )
43
46
  rescue => e
44
47
  debug(e)
45
48
  end
46
49
 
47
- def self.send_exception(exception, level: 2, tags: {})
50
+ def self.send_exception(exception, level: 2, tags: {}, service: nil)
48
51
  debug(__method__)
49
52
 
50
53
  return unless enabled?
@@ -55,7 +58,8 @@ module Xhummingbird
55
58
  message: exception.message,
56
59
  trace: exception.backtrace,
57
60
  tags: default_tags.merge(format_hash(tags)),
58
- timestamp: Time.now
61
+ timestamp: Time.now,
62
+ service: service || default_service
59
63
  )
60
64
  rescue => e
61
65
  debug(e)
@@ -108,4 +112,10 @@ module Xhummingbird
108
112
 
109
113
  formatted
110
114
  end
115
+
116
+ def self.default_service
117
+ debug(__method__)
118
+
119
+ ENV.fetch(XH_SERVICE, "")
120
+ end
111
121
  end
@@ -13,6 +13,7 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
13
13
  repeated :trace, :string, 4
14
14
  map :tags, :string, :string, 5
15
15
  optional :timestamp, :message, 6, "google.protobuf.Timestamp"
16
+ optional :service, :string, 7
16
17
  end
17
18
  end
18
19
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Xhummingbird
4
- VERSION = "0.1.4"
4
+ VERSION = "0.1.5"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xhummingbird
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - xmisao
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-04-10 00:00:00.000000000 Z
11
+ date: 2021-05-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi-rzmq